@matheusbsbs / matheus-bagliano / commits / 38ad0910a0
Fork 0

gitk: Factored out some common code into a new start_rev_list procedure

Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Dec 1, 2005 at 22:42 UTC 38ad0910a0fad012943e6e87f1fc0b1de5851d91
1 file changed +22 -30
gitk
+22 -30
@@ -32,26 +32,16 @@ proc parse_args {rargs} {
32 return $parsed_args
33 }
34
35 -proc getcommits {rargs} {
36 - global oldcommits commits commfd phase canv mainfont env
35 +proc start_rev_list {rlargs} {
36 global startmsecs nextupdate ncmupdate
38 - global ctext maincursor textcursor leftover gitencoding
37 + global commfd leftover gitencoding
38
40 - # check that we can find a .git directory somewhere...
41 - set gitdir [gitdir]
42 - if {![file isdirectory $gitdir]} {
43 - error_popup "Cannot find the git directory \"$gitdir\"."
44 - exit 1
45 - }
46 - set oldcommits {}
47 - set commits {}
48 - set phase getcommits
39 set startmsecs [clock clicks -milliseconds]
40 set nextupdate [expr {$startmsecs + 100}]
41 set ncmupdate 1
52 - set parsed_args [parse_args $rargs]
42 if [catch {
54 - set commfd [open "|git-rev-list --header --topo-order --parents $parsed_args" r]
43 + set commfd [open [concat | git-rev-list --header --topo-order \
44 + --parents $rlargs] r]
45 } err] {
46 puts stderr "Error executing git-rev-list: $err"
47 exit 1
@@ -59,11 +49,26 @@ proc getcommits {rargs} {
49 set leftover {}
50 fconfigure $commfd -blocking 0 -translation lf -encoding $gitencoding
51 fileevent $commfd readable [list getcommitlines $commfd]
52 + . config -cursor watch
53 + settextcursor watch
54 +}
55 +
56 +proc getcommits {rargs} {
57 + global oldcommits commits phase canv mainfont env
58 +
59 + # check that we can find a .git directory somewhere...
60 + set gitdir [gitdir]
61 + if {![file isdirectory $gitdir]} {
62 + error_popup "Cannot find the git directory \"$gitdir\"."
63 + exit 1
64 + }
65 + set oldcommits {}
66 + set commits {}
67 + set phase getcommits
68 + start_rev_list [parse_args $rargs]
69 $canv delete all
70 $canv create text 3 3 -anchor nw -text "Reading commits..." \
71 -font $mainfont -tags textitems
65 - . config -cursor watch
66 - settextcursor watch
72 }
73
74 proc getcommitlines {commfd} {
@@ -3684,20 +3689,7 @@ proc updatecommits {rargs} {
3689 }
3690
3691 readrefs
3687 - if [catch {
3688 - set commfd [open "|git-rev-list --header --topo-order --parents $ignoreold $args" r]
3689 - } err] {
3690 - puts stderr "Error executing git-rev-list: $err"
3691 - exit 1
3692 - }
3693 - set startmsecs [clock clicks -milliseconds]
3694 - set nextupdate [expr $startmsecs + 100]
3695 - set ncmupdate 1
3696 - set leftover {}
3697 - fconfigure $commfd -blocking 0 -translation lf
3698 - fileevent $commfd readable [list getcommitlines $commfd]
3699 - . config -cursor watch
3700 - settextcursor watch
3692 + start_rev_list [concat $ignoreold $args]
3693 }
3694
3695 proc showtag {tag isnew} {