diff options
author | Paul Mackerras <paulus@samba.org> | 2005-12-01 22:42:46 +1100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-12-01 22:42:46 +1100 |
commit | 38ad0910a0fad012943e6e87f1fc0b1de5851d91 (patch) | |
tree | 4627e8b74ea74ac0cd3fc1795e1df974c3201c16 /gitk | |
parent | b5c2f30689d66761ce4e8a5e69c9924c0c389233 (diff) | |
download | git-38ad0910a0fad012943e6e87f1fc0b1de5851d91.tar.gz git-38ad0910a0fad012943e6e87f1fc0b1de5851d91.tar.xz |
gitk: Factored out some common code into a new start_rev_list procedure
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'gitk')
-rwxr-xr-x | gitk | 52 |
1 files changed, 22 insertions, 30 deletions
@@ -32,26 +32,16 @@ proc parse_args {rargs} { return $parsed_args } -proc getcommits {rargs} { - global oldcommits commits commfd phase canv mainfont env +proc start_rev_list {rlargs} { global startmsecs nextupdate ncmupdate - global ctext maincursor textcursor leftover gitencoding + global commfd leftover gitencoding - # check that we can find a .git directory somewhere... - set gitdir [gitdir] - if {![file isdirectory $gitdir]} { - error_popup "Cannot find the git directory \"$gitdir\"." - exit 1 - } - set oldcommits {} - set commits {} - set phase getcommits set startmsecs [clock clicks -milliseconds] set nextupdate [expr {$startmsecs + 100}] set ncmupdate 1 - set parsed_args [parse_args $rargs] if [catch { - set commfd [open "|git-rev-list --header --topo-order --parents $parsed_args" r] + set commfd [open [concat | git-rev-list --header --topo-order \ + --parents $rlargs] r] } err] { puts stderr "Error executing git-rev-list: $err" exit 1 @@ -59,11 +49,26 @@ proc getcommits {rargs} { set leftover {} fconfigure $commfd -blocking 0 -translation lf -encoding $gitencoding fileevent $commfd readable [list getcommitlines $commfd] + . config -cursor watch + settextcursor watch +} + +proc getcommits {rargs} { + global oldcommits commits phase canv mainfont env + + # check that we can find a .git directory somewhere... + set gitdir [gitdir] + if {![file isdirectory $gitdir]} { + error_popup "Cannot find the git directory \"$gitdir\"." + exit 1 + } + set oldcommits {} + set commits {} + set phase getcommits + start_rev_list [parse_args $rargs] $canv delete all $canv create text 3 3 -anchor nw -text "Reading commits..." \ -font $mainfont -tags textitems - . config -cursor watch - settextcursor watch } proc getcommitlines {commfd} { @@ -3684,20 +3689,7 @@ proc updatecommits {rargs} { } readrefs - if [catch { - set commfd [open "|git-rev-list --header --topo-order --parents $ignoreold $args" r] - } err] { - puts stderr "Error executing git-rev-list: $err" - exit 1 - } - set startmsecs [clock clicks -milliseconds] - set nextupdate [expr $startmsecs + 100] - set ncmupdate 1 - set leftover {} - fconfigure $commfd -blocking 0 -translation lf - fileevent $commfd readable [list getcommitlines $commfd] - . config -cursor watch - settextcursor watch + start_rev_list [concat $ignoreold $args] } proc showtag {tag isnew} { |