This uses git-rev-parse --no-revs --no-flags to give us just the
file and directory names on the command line, so that we can create
the "Command line" view if any were specified. All other arguments
just get passed to git-rev-list (without a pass through git-rev-parse).
Signed-off-by: Paul Mackerras <paulus@samba.org>
-proc parse_args {rargs} {
- global parsed_args cmdline_files
-
- set parsed_args {}
- set cmdline_files {}
- if {[catch {
- set args [concat --default HEAD $rargs]
- set args [split [eval exec git-rev-parse $args] "\n"]
- set i 0
- foreach arg $args {
- if {![regexp {^[0-9a-f]{40}$} $arg]} {
- if {$arg eq "--"} {
- incr i
- }
- set cmdline_files [lrange $args $i end]
- break
- }
- lappend parsed_args $arg
- incr i
- }
- }]} {
- # if git-rev-parse failed for some reason...
- set i [lsearch -exact $rargs "--"]
- if {$i >= 0} {
- set cmdline_files [lrange $rargs [expr {$i+1}] end]
- set rargs [lrange $rargs 0 [expr {$i-1}]]
- }
- if {$rargs == {}} {
- set parsed_args HEAD
- } else {
- set parsed_args $rargs
- }
- }
-}
-
-proc start_rev_list {rlargs} {
+proc start_rev_list {} {
global startmsecs nextupdate ncmupdate
global commfd leftover tclencoding datemode
global startmsecs nextupdate ncmupdate
global commfd leftover tclencoding datemode
+ global revtreeargs curview viewfiles
set startmsecs [clock clicks -milliseconds]
set nextupdate [expr {$startmsecs + 100}]
set ncmupdate 1
initlayout
set startmsecs [clock clicks -milliseconds]
set nextupdate [expr {$startmsecs + 100}]
set ncmupdate 1
initlayout
+ set args $revtreeargs
+ if {$viewfiles($curview) ne {}} {
+ set args [concat $args "--" $viewfiles($curview)]
+ }
set order "--topo-order"
if {$datemode} {
set order "--date-order"
}
if {[catch {
set commfd [open [concat | git-rev-list --header $order \
set order "--topo-order"
if {$datemode} {
set order "--date-order"
}
if {[catch {
set commfd [open [concat | git-rev-list --header $order \
- --parents --boundary $rlargs] r]
+ --parents --boundary --default HEAD $args] r]
} err]} {
puts stderr "Error executing git-rev-list: $err"
exit 1
} err]} {
puts stderr "Error executing git-rev-list: $err"
exit 1
-proc getcommits {rargs} {
global phase canv mainfont
set phase getcommits
global phase canv mainfont
set phase getcommits
$canv delete all
$canv create text 3 3 -anchor nw -text "Reading commits..." \
-font $mainfont -tags textitems
$canv delete all
$canv create text 3 3 -anchor nw -text "Reading commits..." \
-font $mainfont -tags textitems
set n $curview
set curview -1
catch {unset viewdata($n)}
set n $curview
set curview -1
catch {unset viewdata($n)}
- parse_args $revtreeargs
global numcommits rowrangelist commitlisted idrowranges
global selectedline currentid canv canvy0
global matchinglines treediffs
global numcommits rowrangelist commitlisted idrowranges
global selectedline currentid canv canvy0
global matchinglines treediffs
global pending_select phase
global commitidx rowlaidout rowoptim linesegends leftover
global commfd nextupdate
global pending_select phase
global commitidx rowlaidout rowoptim linesegends leftover
global commfd nextupdate
.bar.view entryconf 2 -state [expr {$n == 0? "disabled": "normal"}]
if {![info exists viewdata($n)]} {
.bar.view entryconf 2 -state [expr {$n == 0? "disabled": "normal"}]
if {![info exists viewdata($n)]} {
- set args $parsed_args
- if {$viewfiles($n) ne {}} {
- set args [concat $args "--" $viewfiles($n)]
- }
set pending_select $selid
set pending_select $selid
setcoords
makewindow
readrefs
setcoords
makewindow
readrefs
-parse_args $revtreeargs
-set args $parsed_args
+
+set cmdline_files {}
+catch {
+ set fileargs [eval exec git-rev-parse --no-revs --no-flags $revtreeargs]
+ set cmdline_files [split $fileargs "\n"]
+ set n [llength $cmdline_files]
+ set revtreeargs [lrange $revtreeargs 0 end-$n]
+}
+if {[lindex $revtreeargs end] eq "--"} {
+ set revtreeargs [lrange $revtreeargs 0 end-1]
+}
+
if {$cmdline_files ne {}} {
# create a view for the files/dirs specified on the command line
set curview 1
if {$cmdline_files ne {}} {
# create a view for the files/dirs specified on the command line
set curview 1
set viewfiles(1) $cmdline_files
.bar.view add command -label $viewname(1) -command {showview 1}
.bar.view entryconf 2 -state normal
set viewfiles(1) $cmdline_files
.bar.view add command -label $viewname(1) -command {showview 1}
.bar.view entryconf 2 -state normal
- set args [concat $args "--" $cmdline_files]