annotate contrib/hgk @ 274:5da941efbb52

[PATCH] hgk should parse dates in the diff output -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] hgk should parse dates in the diff output hgk doesn't deal well with the difflib style diffs, it expects the filename to be the last thing on the line. This patch fixes the regexp to stop reading the filename at the first tab. Signed-off-by: Chris Mason <mason@suse.com> manifest hash: 9c5bcf427455dcf306ab6f91b1986723caa83f36 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCpl/HywK+sNU5EO8RAgAjAKCOuZsRtJDbdurTQry+7krtLTtRQQCfXLuN LZEFkcOGS0jiAC6vci/RLJ0= =jkr1 -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 07 Jun 2005 19:02:31 -0800
parents 497aa6d276d2
children a69c3b2957d1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1 #!/bin/sh
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
2 # Tcl ignores the next line -*- tcl -*- \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
3 exec wish "$0" -- "${1+$@}"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
4
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
5 # Copyright (C) 2005 Paul Mackerras. All rights reserved.
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
6 # This program is free software; it may be used, copied, modified
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
7 # and distributed under the terms of the GNU General Public Licence,
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
8 # either version 2, or (at your option) any later version.
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
9
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
10 # CVS $Revision: 1.20 $
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
11
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
12 proc readfullcommits {rargs} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
13 global commits commfd phase canv mainfont curcommit allcommitstate
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
14 if {$rargs == {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
15 set rargs HEAD
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
16 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
17 set commits {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
18 set curcommit {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
19 set allcommitstate none
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
20 set phase getcommits
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
21 if [catch {set commfd [open "|hgit rev-list -c $rargs" r]} err] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
22 puts stderr "Error executing hgit rev-list: $err"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
23 exit 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
24 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
25 fconfigure $commfd -blocking 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
26 fileevent $commfd readable "getallcommitline $commfd"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
27 $canv delete all
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
28 $canv create text 3 3 -anchor nw -text "Reading all commits..." \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
29 -font $mainfont -tags textitems
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
30 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
31
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
32 proc getcommitline {commfd} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
33 global commits parents cdate nparents children nchildren
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
34 set n [gets $commfd line]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
35 if {$n < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
36 if {![eof $commfd]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
37 # this works around what is apparently a bug in Tcl...
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
38 fconfigure $commfd -blocking 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
39 if {![catch {close $commfd} err]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
40 after idle readallcommits
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
41 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
42 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
43 if {[string range $err 0 4] == "usage"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
44 set err "\
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
45 Gitk: error reading commits: bad arguments to hgit rev-list.\n\
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
46 (Note: arguments to gitk are passed to hgit rev-list\
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
47 to allow selection of commits to be displayed.)"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
48 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
49 set err "Error reading commits: $err"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
50 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
51 error_popup $err
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
52 exit 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
53 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
54 if {![regexp {^[0-9a-f]{40}$} $line]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
55 error_popup "Can't parse hgit rev-tree output: {$line}"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
56 exit 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
57 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
58 lappend commits $line
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
59 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
60
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
61 proc readallcommits {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
62 global commits
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
63 foreach id $commits {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
64 readcommit $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
65 update
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
66 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
67 drawgraph
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
68 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
69
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
70 proc readonecommit {id contents} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
71 global commitinfo children nchildren parents nparents cdate
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
72 set inhdr 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
73 set comment {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
74 set headline {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
75 set auname {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
76 set audate {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
77 set comname {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
78 set comdate {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
79 if {![info exists nchildren($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
80 set children($id) {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
81 set nchildren($id) 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
82 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
83 set parents($id) {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
84 set nparents($id) 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
85 foreach line [split $contents "\n"] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
86 if {$inhdr} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
87 if {$line == {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
88 set inhdr 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
89 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
90 set tag [lindex $line 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
91 if {$tag == "parent"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
92 set p [lindex $line 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
93 if {![info exists nchildren($p)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
94 set children($p) {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
95 set nchildren($p) 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
96 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
97 lappend parents($id) $p
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
98 incr nparents($id)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
99 if {[lsearch -exact $children($p) $id] < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
100 lappend children($p) $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
101 incr nchildren($p)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
102 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
103 } elseif {$tag == "author"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
104 set x [expr {[llength $line] - 2}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
105 set audate [lindex $line $x]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
106 set auname [lrange $line 1 [expr {$x - 1}]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
107 } elseif {$tag == "committer"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
108 set x [expr {[llength $line] - 2}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
109 set comdate [lindex $line $x]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
110 set comname [lrange $line 1 [expr {$x - 1}]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
111 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
112 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
113 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
114 if {$comment == {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
115 set headline $line
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
116 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
117 append comment "\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
118 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
119 append comment $line
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
120 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
121 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
122 if {$audate != {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
123 set audate [clock format $audate -format "%Y-%m-%d %H:%M:%S"]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
124 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
125 if {$comdate != {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
126 set cdate($id) $comdate
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
127 set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
128 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
129 set commitinfo($id) [list $headline $auname $audate \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
130 $comname $comdate $comment]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
131 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
132
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
133 proc getallcommitline {commfd} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
134 global commits allcommitstate curcommit curcommitid
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
135 set n [gets $commfd line]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
136 set s "\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
137 if {$n < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
138 if {![eof $commfd]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
139 # this works around what is apparently a bug in Tcl...
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
140 fconfigure $commfd -blocking 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
141 if {![catch {close $commfd} err]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
142 after idle drawgraph
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
143 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
144 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
145 if {[string range $err 0 4] == "usage"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
146 set err "\
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
147 Gitk: error reading commits: bad arguments to hgit rev-list.\n\
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
148 (Note: arguments to gitk are passed to hgit rev-list\
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
149 to allow selection of commits to be displayed.)"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
150 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
151 set err "Error reading commits: $err"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
152 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
153 error_popup $err
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
154 exit 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
155 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
156 if {[string range $line 0 1] != " "} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
157 if {$allcommitstate == "indent"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
158 readonecommit $curcommitid $curcommit
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
159 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
160 if {$allcommitstate == "start"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
161 set curcommit $curcommit$line$s
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
162 set allcommitstate "indent"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
163 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
164 set curcommitid $line
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
165 set curcommit {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
166 set allcommitstate "start"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
167 lappend commits $line
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
168 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
169 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
170 set d [string range $line 2 end]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
171 set curcommit $curcommit$d$s
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
172 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
173 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
174
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
175 proc getcommits {rargs} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
176 global commits commfd phase canv mainfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
177 if {$rargs == {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
178 set rargs HEAD
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
179 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
180 set commits {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
181 set phase getcommits
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
182 if [catch {set commfd [open "|hgit rev-list $rargs" r]} err] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
183 puts stderr "Error executing hgit rev-list: $err"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
184 exit 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
185 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
186 fconfigure $commfd -blocking 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
187 fileevent $commfd readable "getcommitline $commfd"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
188 $canv delete all
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
189 $canv create text 3 3 -anchor nw -text "Reading commits..." \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
190 -font $mainfont -tags textitems
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
191 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
192
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
193 proc readcommit {id} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
194 global commitinfo children nchildren parents nparents cdate
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
195 set inhdr 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
196 set comment {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
197 set headline {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
198 set auname {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
199 set audate {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
200 set comname {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
201 set comdate {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
202 if {![info exists nchildren($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
203 set children($id) {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
204 set nchildren($id) 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
205 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
206 set parents($id) {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
207 set nparents($id) 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
208 if [catch {set contents [exec hgit cat-file commit $id]}] return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
209 readonecommit $id $contents
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
210 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
211
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
212 proc readrefs {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
213 global tagids idtags
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
214 set tags [glob -nocomplain -types f .git/refs/tags/*]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
215 foreach f $tags {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
216 catch {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
217 set fd [open $f r]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
218 set line [read $fd]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
219 if {[regexp {^[0-9a-f]{40}} $line id]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
220 set contents [split [exec hgit cat-file tag $id] "\n"]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
221 set obj {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
222 set type {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
223 set tag {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
224 foreach l $contents {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
225 if {$l == {}} break
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
226 switch -- [lindex $l 0] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
227 "object" {set obj [lindex $l 1]}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
228 "type" {set type [lindex $l 1]}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
229 "tag" {set tag [string range $l 4 end]}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
230 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
231 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
232 if {$obj != {} && $type == "commit" && $tag != {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
233 set tagids($tag) $obj
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
234 lappend idtags($obj) $tag
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
235 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
236 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
237 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
238 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
239 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
240
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
241 proc error_popup msg {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
242 set w .error
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
243 toplevel $w
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
244 wm transient $w .
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
245 message $w.m -text $msg -justify center -aspect 400
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
246 pack $w.m -side top -fill x -padx 20 -pady 20
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
247 button $w.ok -text OK -command "destroy $w"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
248 pack $w.ok -side bottom -fill x
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
249 bind $w <Visibility> "grab $w; focus $w"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
250 tkwait window $w
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
251 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
252
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
253 proc makewindow {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
254 global canv canv2 canv3 linespc charspc ctext cflist textfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
255 global findtype findloc findstring fstring geometry
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
256 global entries sha1entry sha1string sha1but
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
257
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
258 menu .bar
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
259 .bar add cascade -label "File" -menu .bar.file
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
260 menu .bar.file
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
261 .bar.file add command -label "Quit" -command doquit
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
262 menu .bar.help
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
263 .bar add cascade -label "Help" -menu .bar.help
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
264 .bar.help add command -label "About gitk" -command about
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
265 . configure -menu .bar
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
266
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
267 if {![info exists geometry(canv1)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
268 set geometry(canv1) [expr 45 * $charspc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
269 set geometry(canv2) [expr 30 * $charspc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
270 set geometry(canv3) [expr 15 * $charspc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
271 set geometry(canvh) [expr 25 * $linespc + 4]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
272 set geometry(ctextw) 80
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
273 set geometry(ctexth) 30
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
274 set geometry(cflistw) 30
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
275 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
276 panedwindow .ctop -orient vertical
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
277 if {[info exists geometry(width)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
278 .ctop conf -width $geometry(width) -height $geometry(height)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
279 set texth [expr {$geometry(height) - $geometry(canvh) - 56}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
280 set geometry(ctexth) [expr {($texth - 8) /
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
281 [font metrics $textfont -linespace]}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
282 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
283 frame .ctop.top
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
284 frame .ctop.top.bar
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
285 pack .ctop.top.bar -side bottom -fill x
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
286 set cscroll .ctop.top.csb
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
287 scrollbar $cscroll -command {allcanvs yview} -highlightthickness 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
288 pack $cscroll -side right -fill y
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
289 panedwindow .ctop.top.clist -orient horizontal -sashpad 0 -handlesize 4
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
290 pack .ctop.top.clist -side top -fill both -expand 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
291 .ctop add .ctop.top
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
292 set canv .ctop.top.clist.canv
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
293 canvas $canv -height $geometry(canvh) -width $geometry(canv1) \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
294 -bg white -bd 0 \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
295 -yscrollincr $linespc -yscrollcommand "$cscroll set"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
296 .ctop.top.clist add $canv
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
297 set canv2 .ctop.top.clist.canv2
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
298 canvas $canv2 -height $geometry(canvh) -width $geometry(canv2) \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
299 -bg white -bd 0 -yscrollincr $linespc
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
300 .ctop.top.clist add $canv2
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
301 set canv3 .ctop.top.clist.canv3
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
302 canvas $canv3 -height $geometry(canvh) -width $geometry(canv3) \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
303 -bg white -bd 0 -yscrollincr $linespc
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
304 .ctop.top.clist add $canv3
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
305 bind .ctop.top.clist <Configure> {resizeclistpanes %W %w}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
306
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
307 set sha1entry .ctop.top.bar.sha1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
308 set entries $sha1entry
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
309 set sha1but .ctop.top.bar.sha1label
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
310 button $sha1but -text "SHA1 ID: " -state disabled -relief flat \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
311 -command gotocommit -width 8
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
312 $sha1but conf -disabledforeground [$sha1but cget -foreground]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
313 pack .ctop.top.bar.sha1label -side left
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
314 entry $sha1entry -width 40 -font $textfont -textvariable sha1string
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
315 trace add variable sha1string write sha1change
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
316 pack $sha1entry -side left -pady 2
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
317 button .ctop.top.bar.findbut -text "Find" -command dofind
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
318 pack .ctop.top.bar.findbut -side left
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
319 set findstring {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
320 set fstring .ctop.top.bar.findstring
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
321 lappend entries $fstring
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
322 entry $fstring -width 30 -font $textfont -textvariable findstring
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
323 pack $fstring -side left -expand 1 -fill x
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
324 set findtype Exact
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
325 tk_optionMenu .ctop.top.bar.findtype findtype Exact IgnCase Regexp
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
326 set findloc "All fields"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
327 tk_optionMenu .ctop.top.bar.findloc findloc "All fields" Headline \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
328 Comments Author Committer
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
329 pack .ctop.top.bar.findloc -side right
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
330 pack .ctop.top.bar.findtype -side right
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
331
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
332 panedwindow .ctop.cdet -orient horizontal
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
333 .ctop add .ctop.cdet
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
334 frame .ctop.cdet.left
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
335 set ctext .ctop.cdet.left.ctext
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
336 text $ctext -bg white -state disabled -font $textfont \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
337 -width $geometry(ctextw) -height $geometry(ctexth) \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
338 -yscrollcommand ".ctop.cdet.left.sb set"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
339 scrollbar .ctop.cdet.left.sb -command "$ctext yview"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
340 pack .ctop.cdet.left.sb -side right -fill y
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
341 pack $ctext -side left -fill both -expand 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
342 .ctop.cdet add .ctop.cdet.left
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
343
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
344 $ctext tag conf filesep -font [concat $textfont bold]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
345 $ctext tag conf hunksep -back blue -fore white
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
346 $ctext tag conf d0 -back "#ff8080"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
347 $ctext tag conf d1 -back green
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
348 $ctext tag conf found -back yellow
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
349
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
350 frame .ctop.cdet.right
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
351 set cflist .ctop.cdet.right.cfiles
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
352 listbox $cflist -bg white -selectmode extended -width $geometry(cflistw) \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
353 -yscrollcommand ".ctop.cdet.right.sb set"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
354 scrollbar .ctop.cdet.right.sb -command "$cflist yview"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
355 pack .ctop.cdet.right.sb -side right -fill y
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
356 pack $cflist -side left -fill both -expand 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
357 .ctop.cdet add .ctop.cdet.right
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
358 bind .ctop.cdet <Configure> {resizecdetpanes %W %w}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
359
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
360 pack .ctop -side top -fill both -expand 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
361
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
362 bindall <1> {selcanvline %x %y}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
363 bindall <B1-Motion> {selcanvline %x %y}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
364 bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
365 bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
366 bindall <2> "allcanvs scan mark 0 %y"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
367 bindall <B2-Motion> "allcanvs scan dragto 0 %y"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
368 bind . <Key-Up> "selnextline -1"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
369 bind . <Key-Down> "selnextline 1"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
370 bind . <Key-Prior> "allcanvs yview scroll -1 pages"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
371 bind . <Key-Next> "allcanvs yview scroll 1 pages"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
372 bindkey <Key-Delete> "$ctext yview scroll -1 pages"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
373 bindkey <Key-BackSpace> "$ctext yview scroll -1 pages"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
374 bindkey <Key-space> "$ctext yview scroll 1 pages"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
375 bindkey p "selnextline -1"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
376 bindkey n "selnextline 1"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
377 bindkey b "$ctext yview scroll -1 pages"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
378 bindkey d "$ctext yview scroll 18 units"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
379 bindkey u "$ctext yview scroll -18 units"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
380 bindkey / findnext
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
381 bindkey ? findprev
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
382 bindkey f nextfile
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
383 bind . <Control-q> doquit
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
384 bind . <Control-f> dofind
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
385 bind . <Control-g> findnext
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
386 bind . <Control-r> findprev
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
387 bind . <Control-equal> {incrfont 1}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
388 bind . <Control-KP_Add> {incrfont 1}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
389 bind . <Control-minus> {incrfont -1}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
390 bind . <Control-KP_Subtract> {incrfont -1}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
391 bind $cflist <<ListboxSelect>> listboxsel
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
392 bind . <Destroy> {savestuff %W}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
393 bind . <Button-1> "click %W"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
394 bind $fstring <Key-Return> dofind
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
395 bind $sha1entry <Key-Return> gotocommit
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
396 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
397
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
398 # when we make a key binding for the toplevel, make sure
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
399 # it doesn't get triggered when that key is pressed in the
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
400 # find string entry widget.
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
401 proc bindkey {ev script} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
402 global entries
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
403 bind . $ev $script
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
404 set escript [bind Entry $ev]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
405 if {$escript == {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
406 set escript [bind Entry <Key>]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
407 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
408 foreach e $entries {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
409 bind $e $ev "$escript; break"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
410 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
411 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
412
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
413 # set the focus back to the toplevel for any click outside
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
414 # the entry widgets
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
415 proc click {w} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
416 global entries
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
417 foreach e $entries {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
418 if {$w == $e} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
419 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
420 focus .
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
421 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
422
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
423 proc savestuff {w} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
424 global canv canv2 canv3 ctext cflist mainfont textfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
425 global stuffsaved
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
426 if {$stuffsaved} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
427 if {![winfo viewable .]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
428 catch {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
429 set f [open "~/.gitk-new" w]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
430 puts $f "set mainfont {$mainfont}"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
431 puts $f "set textfont {$textfont}"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
432 puts $f "set geometry(width) [winfo width .ctop]"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
433 puts $f "set geometry(height) [winfo height .ctop]"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
434 puts $f "set geometry(canv1) [expr [winfo width $canv]-2]"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
435 puts $f "set geometry(canv2) [expr [winfo width $canv2]-2]"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
436 puts $f "set geometry(canv3) [expr [winfo width $canv3]-2]"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
437 puts $f "set geometry(canvh) [expr [winfo height $canv]-2]"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
438 set wid [expr {([winfo width $ctext] - 8) \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
439 / [font measure $textfont "0"]}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
440 puts $f "set geometry(ctextw) $wid"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
441 set wid [expr {([winfo width $cflist] - 11) \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
442 / [font measure [$cflist cget -font] "0"]}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
443 puts $f "set geometry(cflistw) $wid"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
444 close $f
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
445 file rename -force "~/.gitk-new" "~/.gitk"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
446 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
447 set stuffsaved 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
448 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
449
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
450 proc resizeclistpanes {win w} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
451 global oldwidth
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
452 if [info exists oldwidth($win)] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
453 set s0 [$win sash coord 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
454 set s1 [$win sash coord 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
455 if {$w < 60} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
456 set sash0 [expr {int($w/2 - 2)}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
457 set sash1 [expr {int($w*5/6 - 2)}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
458 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
459 set factor [expr {1.0 * $w / $oldwidth($win)}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
460 set sash0 [expr {int($factor * [lindex $s0 0])}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
461 set sash1 [expr {int($factor * [lindex $s1 0])}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
462 if {$sash0 < 30} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
463 set sash0 30
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
464 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
465 if {$sash1 < $sash0 + 20} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
466 set sash1 [expr $sash0 + 20]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
467 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
468 if {$sash1 > $w - 10} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
469 set sash1 [expr $w - 10]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
470 if {$sash0 > $sash1 - 20} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
471 set sash0 [expr $sash1 - 20]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
472 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
473 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
474 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
475 $win sash place 0 $sash0 [lindex $s0 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
476 $win sash place 1 $sash1 [lindex $s1 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
477 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
478 set oldwidth($win) $w
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
479 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
480
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
481 proc resizecdetpanes {win w} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
482 global oldwidth
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
483 if [info exists oldwidth($win)] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
484 set s0 [$win sash coord 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
485 if {$w < 60} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
486 set sash0 [expr {int($w*3/4 - 2)}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
487 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
488 set factor [expr {1.0 * $w / $oldwidth($win)}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
489 set sash0 [expr {int($factor * [lindex $s0 0])}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
490 if {$sash0 < 45} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
491 set sash0 45
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
492 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
493 if {$sash0 > $w - 15} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
494 set sash0 [expr $w - 15]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
495 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
496 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
497 $win sash place 0 $sash0 [lindex $s0 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
498 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
499 set oldwidth($win) $w
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
500 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
501
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
502 proc allcanvs args {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
503 global canv canv2 canv3
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
504 eval $canv $args
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
505 eval $canv2 $args
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
506 eval $canv3 $args
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
507 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
508
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
509 proc bindall {event action} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
510 global canv canv2 canv3
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
511 bind $canv $event $action
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
512 bind $canv2 $event $action
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
513 bind $canv3 $event $action
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
514 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
515
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
516 proc about {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
517 set w .about
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
518 if {[winfo exists $w]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
519 raise $w
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
520 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
521 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
522 toplevel $w
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
523 wm title $w "About gitk"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
524 message $w.m -text {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
525 Gitk version 1.1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
526
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
527 Copyright © 2005 Paul Mackerras
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
528
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
529 Use and redistribute under the terms of the GNU General Public License
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
530
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
531 (CVS $Revision: 1.20 $)} \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
532 -justify center -aspect 400
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
533 pack $w.m -side top -fill x -padx 20 -pady 20
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
534 button $w.ok -text Close -command "destroy $w"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
535 pack $w.ok -side bottom
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
536 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
537
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
538 proc truncatetofit {str width font} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
539 if {[font measure $font $str] <= $width} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
540 return $str
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
541 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
542 set best 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
543 set bad [string length $str]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
544 set tmp $str
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
545 while {$best < $bad - 1} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
546 set try [expr {int(($best + $bad) / 2)}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
547 set tmp "[string range $str 0 [expr $try-1]]..."
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
548 if {[font measure $font $tmp] <= $width} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
549 set best $try
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
550 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
551 set bad $try
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
552 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
553 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
554 return $tmp
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
555 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
556
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
557 proc assigncolor {id} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
558 global commitinfo colormap commcolors colors nextcolor
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
559 global colorbycommitter
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
560 global parents nparents children nchildren
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
561 if [info exists colormap($id)] return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
562 set ncolors [llength $colors]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
563 if {$colorbycommitter} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
564 if {![info exists commitinfo($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
565 readcommit $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
566 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
567 set comm [lindex $commitinfo($id) 3]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
568 if {![info exists commcolors($comm)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
569 set commcolors($comm) [lindex $colors $nextcolor]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
570 if {[incr nextcolor] >= $ncolors} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
571 set nextcolor 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
572 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
573 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
574 set colormap($id) $commcolors($comm)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
575 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
576 if {$nparents($id) == 1 && $nchildren($id) == 1} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
577 set child [lindex $children($id) 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
578 if {[info exists colormap($child)]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
579 && $nparents($child) == 1} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
580 set colormap($id) $colormap($child)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
581 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
582 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
583 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
584 set badcolors {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
585 foreach child $children($id) {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
586 if {[info exists colormap($child)]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
587 && [lsearch -exact $badcolors $colormap($child)] < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
588 lappend badcolors $colormap($child)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
589 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
590 if {[info exists parents($child)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
591 foreach p $parents($child) {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
592 if {[info exists colormap($p)]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
593 && [lsearch -exact $badcolors $colormap($p)] < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
594 lappend badcolors $colormap($p)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
595 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
596 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
597 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
598 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
599 if {[llength $badcolors] >= $ncolors} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
600 set badcolors {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
601 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
602 for {set i 0} {$i <= $ncolors} {incr i} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
603 set c [lindex $colors $nextcolor]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
604 if {[incr nextcolor] >= $ncolors} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
605 set nextcolor 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
606 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
607 if {[lsearch -exact $badcolors $c]} break
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
608 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
609 set colormap($id) $c
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
610 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
611 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
612
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
613 proc drawgraph {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
614 global parents children nparents nchildren commits
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
615 global canv canv2 canv3 mainfont namefont canvx0 canvy0 canvy linespc
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
616 global datemode cdate
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
617 global lineid linehtag linentag linedtag commitinfo
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
618 global nextcolor colormap numcommits
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
619 global stopped phase redisplaying selectedline idtags idline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
620
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
621 allcanvs delete all
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
622 set start {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
623 foreach id [array names nchildren] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
624 if {$nchildren($id) == 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
625 lappend start $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
626 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
627 set ncleft($id) $nchildren($id)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
628 if {![info exists nparents($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
629 set nparents($id) 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
630 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
631 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
632 if {$start == {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
633 error_popup "Gitk: ERROR: No starting commits found"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
634 exit 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
635 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
636
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
637 set nextcolor 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
638 foreach id $start {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
639 assigncolor $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
640 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
641 set todo $start
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
642 set level [expr [llength $todo] - 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
643 set y2 $canvy0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
644 set nullentry -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
645 set lineno -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
646 set numcommits 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
647 set phase drawgraph
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
648 set lthickness [expr {($linespc / 9) + 1}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
649 while 1 {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
650 set canvy $y2
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
651 allcanvs conf -scrollregion \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
652 [list 0 0 0 [expr $canvy + 0.5 * $linespc + 2]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
653 update
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
654 if {$stopped} break
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
655 incr numcommits
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
656 incr lineno
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
657 set nlines [llength $todo]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
658 set id [lindex $todo $level]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
659 set lineid($lineno) $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
660 set idline($id) $lineno
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
661 set actualparents {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
662 set ofill white
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
663 if {[info exists parents($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
664 foreach p $parents($id) {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
665 if {[info exists ncleft($p)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
666 incr ncleft($p) -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
667 if {![info exists commitinfo($p)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
668 readcommit $p
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
669 if {![info exists commitinfo($p)]} continue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
670 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
671 lappend actualparents $p
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
672 set ofill blue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
673 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
674 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
675 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
676 if {![info exists commitinfo($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
677 readcommit $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
678 if {![info exists commitinfo($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
679 set commitinfo($id) {"No commit information available"}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
680 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
681 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
682 set x [expr $canvx0 + $level * $linespc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
683 set y2 [expr $canvy + $linespc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
684 if {[info exists linestarty($level)] && $linestarty($level) < $canvy} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
685 set t [$canv create line $x $linestarty($level) $x $canvy \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
686 -width $lthickness -fill $colormap($id)]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
687 $canv lower $t
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
688 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
689 set linestarty($level) $canvy
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
690 set orad [expr {$linespc / 3}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
691 set t [$canv create oval [expr $x - $orad] [expr $canvy - $orad] \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
692 [expr $x + $orad - 1] [expr $canvy + $orad - 1] \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
693 -fill $ofill -outline black -width 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
694 $canv raise $t
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
695 set xt [expr $canvx0 + $nlines * $linespc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
696 if {$nparents($id) > 2} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
697 set xt [expr {$xt + ($nparents($id) - 2) * $linespc}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
698 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
699 if {[info exists idtags($id)] && $idtags($id) != {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
700 set delta [expr {int(0.5 * ($linespc - $lthickness))}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
701 set yt [expr $canvy - 0.5 * $linespc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
702 set yb [expr $yt + $linespc - 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
703 set xvals {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
704 set wvals {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
705 foreach tag $idtags($id) {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
706 set wid [font measure $mainfont $tag]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
707 lappend xvals $xt
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
708 lappend wvals $wid
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
709 set xt [expr {$xt + $delta + $wid + $lthickness + $linespc}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
710 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
711 set t [$canv create line $x $canvy [lindex $xvals end] $canvy \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
712 -width $lthickness -fill black]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
713 $canv lower $t
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
714 foreach tag $idtags($id) x $xvals wid $wvals {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
715 set xl [expr $x + $delta]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
716 set xr [expr $x + $delta + $wid + $lthickness]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
717 $canv create polygon $x [expr $yt + $delta] $xl $yt\
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
718 $xr $yt $xr $yb $xl $yb $x [expr $yb - $delta] \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
719 -width 1 -outline black -fill yellow
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
720 $canv create text $xl $canvy -anchor w -text $tag \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
721 -font $mainfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
722 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
723 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
724 set headline [lindex $commitinfo($id) 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
725 set name [lindex $commitinfo($id) 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
726 set date [lindex $commitinfo($id) 2]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
727 set linehtag($lineno) [$canv create text $xt $canvy -anchor w \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
728 -text $headline -font $mainfont ]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
729 set linentag($lineno) [$canv2 create text 3 $canvy -anchor w \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
730 -text $name -font $namefont]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
731 set linedtag($lineno) [$canv3 create text 3 $canvy -anchor w \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
732 -text $date -font $mainfont]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
733 if {!$datemode && [llength $actualparents] == 1} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
734 set p [lindex $actualparents 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
735 if {$ncleft($p) == 0 && [lsearch -exact $todo $p] < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
736 assigncolor $p
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
737 set todo [lreplace $todo $level $level $p]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
738 continue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
739 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
740 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
741
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
742 set oldtodo $todo
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
743 set oldlevel $level
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
744 set lines {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
745 for {set i 0} {$i < $nlines} {incr i} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
746 if {[lindex $todo $i] == {}} continue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
747 if {[info exists linestarty($i)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
748 set oldstarty($i) $linestarty($i)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
749 unset linestarty($i)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
750 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
751 if {$i != $level} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
752 lappend lines [list $i [lindex $todo $i]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
753 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
754 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
755 if {$nullentry >= 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
756 set todo [lreplace $todo $nullentry $nullentry]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
757 if {$nullentry < $level} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
758 incr level -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
759 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
760 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
761
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
762 set todo [lreplace $todo $level $level]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
763 if {$nullentry > $level} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
764 incr nullentry -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
765 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
766 set i $level
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
767 foreach p $actualparents {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
768 set k [lsearch -exact $todo $p]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
769 if {$k < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
770 assigncolor $p
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
771 set todo [linsert $todo $i $p]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
772 if {$nullentry >= $i} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
773 incr nullentry
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
774 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
775 incr i
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
776 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
777 lappend lines [list $oldlevel $p]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
778 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
779
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
780 # choose which one to do next time around
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
781 set todol [llength $todo]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
782 set level -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
783 set latest {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
784 for {set k $todol} {[incr k -1] >= 0} {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
785 set p [lindex $todo $k]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
786 if {$p == {}} continue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
787 if {$ncleft($p) == 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
788 if {$datemode} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
789 if {$latest == {} || $cdate($p) > $latest} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
790 set level $k
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
791 set latest $cdate($p)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
792 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
793 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
794 set level $k
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
795 break
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
796 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
797 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
798 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
799 if {$level < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
800 if {$todo != {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
801 puts "ERROR: none of the pending commits can be done yet:"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
802 foreach p $todo {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
803 puts " $p"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
804 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
805 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
806 break
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
807 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
808
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
809 # If we are reducing, put in a null entry
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
810 if {$todol < $nlines} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
811 if {$nullentry >= 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
812 set i $nullentry
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
813 while {$i < $todol
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
814 && [lindex $oldtodo $i] == [lindex $todo $i]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
815 incr i
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
816 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
817 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
818 set i $oldlevel
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
819 if {$level >= $i} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
820 incr i
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
821 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
822 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
823 if {$i >= $todol} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
824 set nullentry -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
825 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
826 set nullentry $i
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
827 set todo [linsert $todo $nullentry {}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
828 if {$level >= $i} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
829 incr level
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
830 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
831 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
832 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
833 set nullentry -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
834 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
835
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
836 foreach l $lines {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
837 set i [lindex $l 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
838 set dst [lindex $l 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
839 set j [lsearch -exact $todo $dst]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
840 if {$i == $j} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
841 if {[info exists oldstarty($i)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
842 set linestarty($i) $oldstarty($i)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
843 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
844 continue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
845 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
846 set xi [expr {$canvx0 + $i * $linespc}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
847 set xj [expr {$canvx0 + $j * $linespc}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
848 set coords {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
849 if {[info exists oldstarty($i)] && $oldstarty($i) < $canvy} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
850 lappend coords $xi $oldstarty($i)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
851 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
852 lappend coords $xi $canvy
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
853 if {$j < $i - 1} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
854 lappend coords [expr $xj + $linespc] $canvy
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
855 } elseif {$j > $i + 1} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
856 lappend coords [expr $xj - $linespc] $canvy
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
857 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
858 lappend coords $xj $y2
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
859 set t [$canv create line $coords -width $lthickness \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
860 -fill $colormap($dst)]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
861 $canv lower $t
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
862 if {![info exists linestarty($j)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
863 set linestarty($j) $y2
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
864 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
865 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
866 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
867 set phase {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
868 if {$redisplaying} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
869 if {$stopped == 0 && [info exists selectedline]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
870 selectline $selectedline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
871 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
872 if {$stopped == 1} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
873 set stopped 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
874 after idle drawgraph
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
875 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
876 set redisplaying 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
877 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
878 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
879 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
880
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
881 proc findmatches {f} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
882 global findtype foundstring foundstrlen
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
883 if {$findtype == "Regexp"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
884 set matches [regexp -indices -all -inline $foundstring $f]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
885 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
886 if {$findtype == "IgnCase"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
887 set str [string tolower $f]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
888 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
889 set str $f
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
890 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
891 set matches {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
892 set i 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
893 while {[set j [string first $foundstring $str $i]] >= 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
894 lappend matches [list $j [expr $j+$foundstrlen-1]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
895 set i [expr $j + $foundstrlen]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
896 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
897 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
898 return $matches
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
899 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
900
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
901 proc dofind {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
902 global findtype findloc findstring markedmatches commitinfo
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
903 global numcommits lineid linehtag linentag linedtag
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
904 global mainfont namefont canv canv2 canv3 selectedline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
905 global matchinglines foundstring foundstrlen idtags
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
906 unmarkmatches
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
907 focus .
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
908 set matchinglines {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
909 set fldtypes {Headline Author Date Committer CDate Comment}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
910 if {$findtype == "IgnCase"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
911 set foundstring [string tolower $findstring]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
912 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
913 set foundstring $findstring
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
914 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
915 set foundstrlen [string length $findstring]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
916 if {$foundstrlen == 0} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
917 if {![info exists selectedline]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
918 set oldsel -1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
919 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
920 set oldsel $selectedline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
921 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
922 set didsel 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
923 for {set l 0} {$l < $numcommits} {incr l} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
924 set id $lineid($l)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
925 set info $commitinfo($id)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
926 set doesmatch 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
927 foreach f $info ty $fldtypes {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
928 if {$findloc != "All fields" && $findloc != $ty} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
929 continue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
930 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
931 set matches [findmatches $f]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
932 if {$matches == {}} continue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
933 set doesmatch 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
934 if {$ty == "Headline"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
935 markmatches $canv $l $f $linehtag($l) $matches $mainfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
936 } elseif {$ty == "Author"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
937 markmatches $canv2 $l $f $linentag($l) $matches $namefont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
938 } elseif {$ty == "Date"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
939 markmatches $canv3 $l $f $linedtag($l) $matches $mainfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
940 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
941 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
942 if {$doesmatch} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
943 lappend matchinglines $l
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
944 if {!$didsel && $l > $oldsel} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
945 findselectline $l
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
946 set didsel 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
947 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
948 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
949 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
950 if {$matchinglines == {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
951 bell
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
952 } elseif {!$didsel} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
953 findselectline [lindex $matchinglines 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
954 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
955 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
956
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
957 proc findselectline {l} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
958 global findloc commentend ctext
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
959 selectline $l
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
960 if {$findloc == "All fields" || $findloc == "Comments"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
961 # highlight the matches in the comments
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
962 set f [$ctext get 1.0 $commentend]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
963 set matches [findmatches $f]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
964 foreach match $matches {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
965 set start [lindex $match 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
966 set end [expr [lindex $match 1] + 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
967 $ctext tag add found "1.0 + $start c" "1.0 + $end c"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
968 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
969 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
970 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
971
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
972 proc findnext {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
973 global matchinglines selectedline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
974 if {![info exists matchinglines]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
975 dofind
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
976 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
977 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
978 if {![info exists selectedline]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
979 foreach l $matchinglines {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
980 if {$l > $selectedline} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
981 findselectline $l
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
982 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
983 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
984 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
985 bell
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
986 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
987
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
988 proc findprev {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
989 global matchinglines selectedline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
990 if {![info exists matchinglines]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
991 dofind
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
992 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
993 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
994 if {![info exists selectedline]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
995 set prev {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
996 foreach l $matchinglines {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
997 if {$l >= $selectedline} break
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
998 set prev $l
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
999 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1000 if {$prev != {}} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1001 findselectline $prev
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1002 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1003 bell
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1004 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1005 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1006
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1007 proc markmatches {canv l str tag matches font} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1008 set bbox [$canv bbox $tag]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1009 set x0 [lindex $bbox 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1010 set y0 [lindex $bbox 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1011 set y1 [lindex $bbox 3]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1012 foreach match $matches {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1013 set start [lindex $match 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1014 set end [lindex $match 1]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1015 if {$start > $end} continue
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1016 set xoff [font measure $font [string range $str 0 [expr $start-1]]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1017 set xlen [font measure $font [string range $str 0 [expr $end]]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1018 set t [$canv create rect [expr $x0+$xoff] $y0 [expr $x0+$xlen+2] $y1 \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1019 -outline {} -tags matches -fill yellow]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1020 $canv lower $t
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1021 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1022 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1023
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1024 proc unmarkmatches {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1025 global matchinglines
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1026 allcanvs delete matches
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1027 catch {unset matchinglines}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1028 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1029
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1030 proc selcanvline {x y} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1031 global canv canvy0 ctext linespc selectedline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1032 global lineid linehtag linentag linedtag
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1033 set ymax [lindex [$canv cget -scrollregion] 3]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1034 if {$ymax == {}} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1035 set yfrac [lindex [$canv yview] 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1036 set y [expr {$y + $yfrac * $ymax}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1037 set l [expr {int(($y - $canvy0) / $linespc + 0.5)}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1038 if {$l < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1039 set l 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1040 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1041 if {[info exists selectedline] && $selectedline == $l} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1042 unmarkmatches
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1043 selectline $l
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1044 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1045
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1046 proc selectline {l} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1047 global canv canv2 canv3 ctext commitinfo selectedline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1048 global lineid linehtag linentag linedtag
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1049 global canvy0 linespc nparents treepending
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1050 global cflist treediffs currentid sha1entry
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1051 global commentend seenfile numcommits idtags
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1052 if {![info exists lineid($l)] || ![info exists linehtag($l)]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1053 $canv delete secsel
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1054 set t [eval $canv create rect [$canv bbox $linehtag($l)] -outline {{}} \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1055 -tags secsel -fill [$canv cget -selectbackground]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1056 $canv lower $t
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1057 $canv2 delete secsel
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1058 set t [eval $canv2 create rect [$canv2 bbox $linentag($l)] -outline {{}} \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1059 -tags secsel -fill [$canv2 cget -selectbackground]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1060 $canv2 lower $t
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1061 $canv3 delete secsel
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1062 set t [eval $canv3 create rect [$canv3 bbox $linedtag($l)] -outline {{}} \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1063 -tags secsel -fill [$canv3 cget -selectbackground]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1064 $canv3 lower $t
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1065 set y [expr {$canvy0 + $l * $linespc}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1066 set ymax [lindex [$canv cget -scrollregion] 3]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1067 set ytop [expr {$y - $linespc - 1}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1068 set ybot [expr {$y + $linespc + 1}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1069 set wnow [$canv yview]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1070 set wtop [expr [lindex $wnow 0] * $ymax]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1071 set wbot [expr [lindex $wnow 1] * $ymax]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1072 set wh [expr {$wbot - $wtop}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1073 set newtop $wtop
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1074 if {$ytop < $wtop} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1075 if {$ybot < $wtop} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1076 set newtop [expr {$y - $wh / 2.0}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1077 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1078 set newtop $ytop
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1079 if {$newtop > $wtop - $linespc} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1080 set newtop [expr {$wtop - $linespc}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1081 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1082 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1083 } elseif {$ybot > $wbot} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1084 if {$ytop > $wbot} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1085 set newtop [expr {$y - $wh / 2.0}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1086 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1087 set newtop [expr {$ybot - $wh}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1088 if {$newtop < $wtop + $linespc} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1089 set newtop [expr {$wtop + $linespc}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1090 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1091 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1092 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1093 if {$newtop != $wtop} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1094 if {$newtop < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1095 set newtop 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1096 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1097 allcanvs yview moveto [expr $newtop * 1.0 / $ymax]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1098 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1099 set selectedline $l
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1100
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1101 set id $lineid($l)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1102 set currentid $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1103 $sha1entry delete 0 end
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1104 $sha1entry insert 0 $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1105 $sha1entry selection from 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1106 $sha1entry selection to end
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1107
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1108 $ctext conf -state normal
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1109 $ctext delete 0.0 end
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1110 set info $commitinfo($id)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1111 $ctext insert end "Author: [lindex $info 1] [lindex $info 2]\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1112 $ctext insert end "Committer: [lindex $info 3] [lindex $info 4]\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1113 if {[info exists idtags($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1114 $ctext insert end "Tags:"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1115 foreach tag $idtags($id) {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1116 $ctext insert end " $tag"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1117 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1118 $ctext insert end "\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1119 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1120 $ctext insert end "\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1121 $ctext insert end [lindex $info 5]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1122 $ctext insert end "\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1123 $ctext tag delete Comments
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1124 $ctext tag remove found 1.0 end
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1125 $ctext conf -state disabled
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1126 set commentend [$ctext index "end - 1c"]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1127
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1128 $cflist delete 0 end
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1129 if {$nparents($id) == 1} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1130 if {![info exists treediffs($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1131 if {![info exists treepending]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1132 gettreediffs $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1133 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1134 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1135 addtocflist $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1136 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1137 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1138 catch {unset seenfile}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1139 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1140
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1141 proc selnextline {dir} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1142 global selectedline
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1143 if {![info exists selectedline]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1144 set l [expr $selectedline + $dir]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1145 unmarkmatches
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1146 selectline $l
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1147 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1148
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1149 proc addtocflist {id} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1150 global currentid treediffs cflist treepending
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1151 if {$id != $currentid} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1152 gettreediffs $currentid
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1153 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1154 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1155 $cflist insert end "All files"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1156 foreach f $treediffs($currentid) {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1157 $cflist insert end $f
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1158 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1159 getblobdiffs $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1160 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1161
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1162 proc gettreediffs {id} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1163 global treediffs parents treepending
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1164 set treepending $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1165 set treediffs($id) {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1166 set p [lindex $parents($id) 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1167 puts stderr "hgit diff-tree -r $p $id"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1168 if [catch {set gdtf [open "|hgit diff-tree -r $p $id" r]}] return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1169 fconfigure $gdtf -blocking 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1170 fileevent $gdtf readable "gettreediffline $gdtf $id"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1171 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1172
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1173 proc gettreediffline {gdtf id} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1174 global treediffs treepending
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1175 set n [gets $gdtf line]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1176 if {$n < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1177 if {![eof $gdtf]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1178 close $gdtf
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1179 unset treepending
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1180 addtocflist $id
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1181 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1182 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1183 set file [lindex $line 5]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1184 lappend treediffs($id) $file
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1185 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1186
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1187 proc getblobdiffs {id} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1188 global parents diffopts blobdifffd env curdifftag curtagstart
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1189 global diffindex difffilestart
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1190 set p [lindex $parents($id) 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1191 set env(GIT_DIFF_OPTS) $diffopts
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1192 if [catch {set bdf [open "|hgit diff-tree -r -p $p $id" r]} err] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1193 puts "error getting diffs: $err"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1194 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1195 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1196 fconfigure $bdf -blocking 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1197 set blobdifffd($id) $bdf
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1198 set curdifftag Comments
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1199 set curtagstart 0.0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1200 set diffindex 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1201 catch {unset difffilestart}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1202 fileevent $bdf readable "getblobdiffline $bdf $id"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1203 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1204
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1205 proc getblobdiffline {bdf id} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1206 global currentid blobdifffd ctext curdifftag curtagstart seenfile
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1207 global diffnexthead diffnextnote diffindex difffilestart
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1208 set n [gets $bdf line]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1209 if {$n < 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1210 if {[eof $bdf]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1211 close $bdf
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1212 if {$id == $currentid && $bdf == $blobdifffd($id)} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1213 $ctext tag add $curdifftag $curtagstart end
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1214 set seenfile($curdifftag) 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1215 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1216 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1217 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1218 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1219 if {$id != $currentid || $bdf != $blobdifffd($id)} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1220 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1221 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1222 $ctext conf -state normal
274
5da941efbb52 [PATCH] hgk should parse dates in the diff output
mpm@selenic.com
parents: 267
diff changeset
1223 if {[regexp {^---[ \t]+([^/])*/([^\t]*)} $line match s0 fname]} {
267
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1224 # start of a new file
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1225 $ctext insert end "\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1226 $ctext tag add $curdifftag $curtagstart end
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1227 set seenfile($curdifftag) 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1228 set curtagstart [$ctext index "end - 1c"]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1229 set header $fname
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1230 if {[info exists diffnexthead]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1231 set fname $diffnexthead
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1232 set header "$diffnexthead ($diffnextnote)"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1233 unset diffnexthead
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1234 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1235 set difffilestart($diffindex) [$ctext index "end - 1c"]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1236 incr diffindex
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1237 set curdifftag "f:$fname"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1238 $ctext tag delete $curdifftag
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1239 set l [expr {(78 - [string length $header]) / 2}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1240 set pad [string range "----------------------------------------" 1 $l]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1241 $ctext insert end "$pad $header $pad\n" filesep
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1242 } elseif {[string range $line 0 2] == "+++"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1243 # no need to do anything with this
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1244 } elseif {[regexp {^Created: (.*) \((mode: *[0-7]*)\)} $line match fn m]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1245 set diffnexthead $fn
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1246 set diffnextnote "created, mode $m"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1247 } elseif {[string range $line 0 8] == "Deleted: "} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1248 set diffnexthead [string range $line 9 end]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1249 set diffnextnote "deleted"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1250 } elseif {[regexp {^diff --git a/(.*) b/} $line match fn]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1251 # save the filename in case the next thing is "new file mode ..."
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1252 set diffnexthead $fn
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1253 set diffnextnote "modified"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1254 } elseif {[regexp {^new file mode ([0-7]+)} $line match m]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1255 set diffnextnote "new file, mode $m"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1256 } elseif {[string range $line 0 11] == "deleted file"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1257 set diffnextnote "deleted"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1258 } elseif {[regexp {^@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@(.*)} \
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1259 $line match f1l f1c f2l f2c rest]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1260 $ctext insert end "\t" hunksep
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1261 $ctext insert end " $f1l " d0 " $f2l " d1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1262 $ctext insert end " $rest \n" hunksep
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1263 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1264 set x [string range $line 0 0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1265 if {$x == "-" || $x == "+"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1266 set tag [expr {$x == "+"}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1267 set line [string range $line 1 end]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1268 $ctext insert end "$line\n" d$tag
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1269 } elseif {$x == " "} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1270 set line [string range $line 1 end]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1271 $ctext insert end "$line\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1272 } elseif {$x == "\\"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1273 # e.g. "\ No newline at end of file"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1274 $ctext insert end "$line\n" filesep
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1275 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1276 # Something else we don't recognize
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1277 if {$curdifftag != "Comments"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1278 $ctext insert end "\n"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1279 $ctext tag add $curdifftag $curtagstart end
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1280 set seenfile($curdifftag) 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1281 set curtagstart [$ctext index "end - 1c"]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1282 set curdifftag Comments
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1283 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1284 $ctext insert end "$line\n" filesep
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1285 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1286 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1287 $ctext conf -state disabled
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1288 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1289
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1290 proc nextfile {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1291 global difffilestart ctext
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1292 set here [$ctext index @0,0]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1293 for {set i 0} {[info exists difffilestart($i)]} {incr i} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1294 if {[$ctext compare $difffilestart($i) > $here]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1295 $ctext yview $difffilestart($i)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1296 break
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1297 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1298 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1299 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1300
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1301 proc listboxsel {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1302 global ctext cflist currentid treediffs seenfile
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1303 if {![info exists currentid]} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1304 set sel [$cflist curselection]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1305 if {$sel == {} || [lsearch -exact $sel 0] >= 0} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1306 # show everything
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1307 $ctext tag conf Comments -elide 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1308 foreach f $treediffs($currentid) {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1309 if [info exists seenfile(f:$f)] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1310 $ctext tag conf "f:$f" -elide 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1311 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1312 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1313 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1314 # just show selected files
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1315 $ctext tag conf Comments -elide 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1316 set i 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1317 foreach f $treediffs($currentid) {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1318 set elide [expr {[lsearch -exact $sel $i] < 0}]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1319 if [info exists seenfile(f:$f)] {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1320 $ctext tag conf "f:$f" -elide $elide
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1321 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1322 incr i
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1323 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1324 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1325 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1326
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1327 proc setcoords {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1328 global linespc charspc canvx0 canvy0 mainfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1329 set linespc [font metrics $mainfont -linespace]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1330 set charspc [font measure $mainfont "m"]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1331 set canvy0 [expr 3 + 0.5 * $linespc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1332 set canvx0 [expr 3 + 0.5 * $linespc]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1333 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1334
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1335 proc redisplay {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1336 global selectedline stopped redisplaying phase
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1337 if {$stopped > 1} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1338 if {$phase == "getcommits"} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1339 set redisplaying 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1340 if {$phase == "drawgraph"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1341 set stopped 1
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1342 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1343 drawgraph
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1344 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1345 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1346
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1347 proc incrfont {inc} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1348 global mainfont namefont textfont selectedline ctext canv phase
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1349 global stopped entries
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1350 unmarkmatches
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1351 set mainfont [lreplace $mainfont 1 1 [expr {[lindex $mainfont 1] + $inc}]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1352 set namefont [lreplace $namefont 1 1 [expr {[lindex $namefont 1] + $inc}]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1353 set textfont [lreplace $textfont 1 1 [expr {[lindex $textfont 1] + $inc}]]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1354 setcoords
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1355 $ctext conf -font $textfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1356 $ctext tag conf filesep -font [concat $textfont bold]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1357 foreach e $entries {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1358 $e conf -font $mainfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1359 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1360 if {$phase == "getcommits"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1361 $canv itemconf textitems -font $mainfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1362 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1363 redisplay
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1364 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1365
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1366 proc sha1change {n1 n2 op} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1367 global sha1string currentid sha1but
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1368 if {$sha1string == {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1369 || ([info exists currentid] && $sha1string == $currentid)} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1370 set state disabled
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1371 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1372 set state normal
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1373 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1374 if {[$sha1but cget -state] == $state} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1375 if {$state == "normal"} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1376 $sha1but conf -state normal -relief raised -text "Goto: "
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1377 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1378 $sha1but conf -state disabled -relief flat -text "SHA1 ID: "
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1379 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1380 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1381
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1382 proc gotocommit {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1383 global sha1string currentid idline tagids
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1384 if {$sha1string == {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1385 || ([info exists currentid] && $sha1string == $currentid)} return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1386 if {[info exists tagids($sha1string)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1387 set id $tagids($sha1string)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1388 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1389 set id [string tolower $sha1string]
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1390 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1391 if {[info exists idline($id)]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1392 selectline $idline($id)
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1393 return
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1394 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1395 if {[regexp {^[0-9a-fA-F]{40}$} $sha1string]} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1396 set type "SHA1 id"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1397 } else {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1398 set type "Tag"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1399 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1400 error_popup "$type $sha1string is not known"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1401 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1402
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1403 proc doquit {} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1404 global stopped
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1405 set stopped 100
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1406 destroy .
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1407 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1408
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1409 # defaults...
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1410 set datemode 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1411 set boldnames 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1412 set diffopts "-U 5 -p"
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1413
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1414 set mainfont {Helvetica 9}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1415 set textfont {Courier 9}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1416
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1417 set colors {green red blue magenta darkgrey brown orange}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1418 set colorbycommitter false
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1419
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1420 catch {source ~/.gitk}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1421
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1422 set namefont $mainfont
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1423 if {$boldnames} {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1424 lappend namefont bold
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1425 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1426
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1427 set revtreeargs {}
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1428 foreach arg $argv {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1429 switch -regexp -- $arg {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1430 "^$" { }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1431 "^-b" { set boldnames 1 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1432 "^-c" { set colorbycommitter 1 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1433 "^-d" { set datemode 1 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1434 default {
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1435 lappend revtreeargs $arg
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1436 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1437 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1438 }
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1439
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1440 set stopped 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1441 set redisplaying 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1442 set stuffsaved 0
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1443 setcoords
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1444 makewindow
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1445 readrefs
497aa6d276d2 Initial import of hgit and hgk
mpm@selenic.com
parents:
diff changeset
1446 readfullcommits $revtreeargs