proc start_rev_list {view} {
global startmsecs
global commfd leftover tclencoding datemode
- global viewargs viewfiles commitidx viewcomplete
- global viewargs viewargscmd viewfiles commitidx viewcomplete vnextroot
++ global viewargs viewargscmd viewfiles commitidx viewcomplete
global showlocalchanges commitinterest mainheadid
global progressdirn progresscoords proglastnc curview
+ global viewactive loginstance viewinstances
+ global pending_select mainheadid
set startmsecs [clock clicks -milliseconds]
set commitidx($view) 0
set viewcomplete($view) 0
- set vnextroot($view) 0
+ set viewactive($view) 1
+ varcinit $view
+
+ set args $viewargs($view)
+ if {$viewargscmd($view) ne {}} {
+ if {[catch {
+ set str [exec sh -c $viewargscmd($view)]
+ } err]} {
+ error_popup "Error executing --argscmd command: $err"
+ exit 1
+ }
+ set args [concat $args [split $str "\n"]]
+ }
- set order "--topo-order"
- if {$datemode} {
- set order "--date-order"
- }
if {[catch {
- set fd [open [concat | git log --no-color -z --pretty=raw $order --parents \
+ set fd [open [concat | git log --no-color -z --pretty=raw --parents \
- --boundary $viewargs($view) "--" $viewfiles($view)] r]
+ --boundary $args "--" $viewfiles($view)] r]
} err]} {
- error_popup "[mc "Error executing git rev-list:"] $err"
+ error_popup "[mc "Error executing git log:"] $err"
exit 1
}
- set commfd($view) $fd
- set leftover($view) {}
+ set i [incr loginstance]
+ set viewinstances($view) [list $i]
+ set commfd($i) $fd
+ set leftover($i) {}
if {$showlocalchanges} {
lappend commitinterest($mainheadid) {dodiffindex}
}
initlayout
start_rev_list $curview
show_status [mc "Reading commits..."]
+ set need_redisplay 1
+}
+
+proc updatecommits {} {
+ global curview viewargs viewfiles viewinstances
+ global viewactive viewcomplete loginstance tclencoding mainheadid
+ global startmsecs commfd showneartags showlocalchanges leftover
+ global mainheadid pending_select
++ global isworktree
+
++ set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
+ set oldmainid $mainheadid
+ rereadrefs
+ if {$showlocalchanges} {
+ if {$mainheadid ne $oldmainid} {
+ dohidelocalchanges
+ }
+ if {[commitinview $mainheadid $curview]} {
+ dodiffindex
+ }
+ }
+ set view $curview
+ if {[catch {
+ set fd [open [concat | git log --no-color -z --pretty=raw --parents \
+ --boundary $viewargs($view) --not [seeds $view] \
+ "--" $viewfiles($view)] r]
+ } err]} {
+ error_popup "Error executing git log: $err"
+ exit 1
+ }
+ if {$viewactive($view) == 0} {
+ set startmsecs [clock clicks -milliseconds]
+ }
+ set i [incr loginstance]
+ lappend viewinstances($view) $i
+ set commfd($i) $fd
+ set leftover($i) {}
+ fconfigure $fd -blocking 0 -translation lf -eofchar {}
+ if {$tclencoding != {}} {
+ fconfigure $fd -encoding $tclencoding
+ }
+ filerun $fd [list getcommitlines $fd $i $view 1]
+ incr viewactive($view)
+ set viewcomplete($view) 0
+ set pending_select $mainheadid
+ nowbusy $view "Reading"
+ if {$showneartags} {
+ getallcommits
+ }
+}
+
+proc reloadcommits {} {
+ global curview viewcomplete selectedline currentid thickerline
+ global showneartags treediffs commitinterest cached_commitrow
+ global progresscoords targetid
+
+ if {!$viewcomplete($curview)} {
+ stop_rev_list $curview
+ set progresscoords {0 0}
+ adjustprogress
+ }
+ resetvarcs $curview
+ catch {unset selectedline}
+ catch {unset currentid}
+ catch {unset thickerline}
+ catch {unset treediffs}
+ readrefs
+ changedrefs
+ if {$showneartags} {
+ getallcommits
+ }
+ clear_display
+ catch {unset commitinterest}
+ catch {unset cached_commitrow}
+ catch {unset targetid}
+ setcanvscroll
+ getcommits
+ return 0
}
# This makes a string representation of a positive integer which
# doviewmenu $viewhlmenu 1 [list addvhighlight $n] \
# entryconf [list -label $viewname($n) -value $viewname($n)]
}
- if {$files ne $viewfiles($n) || $newargs ne $viewargs($n)} {
+ if {$files ne $viewfiles($n) || $newargs ne $viewargs($n) || \
+ $newviewargscmd($n) ne $viewargscmd($n)} {
set viewfiles($n) $files
set viewargs($n) $newargs
+ set viewargscmd($n) $newviewargscmd($n)
if {$curview == $n} {
- run updatecommits
+ run reloadcommits
}
}
}
# spawn off a process to do git diff-index --cached HEAD
proc dodiffindex {} {
- global localirow localfrow lserial showlocalchanges
+ global lserial showlocalchanges
+ global isworktree
- if {!$showlocalchanges} return
+ if {!$showlocalchanges || !$isworktree} return
incr lserial
- set localfrow -1
- set localirow -1
set fd [open "|git diff-index --cached HEAD" r]
fconfigure $fd -blocking 0
filerun $fd [list readdiffindex $fd $lserial]
global commentend idtags linknum
global mergemax numcommits pending_select
global cmitmode showneartags allcommits
+ global targetrow targetid lastscrollrows
+ global autoselect
catch {unset pending_select}
$canv delete hover
make_secsel $l
if {$isnew} {
- addtohistory [list selectline $l 0]
+ addtohistory [list selbyid $id]
}
- set selectedline $l
-
- set id [lindex $displayorder $l]
- set currentid $id
$sha1entry delete 0 end
$sha1entry insert 0 $id
- $sha1entry selection from 0
- $sha1entry selection to end
+ if {$autoselect} {
+ $sha1entry selection from 0
+ $sha1entry selection to end
+ }
rhighlight_sel $id
$ctext conf -state normal
set viewfiles(0) {}
set viewperm(0) 0
set viewargs(0) {}
+ set viewargscmd(0) {}
+set loginstance 0
set cmdlineok 0
set stopped 0
set stuffsaved 0
set patchnum 0
-set localirow -1
-set localfrow -1
set lserial 0
+ set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
setcoords
makewindow
# wait for the window to become visible