Erk.  That's not optimal since it hits up the webapp for every request.  
A faster/less-resource-intensive way would be to grab the files from the 
static content root at:

http://opensolaris.org/sc/src/opengrok/trunk
which you can do with a recursive wget.

(though the tree isn't currently updating correctly, but I just sent a 
note to website-discuss about that bug)

cheers,
steve

Moisei Rabinovich wrote:
> Hello, since I was not able to install and use mercurial client to 
> checkout the opengrok sources.
> I wrote a small script to grab the opengrok soruces from ... opengrok 
> browser of the open grok sources :).
> It is very small adn hacky script written in TCL but it works well for 
> me. I attach and paste it below (if attachments do not pass in this 
> list),
> just in case somebody is intetersted in.
>
> However, I just thought that it could be a useful feature for the 
> opengrok browser:
> checkout/export source folder to the user local folder. It can use the 
> same logic as my poor script.
>
>
> #~ http://src.opensolaris.org/source/raw/opengrok/trunk/web/diff.jsp
> #~ <a href="diff.jsp" class="p">
> #~ dir:  {} {href="document/" class="r"} {}
> #~ file: {} {href="Hash2TokenStream.java" class="p"} Hash2TokenStream.java
> #~ tag slash param textBehindTheTag
>
> #~ 
> http://cvs.opensolaris.org/source/xref/opengrok/trunk/src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java
> #~ 
> http://cvs.opensolaris.org/source/raw/opengrok/trunk/src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java
> package require htmlparse
> package require http
>
> proc http_get {url} {
>     set h [http::geturl $url]
>     set html [http::data $h]
>     return $html
> }
>
> proc http_get_to_file {url local_file} {
>     set txt [http_get $url]
>     set h [open $local_file "w"]
>     fconfigure $h -translation binary
>     puts -nonewline $h $txt
>     close $h
>     return $txt
> }
>
> proc html_handle {tag slash param textBehindTheTag} {
>     set param_list [split $param "="]
>     set class [string trim [lindex $param_list 2] "\""]
>     if {$class == {p}} {
>         set file [string range [string trim [lindex $param_list 1] 
> "\""] 0 end-7]
>         #~ puts file:$file
>         lappend ::file_list $file
>     }
>     if {$class == {r}} {
>         set dir [string range [string trim [lindex $param_list 1] 
> "\""] 0 end-8]
>         #~ puts dir:$dir
>         lappend ::dir_list $dir
>     }
> }
>
> proc grab_url {root_url remote_dir local_dir} {
>     set xref_url "$root_url/xref/$remote_dir/"
>     set raw_url  "$root_url/raw/$remote_dir"
>     file mkdir $local_dir
>     set ::file_list [list]
>     set ::dir_list  [list]
>     set html [http_get $xref_url]
>     htmlparse::parse -cmd html_handle $html   
>     foreach file $::file_list {
>         set local_file [file join $local_dir $file]
>         set file_url   $raw_url/$file
>         puts $file_url--$local_file
>         http_get_to_file $file_url $local_file
>     }          
>     foreach dir $::dir_list {
>         grab_url $root_url $remote_dir/$dir $local_dir/$dir
>     }
> }
>
> proc main {} {
>     set root_url   { http://cvs.opensolaris.org/source}
>     set remote_dir {opengrok}
>     set local_dir {D:\grok\src\opengrok-0.5-grabbed-new}
>     file delete -force $local_dir
>
>     grab_url $root_url $remote_dir $local_dir
> }
>
> main
>
>
> -- 
> Best Regards,
> Moisei
> ------------------------------------------------------------------------
>
> _______________________________________________
> opengrok-discuss mailing list
> opengrok-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/opengrok-discuss
>   


-- 
stephen lau | stevel at opensolaris.org | www.whacked.net


Reply via email to