Mercurial > hg-stable
annotate contrib/hgk @ 5244:79279b5583c6
cgi: sys.path.insert should be before importing mercurial
thanks to R. Burke
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 25 Aug 2007 16:31:37 +0200 |
parents | d4fa6bafc43a |
children | f8c36b215281 |
rev | line source |
---|---|
1361
f6d73b26dbdb
contrib/hgk: remove hardcoded path to Wish
TK Soh <teekaysoh@yahoo.com>
parents:
1340
diff
changeset
|
1 #!/usr/bin/env wish |
267 | 2 |
3 # Copyright (C) 2005 Paul Mackerras. All rights reserved. | |
4 # This program is free software; it may be used, copied, modified | |
5 # and distributed under the terms of the GNU General Public Licence, | |
6 # either version 2, or (at your option) any later version. | |
7 | |
4969
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
8 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
9 # Modified version of Tip 171: |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
10 # http://www.tcl.tk/cgi-bin/tct/tip/171.html |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
11 # |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
12 # The in_mousewheel global was added to fix strange reentrancy issues. |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
13 # The whole snipped is activated only under windows, mouse wheel |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
14 # bindings working already under MacOSX and Linux. |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
15 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
16 if {[tk windowingsystem] eq "win32"} { |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
17 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
18 set mw_classes [list Text Listbox Table TreeCtrl] |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
19 foreach class $mw_classes { bind $class <MouseWheel> {} } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
20 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
21 set in_mousewheel 0 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
22 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
23 proc ::tk::MouseWheel {wFired X Y D {shifted 0}} { |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
24 global in_mousewheel |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
25 if { $in_mousewheel != 0 } { return } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
26 # Set event to check based on call |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
27 set evt "<[expr {$shifted?{Shift-}:{}}]MouseWheel>" |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
28 # do not double-fire in case the class already has a binding |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
29 if {[bind [winfo class $wFired] $evt] ne ""} { return } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
30 # obtain the window the mouse is over |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
31 set w [winfo containing $X $Y] |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
32 # if we are outside the app, try and scroll the focus widget |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
33 if {![winfo exists $w]} { catch {set w [focus]} } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
34 if {[winfo exists $w]} { |
5143
d4fa6bafc43a
Remove trailing spaces, fix indentation
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4969
diff
changeset
|
35 |
4969
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
36 if {[bind $w $evt] ne ""} { |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
37 # Awkward ... this widget has a MouseWheel binding, but to |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
38 # trigger successfully in it, we must give it focus. |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
39 catch {focus} old |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
40 if {$w ne $old} { focus $w } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
41 set in_mousewheel 1 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
42 event generate $w $evt -rootx $X -rooty $Y -delta $D |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
43 set in_mousewheel 0 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
44 if {$w ne $old} { focus $old } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
45 return |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
46 } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
47 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
48 # aqua and x11/win32 have different delta handling |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
49 if {[tk windowingsystem] ne "aqua"} { |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
50 set delta [expr {- ($D / 30)}] |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
51 } else { |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
52 set delta [expr {- ($D)}] |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
53 } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
54 # scrollbars have different call conventions |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
55 if {[string match "*Scrollbar" [winfo class $w]]} { |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
56 catch {tk::ScrollByUnits $w \ |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
57 [string index [$w cget -orient] 0] $delta} |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
58 } else { |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
59 set cmd [list $w [expr {$shifted ? "xview" : "yview"}] \ |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
60 scroll $delta units] |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
61 # Walking up to find the proper widget (handles cases like |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
62 # embedded widgets in a canvas) |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
63 while {[catch $cmd] && [winfo toplevel $w] ne $w} { |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
64 set w [winfo parent $w] |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
65 } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
66 } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
67 } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
68 } |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
69 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
70 bind all <MouseWheel> [list ::tk::MouseWheel %W %X %Y %D 0] |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
71 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
72 # end of win32 section |
5143
d4fa6bafc43a
Remove trailing spaces, fix indentation
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4969
diff
changeset
|
73 } |
4969
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
74 |
b43db44cd047
hgk: enable mouse wheel under Windows.
Patrick Mezard <pmezard@gmail.com>
parents:
4968
diff
changeset
|
75 |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
76 proc gitdir {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
77 global env |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
78 if {[info exists env(GIT_DIR)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
79 return $env(GIT_DIR) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
80 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
81 return ".hg" |
267 | 82 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
83 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
84 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
85 proc getcommits {rargs} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
86 global commits commfd phase canv mainfont env |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
87 global startmsecs nextupdate ncmupdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
88 global ctext maincursor textcursor leftover |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
89 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
90 # check that we can find a .git directory somewhere... |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
91 set gitdir [gitdir] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
92 if {![file isdirectory $gitdir]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
93 error_popup "Cannot find the git directory \"$gitdir\"." |
267 | 94 exit 1 |
95 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
96 set commits {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
97 set phase getcommits |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
98 set startmsecs [clock clicks -milliseconds] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
99 set nextupdate [expr $startmsecs + 100] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
100 set ncmupdate 1 |
3093
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
101 set limit 0 |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
102 set revargs {} |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
103 for {set i 0} {$i < [llength $rargs]} {incr i} { |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
104 set opt [lindex $rargs $i] |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
105 if {$opt == "--limit"} { |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
106 incr i |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
107 set limit [lindex $rargs $i] |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
108 } else { |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
109 lappend revargs $opt |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
110 } |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
111 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
112 if [catch { |
3093
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
113 set parse_args [concat --default HEAD $revargs] |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
114 set parse_temp [eval exec {$env(HG)} --config ui.report_untrusted=false debug-rev-parse $parse_args] |
3940
a33ddd20105c
hgk - fix CR issues on windows
"Andrei Vermel <avermel@mail.ru>"
parents:
3093
diff
changeset
|
115 regsub -all "\r\n" $parse_temp "\n" parse_temp |
a33ddd20105c
hgk - fix CR issues on windows
"Andrei Vermel <avermel@mail.ru>"
parents:
3093
diff
changeset
|
116 set parsed_args [split $parse_temp "\n"] |
3093
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
117 } err] { |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
118 # if git-rev-parse failed for some reason... |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
119 if {$rargs == {}} { |
3093
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
120 set revargs HEAD |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
121 } |
3093
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
122 set parsed_args $revargs |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
123 } |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
124 if {$limit > 0} { |
edefbb3a3b08
hgk: add --limit, and revranges
Brendan Cully <brendan@kublai.com>
parents:
3092
diff
changeset
|
125 set parsed_args [concat -n $limit $parsed_args] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
126 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
127 if [catch { |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
128 set commfd [open "|{$env(HG)} --config ui.report_untrusted=false debug-rev-list --header --topo-order --parents $parsed_args" r] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
129 } err] { |
1278 | 130 puts stderr "Error executing hg debug-rev-list: $err" |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
131 exit 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
132 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
133 set leftover {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
134 fconfigure $commfd -blocking 0 -translation lf |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
135 fileevent $commfd readable [list getcommitlines $commfd] |
267 | 136 $canv delete all |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
137 $canv create text 3 3 -anchor nw -text "Reading commits..." \ |
267 | 138 -font $mainfont -tags textitems |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
139 . config -cursor watch |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
140 settextcursor watch |
267 | 141 } |
142 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
143 proc getcommitlines {commfd} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
144 global commits parents cdate children |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
145 global commitlisted phase commitinfo nextupdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
146 global stopped redisplaying leftover |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
147 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
148 set stuff [read $commfd] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
149 if {$stuff == {}} { |
267 | 150 if {![eof $commfd]} return |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
151 # set it blocking so we wait for the process to terminate |
267 | 152 fconfigure $commfd -blocking 1 |
153 if {![catch {close $commfd} err]} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
154 after idle finishcommits |
267 | 155 return |
156 } | |
157 if {[string range $err 0 4] == "usage"} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
158 set err \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
159 {Gitk: error reading commits: bad arguments to git-rev-list. |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
160 (Note: arguments to gitk are passed to git-rev-list |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
161 to allow selection of commits to be displayed.)} |
267 | 162 } else { |
163 set err "Error reading commits: $err" | |
164 } | |
165 error_popup $err | |
166 exit 1 | |
167 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
168 set start 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
169 while 1 { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
170 set i [string first "\0" $stuff $start] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
171 if {$i < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
172 append leftover [string range $stuff $start end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
173 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
174 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
175 set cmit [string range $stuff $start [expr {$i - 1}]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
176 if {$start == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
177 set cmit "$leftover$cmit" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
178 set leftover {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
179 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
180 set start [expr {$i + 1}] |
3940
a33ddd20105c
hgk - fix CR issues on windows
"Andrei Vermel <avermel@mail.ru>"
parents:
3093
diff
changeset
|
181 regsub -all "\r\n" $cmit "\n" cmit |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
182 set j [string first "\n" $cmit] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
183 set ok 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
184 if {$j >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
185 set ids [string range $cmit 0 [expr {$j - 1}]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
186 set ok 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
187 foreach id $ids { |
3059
3dab573a4330
hgk: use short changeset hashes
TK Soh <teekaysoh@yahoo.com>
parents:
2297
diff
changeset
|
188 if {![regexp {^[0-9a-f]{12}$} $id]} { |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
189 set ok 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
190 break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
191 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
192 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
193 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
194 if {!$ok} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
195 set shortcmit $cmit |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
196 if {[string length $shortcmit] > 80} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
197 set shortcmit "[string range $shortcmit 0 80]..." |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
198 } |
1278 | 199 error_popup "Can't parse hg debug-rev-list output: {$shortcmit}" |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
200 exit 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
201 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
202 set id [lindex $ids 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
203 set olds [lrange $ids 1 end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
204 set cmit [string range $cmit [expr {$j + 1}] end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
205 lappend commits $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
206 set commitlisted($id) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
207 parsecommit $id $cmit 1 [lrange $ids 1 end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
208 drawcommit $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
209 if {[clock clicks -milliseconds] >= $nextupdate} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
210 doupdate 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
211 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
212 while {$redisplaying} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
213 set redisplaying 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
214 if {$stopped == 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
215 set stopped 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
216 set phase "getcommits" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
217 foreach id $commits { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
218 drawcommit $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
219 if {$stopped} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
220 if {[clock clicks -milliseconds] >= $nextupdate} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
221 doupdate 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
222 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
223 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
224 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
225 } |
267 | 226 } |
227 } | |
228 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
229 proc doupdate {reading} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
230 global commfd nextupdate numcommits ncmupdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
231 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
232 if {$reading} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
233 fileevent $commfd readable {} |
267 | 234 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
235 update |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
236 set nextupdate [expr {[clock clicks -milliseconds] + 100}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
237 if {$numcommits < 100} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
238 set ncmupdate [expr {$numcommits + 1}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
239 } elseif {$numcommits < 10000} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
240 set ncmupdate [expr {$numcommits + 10}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
241 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
242 set ncmupdate [expr {$numcommits + 100}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
243 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
244 if {$reading} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
245 fileevent $commfd readable [list getcommitlines $commfd] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
246 } |
267 | 247 } |
248 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
249 proc readcommit {id} { |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
250 global env |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
251 if [catch {set contents [exec $env(HG) --config ui.report_untrusted=false debug-cat-file commit $id]}] return |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
252 parsecommit $id $contents 0 {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
253 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
254 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
255 proc parsecommit {id contents listed olds} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
256 global commitinfo children nchildren parents nparents cdate ncleft |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
257 |
267 | 258 set inhdr 1 |
259 set comment {} | |
260 set headline {} | |
261 set auname {} | |
262 set audate {} | |
263 set comname {} | |
264 set comdate {} | |
3092
d0fcce3728d1
hgk: add revision numbers
Brendan Cully <brendan@kublai.com>
parents:
3059
diff
changeset
|
265 set rev {} |
267 | 266 if {![info exists nchildren($id)]} { |
267 set children($id) {} | |
268 set nchildren($id) 0 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
269 set ncleft($id) 0 |
267 | 270 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
271 set parents($id) $olds |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
272 set nparents($id) [llength $olds] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
273 foreach p $olds { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
274 if {![info exists nchildren($p)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
275 set children($p) [list $id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
276 set nchildren($p) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
277 set ncleft($p) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
278 } elseif {[lsearch -exact $children($p) $id] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
279 lappend children($p) $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
280 incr nchildren($p) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
281 incr ncleft($p) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
282 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
283 } |
3940
a33ddd20105c
hgk - fix CR issues on windows
"Andrei Vermel <avermel@mail.ru>"
parents:
3093
diff
changeset
|
284 regsub -all "\r\n" $contents "\n" contents |
267 | 285 foreach line [split $contents "\n"] { |
286 if {$inhdr} { | |
2297
936b615eb44e
Fix hg view if author's name contains unmatched quotes. (issue248)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2058
diff
changeset
|
287 set line [split $line] |
267 | 288 if {$line == {}} { |
289 set inhdr 0 | |
290 } else { | |
291 set tag [lindex $line 0] | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
292 if {$tag == "author"} { |
267 | 293 set x [expr {[llength $line] - 2}] |
294 set audate [lindex $line $x] | |
2297
936b615eb44e
Fix hg view if author's name contains unmatched quotes. (issue248)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2058
diff
changeset
|
295 set auname [join [lrange $line 1 [expr {$x - 1}]]] |
267 | 296 } elseif {$tag == "committer"} { |
297 set x [expr {[llength $line] - 2}] | |
298 set comdate [lindex $line $x] | |
2297
936b615eb44e
Fix hg view if author's name contains unmatched quotes. (issue248)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2058
diff
changeset
|
299 set comname [join [lrange $line 1 [expr {$x - 1}]]] |
3092
d0fcce3728d1
hgk: add revision numbers
Brendan Cully <brendan@kublai.com>
parents:
3059
diff
changeset
|
300 } elseif {$tag == "revision"} { |
d0fcce3728d1
hgk: add revision numbers
Brendan Cully <brendan@kublai.com>
parents:
3059
diff
changeset
|
301 set rev [lindex $line 1] |
267 | 302 } |
303 } | |
304 } else { | |
305 if {$comment == {}} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
306 set headline [string trim $line] |
267 | 307 } else { |
308 append comment "\n" | |
309 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
310 if {!$listed} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
311 # git-rev-list indents the comment by 4 spaces; |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
312 # if we got this via git-cat-file, add the indentation |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
313 append comment " " |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
314 } |
267 | 315 append comment $line |
316 } | |
317 } | |
318 if {$audate != {}} { | |
319 set audate [clock format $audate -format "%Y-%m-%d %H:%M:%S"] | |
320 } | |
321 if {$comdate != {}} { | |
322 set cdate($id) $comdate | |
323 set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"] | |
324 } | |
325 set commitinfo($id) [list $headline $auname $audate \ | |
3092
d0fcce3728d1
hgk: add revision numbers
Brendan Cully <brendan@kublai.com>
parents:
3059
diff
changeset
|
326 $comname $comdate $comment $rev] |
267 | 327 } |
328 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
329 proc readrefs {} { |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
330 global tagids idtags headids idheads tagcontents env |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
331 |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
332 set tags [exec $env(HG) --config ui.report_untrusted=false tags] |
3940
a33ddd20105c
hgk - fix CR issues on windows
"Andrei Vermel <avermel@mail.ru>"
parents:
3093
diff
changeset
|
333 regsub -all "\r\n" $tags "\n" tags |
a33ddd20105c
hgk - fix CR issues on windows
"Andrei Vermel <avermel@mail.ru>"
parents:
3093
diff
changeset
|
334 set lines [split $tags "\n"] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
335 foreach f $lines { |
4502
1774c037fbd2
hgk: display tags that contain spaces
TK Soh <teekaysoh@yahoo.com>
parents:
4501
diff
changeset
|
336 regexp {(\S+)$} $f full |
1774c037fbd2
hgk: display tags that contain spaces
TK Soh <teekaysoh@yahoo.com>
parents:
4501
diff
changeset
|
337 regsub {\s+(\S+)$} $f "" direct |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
338 set sha [split $full ':'] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
339 set tag [lindex $sha 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
340 lappend tagids($direct) $tag |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
341 lappend idtags($tag) $direct |
267 | 342 } |
343 } | |
344 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
345 proc readotherrefs {base dname excl} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
346 global otherrefids idotherrefs |
267 | 347 |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
348 set git [gitdir] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
349 set files [glob -nocomplain -types f [file join $git $base *]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
350 foreach f $files { |
267 | 351 catch { |
352 set fd [open $f r] | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
353 set line [read $fd 40] |
3059
3dab573a4330
hgk: use short changeset hashes
TK Soh <teekaysoh@yahoo.com>
parents:
2297
diff
changeset
|
354 if {[regexp {^[0-9a-f]{12}} $line id]} { |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
355 set name "$dname[file tail $f]" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
356 set otherrefids($name) $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
357 lappend idotherrefs($id) $name |
267 | 358 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
359 close $fd |
267 | 360 } |
361 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
362 set dirs [glob -nocomplain -types d [file join $git $base *]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
363 foreach d $dirs { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
364 set dir [file tail $d] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
365 if {[lsearch -exact $excl $dir] >= 0} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
366 readotherrefs [file join $base $dir] "$dname$dir/" {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
367 } |
267 | 368 } |
369 | |
4968
713426631adf
hgk: enable mouse wheel on MouseWheel events.
Patrick Mezard <pmezard@gmail.com>
parents:
4741
diff
changeset
|
370 proc allcansmousewheel {delta} { |
713426631adf
hgk: enable mouse wheel on MouseWheel events.
Patrick Mezard <pmezard@gmail.com>
parents:
4741
diff
changeset
|
371 set delta [expr -5*(int($delta)/abs($delta))] |
713426631adf
hgk: enable mouse wheel on MouseWheel events.
Patrick Mezard <pmezard@gmail.com>
parents:
4741
diff
changeset
|
372 allcanvs yview scroll $delta units |
713426631adf
hgk: enable mouse wheel on MouseWheel events.
Patrick Mezard <pmezard@gmail.com>
parents:
4741
diff
changeset
|
373 } |
713426631adf
hgk: enable mouse wheel on MouseWheel events.
Patrick Mezard <pmezard@gmail.com>
parents:
4741
diff
changeset
|
374 |
267 | 375 proc error_popup msg { |
376 set w .error | |
377 toplevel $w | |
378 wm transient $w . | |
379 message $w.m -text $msg -justify center -aspect 400 | |
380 pack $w.m -side top -fill x -padx 20 -pady 20 | |
381 button $w.ok -text OK -command "destroy $w" | |
382 pack $w.ok -side bottom -fill x | |
383 bind $w <Visibility> "grab $w; focus $w" | |
384 tkwait window $w | |
385 } | |
386 | |
387 proc makewindow {} { | |
388 global canv canv2 canv3 linespc charspc ctext cflist textfont | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
389 global findtype findtypemenu findloc findstring fstring geometry |
267 | 390 global entries sha1entry sha1string sha1but |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
391 global maincursor textcursor curtextcursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
392 global rowctxmenu gaudydiff mergemax |
267 | 393 |
394 menu .bar | |
395 .bar add cascade -label "File" -menu .bar.file | |
396 menu .bar.file | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
397 .bar.file add command -label "Reread references" -command rereadrefs |
267 | 398 .bar.file add command -label "Quit" -command doquit |
399 menu .bar.help | |
400 .bar add cascade -label "Help" -menu .bar.help | |
401 .bar.help add command -label "About gitk" -command about | |
402 . configure -menu .bar | |
403 | |
404 if {![info exists geometry(canv1)]} { | |
405 set geometry(canv1) [expr 45 * $charspc] | |
406 set geometry(canv2) [expr 30 * $charspc] | |
407 set geometry(canv3) [expr 15 * $charspc] | |
408 set geometry(canvh) [expr 25 * $linespc + 4] | |
409 set geometry(ctextw) 80 | |
410 set geometry(ctexth) 30 | |
411 set geometry(cflistw) 30 | |
412 } | |
413 panedwindow .ctop -orient vertical | |
414 if {[info exists geometry(width)]} { | |
415 .ctop conf -width $geometry(width) -height $geometry(height) | |
416 set texth [expr {$geometry(height) - $geometry(canvh) - 56}] | |
417 set geometry(ctexth) [expr {($texth - 8) / | |
418 [font metrics $textfont -linespace]}] | |
419 } | |
420 frame .ctop.top | |
421 frame .ctop.top.bar | |
422 pack .ctop.top.bar -side bottom -fill x | |
423 set cscroll .ctop.top.csb | |
424 scrollbar $cscroll -command {allcanvs yview} -highlightthickness 0 | |
425 pack $cscroll -side right -fill y | |
426 panedwindow .ctop.top.clist -orient horizontal -sashpad 0 -handlesize 4 | |
427 pack .ctop.top.clist -side top -fill both -expand 1 | |
428 .ctop add .ctop.top | |
429 set canv .ctop.top.clist.canv | |
430 canvas $canv -height $geometry(canvh) -width $geometry(canv1) \ | |
431 -bg white -bd 0 \ | |
4501
b2338c0cf468
hgk: added -selectbackground grey to canvases
Bela Babik <teki321@gmail.com>
parents:
3940
diff
changeset
|
432 -yscrollincr $linespc -yscrollcommand "$cscroll set" -selectbackground grey |
267 | 433 .ctop.top.clist add $canv |
434 set canv2 .ctop.top.clist.canv2 | |
435 canvas $canv2 -height $geometry(canvh) -width $geometry(canv2) \ | |
4501
b2338c0cf468
hgk: added -selectbackground grey to canvases
Bela Babik <teki321@gmail.com>
parents:
3940
diff
changeset
|
436 -bg white -bd 0 -yscrollincr $linespc -selectbackground grey |
267 | 437 .ctop.top.clist add $canv2 |
438 set canv3 .ctop.top.clist.canv3 | |
439 canvas $canv3 -height $geometry(canvh) -width $geometry(canv3) \ | |
4501
b2338c0cf468
hgk: added -selectbackground grey to canvases
Bela Babik <teki321@gmail.com>
parents:
3940
diff
changeset
|
440 -bg white -bd 0 -yscrollincr $linespc -selectbackground grey |
267 | 441 .ctop.top.clist add $canv3 |
442 bind .ctop.top.clist <Configure> {resizeclistpanes %W %w} | |
443 | |
444 set sha1entry .ctop.top.bar.sha1 | |
445 set entries $sha1entry | |
446 set sha1but .ctop.top.bar.sha1label | |
447 button $sha1but -text "SHA1 ID: " -state disabled -relief flat \ | |
448 -command gotocommit -width 8 | |
449 $sha1but conf -disabledforeground [$sha1but cget -foreground] | |
450 pack .ctop.top.bar.sha1label -side left | |
451 entry $sha1entry -width 40 -font $textfont -textvariable sha1string | |
452 trace add variable sha1string write sha1change | |
453 pack $sha1entry -side left -pady 2 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
454 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
455 image create bitmap bm-left -data { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
456 #define left_width 16 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
457 #define left_height 16 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
458 static unsigned char left_bits[] = { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
459 0x00, 0x00, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00, |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
460 0x0e, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x0e, 0x00, 0x1c, 0x00, |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
461 0x38, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x01}; |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
462 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
463 image create bitmap bm-right -data { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
464 #define right_width 16 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
465 #define right_height 16 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
466 static unsigned char right_bits[] = { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
467 0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c, |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
468 0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c, |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
469 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01}; |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
470 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
471 button .ctop.top.bar.leftbut -image bm-left -command goback \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
472 -state disabled -width 26 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
473 pack .ctop.top.bar.leftbut -side left -fill y |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
474 button .ctop.top.bar.rightbut -image bm-right -command goforw \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
475 -state disabled -width 26 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
476 pack .ctop.top.bar.rightbut -side left -fill y |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
477 |
267 | 478 button .ctop.top.bar.findbut -text "Find" -command dofind |
479 pack .ctop.top.bar.findbut -side left | |
480 set findstring {} | |
481 set fstring .ctop.top.bar.findstring | |
482 lappend entries $fstring | |
483 entry $fstring -width 30 -font $textfont -textvariable findstring | |
484 pack $fstring -side left -expand 1 -fill x | |
485 set findtype Exact | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
486 set findtypemenu [tk_optionMenu .ctop.top.bar.findtype \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
487 findtype Exact IgnCase Regexp] |
267 | 488 set findloc "All fields" |
489 tk_optionMenu .ctop.top.bar.findloc findloc "All fields" Headline \ | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
490 Comments Author Committer Files Pickaxe |
267 | 491 pack .ctop.top.bar.findloc -side right |
492 pack .ctop.top.bar.findtype -side right | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
493 # for making sure type==Exact whenever loc==Pickaxe |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
494 trace add variable findloc write findlocchange |
267 | 495 |
496 panedwindow .ctop.cdet -orient horizontal | |
497 .ctop add .ctop.cdet | |
498 frame .ctop.cdet.left | |
499 set ctext .ctop.cdet.left.ctext | |
500 text $ctext -bg white -state disabled -font $textfont \ | |
501 -width $geometry(ctextw) -height $geometry(ctexth) \ | |
1430
c91966c3bbf5
hgk: add horizontal scrollbar to patch window
TK Soh <teekaysoh@yahoo.com>
parents:
1429
diff
changeset
|
502 -yscrollcommand ".ctop.cdet.left.sb set" \ |
c91966c3bbf5
hgk: add horizontal scrollbar to patch window
TK Soh <teekaysoh@yahoo.com>
parents:
1429
diff
changeset
|
503 -xscrollcommand ".ctop.cdet.left.hb set" -wrap none |
267 | 504 scrollbar .ctop.cdet.left.sb -command "$ctext yview" |
1430
c91966c3bbf5
hgk: add horizontal scrollbar to patch window
TK Soh <teekaysoh@yahoo.com>
parents:
1429
diff
changeset
|
505 scrollbar .ctop.cdet.left.hb -orient horizontal -command "$ctext xview" |
267 | 506 pack .ctop.cdet.left.sb -side right -fill y |
1430
c91966c3bbf5
hgk: add horizontal scrollbar to patch window
TK Soh <teekaysoh@yahoo.com>
parents:
1429
diff
changeset
|
507 pack .ctop.cdet.left.hb -side bottom -fill x |
267 | 508 pack $ctext -side left -fill both -expand 1 |
509 .ctop.cdet add .ctop.cdet.left | |
510 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
511 $ctext tag conf filesep -font [concat $textfont bold] -back "#aaaaaa" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
512 if {$gaudydiff} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
513 $ctext tag conf hunksep -back blue -fore white |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
514 $ctext tag conf d0 -back "#ff8080" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
515 $ctext tag conf d1 -back green |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
516 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
517 $ctext tag conf hunksep -fore blue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
518 $ctext tag conf d0 -fore red |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
519 $ctext tag conf d1 -fore "#00a000" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
520 $ctext tag conf m0 -fore red |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
521 $ctext tag conf m1 -fore blue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
522 $ctext tag conf m2 -fore green |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
523 $ctext tag conf m3 -fore purple |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
524 $ctext tag conf m4 -fore brown |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
525 $ctext tag conf mmax -fore darkgrey |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
526 set mergemax 5 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
527 $ctext tag conf mresult -font [concat $textfont bold] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
528 $ctext tag conf msep -font [concat $textfont bold] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
529 $ctext tag conf found -back yellow |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
530 } |
267 | 531 |
532 frame .ctop.cdet.right | |
533 set cflist .ctop.cdet.right.cfiles | |
534 listbox $cflist -bg white -selectmode extended -width $geometry(cflistw) \ | |
535 -yscrollcommand ".ctop.cdet.right.sb set" | |
536 scrollbar .ctop.cdet.right.sb -command "$cflist yview" | |
537 pack .ctop.cdet.right.sb -side right -fill y | |
538 pack $cflist -side left -fill both -expand 1 | |
539 .ctop.cdet add .ctop.cdet.right | |
540 bind .ctop.cdet <Configure> {resizecdetpanes %W %w} | |
541 | |
542 pack .ctop -side top -fill both -expand 1 | |
543 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
544 bindall <1> {selcanvline %W %x %y} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
545 #bindall <B1-Motion> {selcanvline %W %x %y} |
4968
713426631adf
hgk: enable mouse wheel on MouseWheel events.
Patrick Mezard <pmezard@gmail.com>
parents:
4741
diff
changeset
|
546 bindall <MouseWheel> "allcansmousewheel %D" |
267 | 547 bindall <ButtonRelease-4> "allcanvs yview scroll -5 units" |
548 bindall <ButtonRelease-5> "allcanvs yview scroll 5 units" | |
549 bindall <2> "allcanvs scan mark 0 %y" | |
550 bindall <B2-Motion> "allcanvs scan dragto 0 %y" | |
551 bind . <Key-Up> "selnextline -1" | |
552 bind . <Key-Down> "selnextline 1" | |
553 bind . <Key-Prior> "allcanvs yview scroll -1 pages" | |
554 bind . <Key-Next> "allcanvs yview scroll 1 pages" | |
555 bindkey <Key-Delete> "$ctext yview scroll -1 pages" | |
556 bindkey <Key-BackSpace> "$ctext yview scroll -1 pages" | |
557 bindkey <Key-space> "$ctext yview scroll 1 pages" | |
558 bindkey p "selnextline -1" | |
559 bindkey n "selnextline 1" | |
560 bindkey b "$ctext yview scroll -1 pages" | |
561 bindkey d "$ctext yview scroll 18 units" | |
562 bindkey u "$ctext yview scroll -18 units" | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
563 bindkey / {findnext 1} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
564 bindkey <Key-Return> {findnext 0} |
267 | 565 bindkey ? findprev |
566 bindkey f nextfile | |
567 bind . <Control-q> doquit | |
1429
45bd7925dceb
Add control-w key binding to quit hgk.
Eric Bloodworth <ergosys@gmail.com>
parents:
1361
diff
changeset
|
568 bind . <Control-w> doquit |
267 | 569 bind . <Control-f> dofind |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
570 bind . <Control-g> {findnext 0} |
267 | 571 bind . <Control-r> findprev |
572 bind . <Control-equal> {incrfont 1} | |
573 bind . <Control-KP_Add> {incrfont 1} | |
574 bind . <Control-minus> {incrfont -1} | |
575 bind . <Control-KP_Subtract> {incrfont -1} | |
576 bind $cflist <<ListboxSelect>> listboxsel | |
577 bind . <Destroy> {savestuff %W} | |
578 bind . <Button-1> "click %W" | |
579 bind $fstring <Key-Return> dofind | |
580 bind $sha1entry <Key-Return> gotocommit | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
581 bind $sha1entry <<PasteSelection>> clearsha1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
582 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
583 set maincursor [. cget -cursor] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
584 set textcursor [$ctext cget -cursor] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
585 set curtextcursor $textcursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
586 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
587 set rowctxmenu .rowctxmenu |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
588 menu $rowctxmenu -tearoff 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
589 $rowctxmenu add command -label "Diff this -> selected" \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
590 -command {diffvssel 0} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
591 $rowctxmenu add command -label "Diff selected -> this" \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
592 -command {diffvssel 1} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
593 $rowctxmenu add command -label "Make patch" -command mkpatch |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
594 $rowctxmenu add command -label "Create tag" -command mktag |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
595 $rowctxmenu add command -label "Write commit to file" -command writecommit |
267 | 596 } |
597 | |
598 # when we make a key binding for the toplevel, make sure | |
599 # it doesn't get triggered when that key is pressed in the | |
600 # find string entry widget. | |
601 proc bindkey {ev script} { | |
602 global entries | |
603 bind . $ev $script | |
604 set escript [bind Entry $ev] | |
605 if {$escript == {}} { | |
606 set escript [bind Entry <Key>] | |
607 } | |
608 foreach e $entries { | |
609 bind $e $ev "$escript; break" | |
610 } | |
611 } | |
612 | |
613 # set the focus back to the toplevel for any click outside | |
614 # the entry widgets | |
615 proc click {w} { | |
616 global entries | |
617 foreach e $entries { | |
618 if {$w == $e} return | |
619 } | |
620 focus . | |
621 } | |
622 | |
623 proc savestuff {w} { | |
624 global canv canv2 canv3 ctext cflist mainfont textfont | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
625 global stuffsaved findmergefiles gaudydiff maxgraphpct |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
626 global maxwidth |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
627 |
267 | 628 if {$stuffsaved} return |
629 if {![winfo viewable .]} return | |
630 catch { | |
631 set f [open "~/.gitk-new" w] | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
632 puts $f [list set mainfont $mainfont] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
633 puts $f [list set textfont $textfont] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
634 puts $f [list set findmergefiles $findmergefiles] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
635 puts $f [list set gaudydiff $gaudydiff] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
636 puts $f [list set maxgraphpct $maxgraphpct] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
637 puts $f [list set maxwidth $maxwidth] |
267 | 638 puts $f "set geometry(width) [winfo width .ctop]" |
639 puts $f "set geometry(height) [winfo height .ctop]" | |
640 puts $f "set geometry(canv1) [expr [winfo width $canv]-2]" | |
641 puts $f "set geometry(canv2) [expr [winfo width $canv2]-2]" | |
642 puts $f "set geometry(canv3) [expr [winfo width $canv3]-2]" | |
643 puts $f "set geometry(canvh) [expr [winfo height $canv]-2]" | |
644 set wid [expr {([winfo width $ctext] - 8) \ | |
645 / [font measure $textfont "0"]}] | |
646 puts $f "set geometry(ctextw) $wid" | |
647 set wid [expr {([winfo width $cflist] - 11) \ | |
648 / [font measure [$cflist cget -font] "0"]}] | |
649 puts $f "set geometry(cflistw) $wid" | |
650 close $f | |
651 file rename -force "~/.gitk-new" "~/.gitk" | |
652 } | |
653 set stuffsaved 1 | |
654 } | |
655 | |
656 proc resizeclistpanes {win w} { | |
657 global oldwidth | |
658 if [info exists oldwidth($win)] { | |
659 set s0 [$win sash coord 0] | |
660 set s1 [$win sash coord 1] | |
661 if {$w < 60} { | |
662 set sash0 [expr {int($w/2 - 2)}] | |
663 set sash1 [expr {int($w*5/6 - 2)}] | |
664 } else { | |
665 set factor [expr {1.0 * $w / $oldwidth($win)}] | |
666 set sash0 [expr {int($factor * [lindex $s0 0])}] | |
667 set sash1 [expr {int($factor * [lindex $s1 0])}] | |
668 if {$sash0 < 30} { | |
669 set sash0 30 | |
670 } | |
671 if {$sash1 < $sash0 + 20} { | |
672 set sash1 [expr $sash0 + 20] | |
673 } | |
674 if {$sash1 > $w - 10} { | |
675 set sash1 [expr $w - 10] | |
676 if {$sash0 > $sash1 - 20} { | |
677 set sash0 [expr $sash1 - 20] | |
678 } | |
679 } | |
680 } | |
681 $win sash place 0 $sash0 [lindex $s0 1] | |
682 $win sash place 1 $sash1 [lindex $s1 1] | |
683 } | |
684 set oldwidth($win) $w | |
685 } | |
686 | |
687 proc resizecdetpanes {win w} { | |
688 global oldwidth | |
689 if [info exists oldwidth($win)] { | |
690 set s0 [$win sash coord 0] | |
691 if {$w < 60} { | |
692 set sash0 [expr {int($w*3/4 - 2)}] | |
693 } else { | |
694 set factor [expr {1.0 * $w / $oldwidth($win)}] | |
695 set sash0 [expr {int($factor * [lindex $s0 0])}] | |
696 if {$sash0 < 45} { | |
697 set sash0 45 | |
698 } | |
699 if {$sash0 > $w - 15} { | |
700 set sash0 [expr $w - 15] | |
701 } | |
702 } | |
703 $win sash place 0 $sash0 [lindex $s0 1] | |
704 } | |
705 set oldwidth($win) $w | |
706 } | |
707 | |
708 proc allcanvs args { | |
709 global canv canv2 canv3 | |
710 eval $canv $args | |
711 eval $canv2 $args | |
712 eval $canv3 $args | |
713 } | |
714 | |
715 proc bindall {event action} { | |
716 global canv canv2 canv3 | |
717 bind $canv $event $action | |
718 bind $canv2 $event $action | |
719 bind $canv3 $event $action | |
720 } | |
721 | |
722 proc about {} { | |
723 set w .about | |
724 if {[winfo exists $w]} { | |
725 raise $w | |
726 return | |
727 } | |
728 toplevel $w | |
729 wm title $w "About gitk" | |
730 message $w.m -text { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
731 Gitk version 1.2 |
267 | 732 |
733 Copyright © 2005 Paul Mackerras | |
734 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
735 Use and redistribute under the terms of the GNU General Public License} \ |
267 | 736 -justify center -aspect 400 |
737 pack $w.m -side top -fill x -padx 20 -pady 20 | |
738 button $w.ok -text Close -command "destroy $w" | |
739 pack $w.ok -side bottom | |
740 } | |
741 | |
742 proc assigncolor {id} { | |
743 global commitinfo colormap commcolors colors nextcolor | |
744 global parents nparents children nchildren | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
745 global cornercrossings crossings |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
746 |
267 | 747 if [info exists colormap($id)] return |
748 set ncolors [llength $colors] | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
749 if {$nparents($id) <= 1 && $nchildren($id) == 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
750 set child [lindex $children($id) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
751 if {[info exists colormap($child)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
752 && $nparents($child) == 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
753 set colormap($id) $colormap($child) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
754 return |
267 | 755 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
756 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
757 set badcolors {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
758 if {[info exists cornercrossings($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
759 foreach x $cornercrossings($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
760 if {[info exists colormap($x)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
761 && [lsearch -exact $badcolors $colormap($x)] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
762 lappend badcolors $colormap($x) |
267 | 763 } |
764 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
765 if {[llength $badcolors] >= $ncolors} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
766 set badcolors {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
767 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
768 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
769 set origbad $badcolors |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
770 if {[llength $badcolors] < $ncolors - 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
771 if {[info exists crossings($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
772 foreach x $crossings($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
773 if {[info exists colormap($x)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
774 && [lsearch -exact $badcolors $colormap($x)] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
775 lappend badcolors $colormap($x) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
776 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
777 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
778 if {[llength $badcolors] >= $ncolors} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
779 set badcolors $origbad |
267 | 780 } |
781 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
782 set origbad $badcolors |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
783 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
784 if {[llength $badcolors] < $ncolors - 1} { |
267 | 785 foreach child $children($id) { |
786 if {[info exists colormap($child)] | |
787 && [lsearch -exact $badcolors $colormap($child)] < 0} { | |
788 lappend badcolors $colormap($child) | |
789 } | |
790 if {[info exists parents($child)]} { | |
791 foreach p $parents($child) { | |
792 if {[info exists colormap($p)] | |
793 && [lsearch -exact $badcolors $colormap($p)] < 0} { | |
794 lappend badcolors $colormap($p) | |
795 } | |
796 } | |
797 } | |
798 } | |
799 if {[llength $badcolors] >= $ncolors} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
800 set badcolors $origbad |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
801 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
802 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
803 for {set i 0} {$i <= $ncolors} {incr i} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
804 set c [lindex $colors $nextcolor] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
805 if {[incr nextcolor] >= $ncolors} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
806 set nextcolor 0 |
267 | 807 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
808 if {[lsearch -exact $badcolors $c]} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
809 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
810 set colormap($id) $c |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
811 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
812 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
813 proc initgraph {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
814 global canvy canvy0 lineno numcommits nextcolor linespc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
815 global mainline mainlinearrow sidelines |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
816 global nchildren ncleft |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
817 global displist nhyperspace |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
818 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
819 allcanvs delete all |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
820 set nextcolor 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
821 set canvy $canvy0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
822 set lineno -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
823 set numcommits 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
824 catch {unset mainline} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
825 catch {unset mainlinearrow} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
826 catch {unset sidelines} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
827 foreach id [array names nchildren] { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
828 set ncleft($id) $nchildren($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
829 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
830 set displist {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
831 set nhyperspace 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
832 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
833 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
834 proc bindline {t id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
835 global canv |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
836 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
837 $canv bind $t <Enter> "lineenter %x %y $id" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
838 $canv bind $t <Motion> "linemotion %x %y $id" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
839 $canv bind $t <Leave> "lineleave $id" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
840 $canv bind $t <Button-1> "lineclick %x %y $id 1" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
841 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
842 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
843 proc drawlines {id xtra} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
844 global mainline mainlinearrow sidelines lthickness colormap canv |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
845 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
846 $canv delete lines.$id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
847 if {[info exists mainline($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
848 set t [$canv create line $mainline($id) \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
849 -width [expr {($xtra + 1) * $lthickness}] \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
850 -fill $colormap($id) -tags lines.$id \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
851 -arrow $mainlinearrow($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
852 $canv lower $t |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
853 bindline $t $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
854 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
855 if {[info exists sidelines($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
856 foreach ls $sidelines($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
857 set coords [lindex $ls 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
858 set thick [lindex $ls 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
859 set arrow [lindex $ls 2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
860 set t [$canv create line $coords -fill $colormap($id) \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
861 -width [expr {($thick + $xtra) * $lthickness}] \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
862 -arrow $arrow -tags lines.$id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
863 $canv lower $t |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
864 bindline $t $id |
267 | 865 } |
866 } | |
867 } | |
868 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
869 # level here is an index in displist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
870 proc drawcommitline {level} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
871 global parents children nparents displist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
872 global canv canv2 canv3 mainfont namefont canvy linespc |
267 | 873 global lineid linehtag linentag linedtag commitinfo |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
874 global colormap numcommits currentparents dupparents |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
875 global idtags idline idheads idotherrefs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
876 global lineno lthickness mainline mainlinearrow sidelines |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
877 global commitlisted rowtextx idpos lastuse displist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
878 global oldnlines olddlevel olddisplist |
267 | 879 |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
880 incr numcommits |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
881 incr lineno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
882 set id [lindex $displist $level] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
883 set lastuse($id) $lineno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
884 set lineid($lineno) $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
885 set idline($id) $lineno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
886 set ofill [expr {[info exists commitlisted($id)]? "blue": "white"}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
887 if {![info exists commitinfo($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
888 readcommit $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
889 if {![info exists commitinfo($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
890 set commitinfo($id) {"No commit information available"} |
267 | 891 set nparents($id) 0 |
892 } | |
893 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
894 assigncolor $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
895 set currentparents {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
896 set dupparents {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
897 if {[info exists commitlisted($id)] && [info exists parents($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
898 foreach p $parents($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
899 if {[lsearch -exact $currentparents $p] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
900 lappend currentparents $p |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
901 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
902 # remember that this parent was listed twice |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
903 lappend dupparents $p |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
904 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
905 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
906 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
907 set x [xcoord $level $level $lineno] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
908 set y1 $canvy |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
909 set canvy [expr $canvy + $linespc] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
910 allcanvs conf -scrollregion \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
911 [list 0 0 0 [expr $y1 + 0.5 * $linespc + 2]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
912 if {[info exists mainline($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
913 lappend mainline($id) $x $y1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
914 if {$mainlinearrow($id) ne "none"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
915 set mainline($id) [trimdiagstart $mainline($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
916 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
917 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
918 drawlines $id 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
919 set orad [expr {$linespc / 3}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
920 set t [$canv create oval [expr $x - $orad] [expr $y1 - $orad] \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
921 [expr $x + $orad - 1] [expr $y1 + $orad - 1] \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
922 -fill $ofill -outline black -width 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
923 $canv raise $t |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
924 $canv bind $t <1> {selcanvline {} %x %y} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
925 set xt [xcoord [llength $displist] $level $lineno] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
926 if {[llength $currentparents] > 2} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
927 set xt [expr {$xt + ([llength $currentparents] - 2) * $linespc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
928 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
929 set rowtextx($lineno) $xt |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
930 set idpos($id) [list $x $xt $y1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
931 if {[info exists idtags($id)] || [info exists idheads($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
932 || [info exists idotherrefs($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
933 set xt [drawtags $id $x $xt $y1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
934 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
935 set headline [lindex $commitinfo($id) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
936 set name [lindex $commitinfo($id) 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
937 set date [lindex $commitinfo($id) 2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
938 set linehtag($lineno) [$canv create text $xt $y1 -anchor w \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
939 -text $headline -font $mainfont ] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
940 $canv bind $linehtag($lineno) <Button-3> "rowmenu %X %Y $id" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
941 set linentag($lineno) [$canv2 create text 3 $y1 -anchor w \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
942 -text $name -font $namefont] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
943 set linedtag($lineno) [$canv3 create text 3 $y1 -anchor w \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
944 -text $date -font $mainfont] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
945 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
946 set olddlevel $level |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
947 set olddisplist $displist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
948 set oldnlines [llength $displist] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
949 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
950 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
951 proc drawtags {id x xt y1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
952 global idtags idheads idotherrefs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
953 global linespc lthickness |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
954 global canv mainfont idline rowtextx |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
955 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
956 set marks {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
957 set ntags 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
958 set nheads 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
959 if {[info exists idtags($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
960 set marks $idtags($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
961 set ntags [llength $marks] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
962 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
963 if {[info exists idheads($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
964 set marks [concat $marks $idheads($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
965 set nheads [llength $idheads($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
966 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
967 if {[info exists idotherrefs($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
968 set marks [concat $marks $idotherrefs($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
969 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
970 if {$marks eq {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
971 return $xt |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
972 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
973 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
974 set delta [expr {int(0.5 * ($linespc - $lthickness))}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
975 set yt [expr $y1 - 0.5 * $linespc] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
976 set yb [expr $yt + $linespc - 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
977 set xvals {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
978 set wvals {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
979 foreach tag $marks { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
980 set wid [font measure $mainfont $tag] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
981 lappend xvals $xt |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
982 lappend wvals $wid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
983 set xt [expr {$xt + $delta + $wid + $lthickness + $linespc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
984 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
985 set t [$canv create line $x $y1 [lindex $xvals end] $y1 \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
986 -width $lthickness -fill black -tags tag.$id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
987 $canv lower $t |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
988 foreach tag $marks x $xvals wid $wvals { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
989 set xl [expr $x + $delta] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
990 set xr [expr $x + $delta + $wid + $lthickness] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
991 if {[incr ntags -1] >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
992 # draw a tag |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
993 set t [$canv create polygon $x [expr $yt + $delta] $xl $yt \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
994 $xr $yt $xr $yb $xl $yb $x [expr $yb - $delta] \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
995 -width 1 -outline black -fill yellow -tags tag.$id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
996 $canv bind $t <1> [list showtag $tag 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
997 set rowtextx($idline($id)) [expr {$xr + $linespc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
998 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
999 # draw a head or other ref |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1000 if {[incr nheads -1] >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1001 set col green |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1002 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1003 set col "#ddddff" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1004 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1005 set xl [expr $xl - $delta/2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1006 $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1007 -width 1 -outline black -fill $col -tags tag.$id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1008 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1009 set t [$canv create text $xl $y1 -anchor w -text $tag \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1010 -font $mainfont -tags tag.$id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1011 if {$ntags >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1012 $canv bind $t <1> [list showtag $tag 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1013 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1014 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1015 return $xt |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1016 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1017 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1018 proc notecrossings {id lo hi corner} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1019 global olddisplist crossings cornercrossings |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1020 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1021 for {set i $lo} {[incr i] < $hi} {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1022 set p [lindex $olddisplist $i] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1023 if {$p == {}} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1024 if {$i == $corner} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1025 if {![info exists cornercrossings($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1026 || [lsearch -exact $cornercrossings($id) $p] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1027 lappend cornercrossings($id) $p |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1028 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1029 if {![info exists cornercrossings($p)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1030 || [lsearch -exact $cornercrossings($p) $id] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1031 lappend cornercrossings($p) $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1032 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1033 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1034 if {![info exists crossings($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1035 || [lsearch -exact $crossings($id) $p] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1036 lappend crossings($id) $p |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1037 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1038 if {![info exists crossings($p)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1039 || [lsearch -exact $crossings($p) $id] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1040 lappend crossings($p) $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1041 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1042 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1043 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1044 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1045 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1046 proc xcoord {i level ln} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1047 global canvx0 xspc1 xspc2 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1048 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1049 set x [expr {$canvx0 + $i * $xspc1($ln)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1050 if {$i > 0 && $i == $level} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1051 set x [expr {$x + 0.5 * ($xspc2 - $xspc1($ln))}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1052 } elseif {$i > $level} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1053 set x [expr {$x + $xspc2 - $xspc1($ln)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1054 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1055 return $x |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1056 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1057 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1058 # it seems Tk can't draw arrows on the end of diagonal line segments... |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1059 proc trimdiagend {line} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1060 while {[llength $line] > 4} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1061 set x1 [lindex $line end-3] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1062 set y1 [lindex $line end-2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1063 set x2 [lindex $line end-1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1064 set y2 [lindex $line end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1065 if {($x1 == $x2) != ($y1 == $y2)} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1066 set line [lreplace $line end-1 end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1067 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1068 return $line |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1069 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1070 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1071 proc trimdiagstart {line} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1072 while {[llength $line] > 4} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1073 set x1 [lindex $line 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1074 set y1 [lindex $line 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1075 set x2 [lindex $line 2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1076 set y2 [lindex $line 3] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1077 if {($x1 == $x2) != ($y1 == $y2)} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1078 set line [lreplace $line 0 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1079 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1080 return $line |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1081 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1082 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1083 proc drawslants {id needonscreen nohs} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1084 global canv mainline mainlinearrow sidelines |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1085 global canvx0 canvy xspc1 xspc2 lthickness |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1086 global currentparents dupparents |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1087 global lthickness linespc canvy colormap lineno geometry |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1088 global maxgraphpct maxwidth |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1089 global displist onscreen lastuse |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1090 global parents commitlisted |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1091 global oldnlines olddlevel olddisplist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1092 global nhyperspace numcommits nnewparents |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1093 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1094 if {$lineno < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1095 lappend displist $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1096 set onscreen($id) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1097 return 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1098 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1099 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1100 set y1 [expr {$canvy - $linespc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1101 set y2 $canvy |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1102 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1103 # work out what we need to get back on screen |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1104 set reins {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1105 if {$onscreen($id) < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1106 # next to do isn't displayed, better get it on screen... |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1107 lappend reins [list $id 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1108 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1109 # make sure all the previous commits's parents are on the screen |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1110 foreach p $currentparents { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1111 if {$onscreen($p) < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1112 lappend reins [list $p 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1113 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1114 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1115 # bring back anything requested by caller |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1116 if {$needonscreen ne {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1117 lappend reins $needonscreen |
267 | 1118 } |
1119 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1120 # try the shortcut |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1121 if {$currentparents == $id && $onscreen($id) == 0 && $reins eq {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1122 set dlevel $olddlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1123 set x [xcoord $dlevel $dlevel $lineno] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1124 set mainline($id) [list $x $y1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1125 set mainlinearrow($id) none |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1126 set lastuse($id) $lineno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1127 set displist [lreplace $displist $dlevel $dlevel $id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1128 set onscreen($id) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1129 set xspc1([expr {$lineno + 1}]) $xspc1($lineno) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1130 return $dlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1131 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1132 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1133 # update displist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1134 set displist [lreplace $displist $olddlevel $olddlevel] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1135 set j $olddlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1136 foreach p $currentparents { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1137 set lastuse($p) $lineno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1138 if {$onscreen($p) == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1139 set displist [linsert $displist $j $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1140 set onscreen($p) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1141 incr j |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1142 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1143 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1144 if {$onscreen($id) == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1145 lappend displist $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1146 set onscreen($id) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1147 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1148 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1149 # remove the null entry if present |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1150 set nullentry [lsearch -exact $displist {}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1151 if {$nullentry >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1152 set displist [lreplace $displist $nullentry $nullentry] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1153 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1154 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1155 # bring back the ones we need now (if we did it earlier |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1156 # it would change displist and invalidate olddlevel) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1157 foreach pi $reins { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1158 # test again in case of duplicates in reins |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1159 set p [lindex $pi 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1160 if {$onscreen($p) < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1161 set onscreen($p) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1162 set lastuse($p) $lineno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1163 set displist [linsert $displist [lindex $pi 1] $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1164 incr nhyperspace -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1165 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1166 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1167 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1168 set lastuse($id) $lineno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1169 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1170 # see if we need to make any lines jump off into hyperspace |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1171 set displ [llength $displist] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1172 if {$displ > $maxwidth} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1173 set ages {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1174 foreach x $displist { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1175 lappend ages [list $lastuse($x) $x] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1176 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1177 set ages [lsort -integer -index 0 $ages] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1178 set k 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1179 while {$displ > $maxwidth} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1180 set use [lindex $ages $k 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1181 set victim [lindex $ages $k 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1182 if {$use >= $lineno - 5} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1183 incr k |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1184 if {[lsearch -exact $nohs $victim] >= 0} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1185 set i [lsearch -exact $displist $victim] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1186 set displist [lreplace $displist $i $i] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1187 set onscreen($victim) -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1188 incr nhyperspace |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1189 incr displ -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1190 if {$i < $nullentry} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1191 incr nullentry -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1192 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1193 set x [lindex $mainline($victim) end-1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1194 lappend mainline($victim) $x $y1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1195 set line [trimdiagend $mainline($victim)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1196 set arrow "last" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1197 if {$mainlinearrow($victim) ne "none"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1198 set line [trimdiagstart $line] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1199 set arrow "both" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1200 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1201 lappend sidelines($victim) [list $line 1 $arrow] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1202 unset mainline($victim) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1203 } |
267 | 1204 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1205 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1206 set dlevel [lsearch -exact $displist $id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1207 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1208 # If we are reducing, put in a null entry |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1209 if {$displ < $oldnlines} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1210 # does the next line look like a merge? |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1211 # i.e. does it have > 1 new parent? |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1212 if {$nnewparents($id) > 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1213 set i [expr {$dlevel + 1}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1214 } elseif {$nnewparents([lindex $olddisplist $olddlevel]) == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1215 set i $olddlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1216 if {$nullentry >= 0 && $nullentry < $i} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1217 incr i -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1218 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1219 } elseif {$nullentry >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1220 set i $nullentry |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1221 while {$i < $displ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1222 && [lindex $olddisplist $i] == [lindex $displist $i]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1223 incr i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1224 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1225 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1226 set i $olddlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1227 if {$dlevel >= $i} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1228 incr i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1229 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1230 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1231 if {$i < $displ} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1232 set displist [linsert $displist $i {}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1233 incr displ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1234 if {$dlevel >= $i} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1235 incr dlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1236 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1237 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1238 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1239 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1240 # decide on the line spacing for the next line |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1241 set lj [expr {$lineno + 1}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1242 set maxw [expr {$maxgraphpct * $geometry(canv1) / 100}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1243 if {$displ <= 1 || $canvx0 + $displ * $xspc2 <= $maxw} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1244 set xspc1($lj) $xspc2 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1245 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1246 set xspc1($lj) [expr {($maxw - $canvx0 - $xspc2) / ($displ - 1)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1247 if {$xspc1($lj) < $lthickness} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1248 set xspc1($lj) $lthickness |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1249 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1250 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1251 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1252 foreach idi $reins { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1253 set id [lindex $idi 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1254 set j [lsearch -exact $displist $id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1255 set xj [xcoord $j $dlevel $lj] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1256 set mainline($id) [list $xj $y2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1257 set mainlinearrow($id) first |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1258 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1259 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1260 set i -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1261 foreach id $olddisplist { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1262 incr i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1263 if {$id == {}} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1264 if {$onscreen($id) <= 0} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1265 set xi [xcoord $i $olddlevel $lineno] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1266 if {$i == $olddlevel} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1267 foreach p $currentparents { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1268 set j [lsearch -exact $displist $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1269 set coords [list $xi $y1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1270 set xj [xcoord $j $dlevel $lj] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1271 if {$xj < $xi - $linespc} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1272 lappend coords [expr {$xj + $linespc}] $y1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1273 notecrossings $p $j $i [expr {$j + 1}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1274 } elseif {$xj > $xi + $linespc} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1275 lappend coords [expr {$xj - $linespc}] $y1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1276 notecrossings $p $i $j [expr {$j - 1}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1277 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1278 if {[lsearch -exact $dupparents $p] >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1279 # draw a double-width line to indicate the doubled parent |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1280 lappend coords $xj $y2 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1281 lappend sidelines($p) [list $coords 2 none] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1282 if {![info exists mainline($p)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1283 set mainline($p) [list $xj $y2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1284 set mainlinearrow($p) none |
267 | 1285 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1286 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1287 # normal case, no parent duplicated |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1288 set yb $y2 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1289 set dx [expr {abs($xi - $xj)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1290 if {0 && $dx < $linespc} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1291 set yb [expr {$y1 + $dx}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1292 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1293 if {![info exists mainline($p)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1294 if {$xi != $xj} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1295 lappend coords $xj $yb |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1296 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1297 set mainline($p) $coords |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1298 set mainlinearrow($p) none |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1299 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1300 lappend coords $xj $yb |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1301 if {$yb < $y2} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1302 lappend coords $xj $y2 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1303 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1304 lappend sidelines($p) [list $coords 1 none] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1305 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1306 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1307 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1308 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1309 set j $i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1310 if {[lindex $displist $i] != $id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1311 set j [lsearch -exact $displist $id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1312 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1313 if {$j != $i || $xspc1($lineno) != $xspc1($lj) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1314 || ($olddlevel < $i && $i < $dlevel) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1315 || ($dlevel < $i && $i < $olddlevel)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1316 set xj [xcoord $j $dlevel $lj] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1317 lappend mainline($id) $xi $y1 $xj $y2 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1318 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1319 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1320 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1321 return $dlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1322 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1323 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1324 # search for x in a list of lists |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1325 proc llsearch {llist x} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1326 set i 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1327 foreach l $llist { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1328 if {$l == $x || [lsearch -exact $l $x] >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1329 return $i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1330 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1331 incr i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1332 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1333 return -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1334 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1335 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1336 proc drawmore {reading} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1337 global displayorder numcommits ncmupdate nextupdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1338 global stopped nhyperspace parents commitlisted |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1339 global maxwidth onscreen displist currentparents olddlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1340 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1341 set n [llength $displayorder] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1342 while {$numcommits < $n} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1343 set id [lindex $displayorder $numcommits] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1344 set ctxend [expr {$numcommits + 10}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1345 if {!$reading && $ctxend > $n} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1346 set ctxend $n |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1347 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1348 set dlist {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1349 if {$numcommits > 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1350 set dlist [lreplace $displist $olddlevel $olddlevel] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1351 set i $olddlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1352 foreach p $currentparents { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1353 if {$onscreen($p) == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1354 set dlist [linsert $dlist $i $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1355 incr i |
267 | 1356 } |
1357 } | |
1358 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1359 set nohs {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1360 set reins {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1361 set isfat [expr {[llength $dlist] > $maxwidth}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1362 if {$nhyperspace > 0 || $isfat} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1363 if {$ctxend > $n} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1364 # work out what to bring back and |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1365 # what we want to don't want to send into hyperspace |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1366 set room 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1367 for {set k $numcommits} {$k < $ctxend} {incr k} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1368 set x [lindex $displayorder $k] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1369 set i [llsearch $dlist $x] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1370 if {$i < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1371 set i [llength $dlist] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1372 lappend dlist $x |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1373 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1374 if {[lsearch -exact $nohs $x] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1375 lappend nohs $x |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1376 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1377 if {$reins eq {} && $onscreen($x) < 0 && $room} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1378 set reins [list $x $i] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1379 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1380 set newp {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1381 if {[info exists commitlisted($x)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1382 set right 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1383 foreach p $parents($x) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1384 if {[llsearch $dlist $p] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1385 lappend newp $p |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1386 if {[lsearch -exact $nohs $p] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1387 lappend nohs $p |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1388 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1389 if {$reins eq {} && $onscreen($p) < 0 && $room} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1390 set reins [list $p [expr {$i + $right}]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1391 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1392 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1393 set right 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1394 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1395 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1396 set l [lindex $dlist $i] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1397 if {[llength $l] == 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1398 set l $newp |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1399 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1400 set j [lsearch -exact $l $x] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1401 set l [concat [lreplace $l $j $j] $newp] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1402 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1403 set dlist [lreplace $dlist $i $i $l] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1404 if {$room && $isfat && [llength $newp] <= 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1405 set room 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1406 } |
267 | 1407 } |
1408 } | |
1409 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1410 set dlevel [drawslants $id $reins $nohs] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1411 drawcommitline $dlevel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1412 if {[clock clicks -milliseconds] >= $nextupdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1413 && $numcommits >= $ncmupdate} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1414 doupdate $reading |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1415 if {$stopped} break |
267 | 1416 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1417 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1418 } |
267 | 1419 |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1420 # level here is an index in todo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1421 proc updatetodo {level noshortcut} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1422 global ncleft todo nnewparents |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1423 global commitlisted parents onscreen |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1424 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1425 set id [lindex $todo $level] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1426 set olds {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1427 if {[info exists commitlisted($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1428 foreach p $parents($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1429 if {[lsearch -exact $olds $p] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1430 lappend olds $p |
267 | 1431 } |
1432 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1433 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1434 if {!$noshortcut && [llength $olds] == 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1435 set p [lindex $olds 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1436 if {$ncleft($p) == 1 && [lsearch -exact $todo $p] < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1437 set ncleft($p) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1438 set todo [lreplace $todo $level $level $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1439 set onscreen($p) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1440 set nnewparents($id) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1441 return 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1442 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1443 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1444 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1445 set todo [lreplace $todo $level $level] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1446 set i $level |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1447 set n 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1448 foreach p $olds { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1449 incr ncleft($p) -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1450 set k [lsearch -exact $todo $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1451 if {$k < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1452 set todo [linsert $todo $i $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1453 set onscreen($p) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1454 incr i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1455 incr n |
267 | 1456 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1457 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1458 set nnewparents($id) $n |
267 | 1459 |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1460 return 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1461 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1462 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1463 proc decidenext {{noread 0}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1464 global ncleft todo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1465 global datemode cdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1466 global commitinfo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1467 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1468 # choose which one to do next time around |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1469 set todol [llength $todo] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1470 set level -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1471 set latest {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1472 for {set k $todol} {[incr k -1] >= 0} {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1473 set p [lindex $todo $k] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1474 if {$ncleft($p) == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1475 if {$datemode} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1476 if {![info exists commitinfo($p)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1477 if {$noread} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1478 return {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1479 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1480 readcommit $p |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1481 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1482 if {$latest == {} || $cdate($p) > $latest} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1483 set level $k |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1484 set latest $cdate($p) |
267 | 1485 } |
1486 } else { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1487 set level $k |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1488 break |
267 | 1489 } |
1490 } | |
1491 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1492 if {$level < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1493 if {$todo != {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1494 puts "ERROR: none of the pending commits can be done yet:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1495 foreach p $todo { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1496 puts " $p ($ncleft($p))" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1497 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1498 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1499 return -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1500 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1501 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1502 return $level |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1503 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1504 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1505 proc drawcommit {id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1506 global phase todo nchildren datemode nextupdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1507 global numcommits ncmupdate displayorder todo onscreen |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1508 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1509 if {$phase != "incrdraw"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1510 set phase incrdraw |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1511 set displayorder {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1512 set todo {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1513 initgraph |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1514 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1515 if {$nchildren($id) == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1516 lappend todo $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1517 set onscreen($id) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1518 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1519 set level [decidenext 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1520 if {$level == {} || $id != [lindex $todo $level]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1521 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1522 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1523 while 1 { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1524 lappend displayorder [lindex $todo $level] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1525 if {[updatetodo $level $datemode]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1526 set level [decidenext 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1527 if {$level == {}} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1528 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1529 set id [lindex $todo $level] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1530 if {![info exists commitlisted($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1531 break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1532 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1533 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1534 drawmore 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1535 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1536 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1537 proc finishcommits {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1538 global phase |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1539 global canv mainfont ctext maincursor textcursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1540 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1541 if {$phase != "incrdraw"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1542 $canv delete all |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1543 $canv create text 3 3 -anchor nw -text "No commits selected" \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1544 -font $mainfont -tags textitems |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1545 set phase {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1546 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1547 drawrest |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1548 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1549 . config -cursor $maincursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1550 settextcursor $textcursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1551 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1552 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1553 # Don't change the text pane cursor if it is currently the hand cursor, |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1554 # showing that we are over a sha1 ID link. |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1555 proc settextcursor {c} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1556 global ctext curtextcursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1557 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1558 if {[$ctext cget -cursor] == $curtextcursor} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1559 $ctext config -cursor $c |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1560 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1561 set curtextcursor $c |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1562 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1563 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1564 proc drawgraph {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1565 global nextupdate startmsecs ncmupdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1566 global displayorder onscreen |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1567 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1568 if {$displayorder == {}} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1569 set startmsecs [clock clicks -milliseconds] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1570 set nextupdate [expr $startmsecs + 100] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1571 set ncmupdate 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1572 initgraph |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1573 foreach id $displayorder { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1574 set onscreen($id) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1575 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1576 drawmore 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1577 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1578 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1579 proc drawrest {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1580 global phase stopped redisplaying selectedline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1581 global datemode todo displayorder |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1582 global numcommits ncmupdate |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1583 global nextupdate startmsecs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1584 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1585 set level [decidenext] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1586 if {$level >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1587 set phase drawgraph |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1588 while 1 { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1589 lappend displayorder [lindex $todo $level] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1590 set hard [updatetodo $level $datemode] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1591 if {$hard} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1592 set level [decidenext] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1593 if {$level < 0} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1594 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1595 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1596 drawmore 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1597 } |
267 | 1598 set phase {} |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1599 set drawmsecs [expr [clock clicks -milliseconds] - $startmsecs] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1600 #puts "overall $drawmsecs ms for $numcommits commits" |
267 | 1601 if {$redisplaying} { |
1602 if {$stopped == 0 && [info exists selectedline]} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1603 selectline $selectedline 0 |
267 | 1604 } |
1605 if {$stopped == 1} { | |
1606 set stopped 0 | |
1607 after idle drawgraph | |
1608 } else { | |
1609 set redisplaying 0 | |
1610 } | |
1611 } | |
1612 } | |
1613 | |
1614 proc findmatches {f} { | |
1615 global findtype foundstring foundstrlen | |
1616 if {$findtype == "Regexp"} { | |
1617 set matches [regexp -indices -all -inline $foundstring $f] | |
1618 } else { | |
1619 if {$findtype == "IgnCase"} { | |
1620 set str [string tolower $f] | |
1621 } else { | |
1622 set str $f | |
1623 } | |
1624 set matches {} | |
1625 set i 0 | |
1626 while {[set j [string first $foundstring $str $i]] >= 0} { | |
1627 lappend matches [list $j [expr $j+$foundstrlen-1]] | |
1628 set i [expr $j + $foundstrlen] | |
1629 } | |
1630 } | |
1631 return $matches | |
1632 } | |
1633 | |
1634 proc dofind {} { | |
1635 global findtype findloc findstring markedmatches commitinfo | |
1636 global numcommits lineid linehtag linentag linedtag | |
1637 global mainfont namefont canv canv2 canv3 selectedline | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1638 global matchinglines foundstring foundstrlen |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1639 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1640 stopfindproc |
267 | 1641 unmarkmatches |
1642 focus . | |
1643 set matchinglines {} | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1644 if {$findloc == "Pickaxe"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1645 findpatches |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1646 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1647 } |
267 | 1648 if {$findtype == "IgnCase"} { |
1649 set foundstring [string tolower $findstring] | |
1650 } else { | |
1651 set foundstring $findstring | |
1652 } | |
1653 set foundstrlen [string length $findstring] | |
1654 if {$foundstrlen == 0} return | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1655 if {$findloc == "Files"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1656 findfiles |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1657 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1658 } |
267 | 1659 if {![info exists selectedline]} { |
1660 set oldsel -1 | |
1661 } else { | |
1662 set oldsel $selectedline | |
1663 } | |
1664 set didsel 0 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1665 set fldtypes {Headline Author Date Committer CDate Comment} |
267 | 1666 for {set l 0} {$l < $numcommits} {incr l} { |
1667 set id $lineid($l) | |
1668 set info $commitinfo($id) | |
1669 set doesmatch 0 | |
1670 foreach f $info ty $fldtypes { | |
1671 if {$findloc != "All fields" && $findloc != $ty} { | |
1672 continue | |
1673 } | |
1674 set matches [findmatches $f] | |
1675 if {$matches == {}} continue | |
1676 set doesmatch 1 | |
1677 if {$ty == "Headline"} { | |
1678 markmatches $canv $l $f $linehtag($l) $matches $mainfont | |
1679 } elseif {$ty == "Author"} { | |
1680 markmatches $canv2 $l $f $linentag($l) $matches $namefont | |
1681 } elseif {$ty == "Date"} { | |
1682 markmatches $canv3 $l $f $linedtag($l) $matches $mainfont | |
1683 } | |
1684 } | |
1685 if {$doesmatch} { | |
1686 lappend matchinglines $l | |
1687 if {!$didsel && $l > $oldsel} { | |
1688 findselectline $l | |
1689 set didsel 1 | |
1690 } | |
1691 } | |
1692 } | |
1693 if {$matchinglines == {}} { | |
1694 bell | |
1695 } elseif {!$didsel} { | |
1696 findselectline [lindex $matchinglines 0] | |
1697 } | |
1698 } | |
1699 | |
1700 proc findselectline {l} { | |
1701 global findloc commentend ctext | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1702 selectline $l 1 |
267 | 1703 if {$findloc == "All fields" || $findloc == "Comments"} { |
1704 # highlight the matches in the comments | |
1705 set f [$ctext get 1.0 $commentend] | |
1706 set matches [findmatches $f] | |
1707 foreach match $matches { | |
1708 set start [lindex $match 0] | |
1709 set end [expr [lindex $match 1] + 1] | |
1710 $ctext tag add found "1.0 + $start c" "1.0 + $end c" | |
1711 } | |
1712 } | |
1713 } | |
1714 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1715 proc findnext {restart} { |
267 | 1716 global matchinglines selectedline |
1717 if {![info exists matchinglines]} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1718 if {$restart} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1719 dofind |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1720 } |
267 | 1721 return |
1722 } | |
1723 if {![info exists selectedline]} return | |
1724 foreach l $matchinglines { | |
1725 if {$l > $selectedline} { | |
1726 findselectline $l | |
1727 return | |
1728 } | |
1729 } | |
1730 bell | |
1731 } | |
1732 | |
1733 proc findprev {} { | |
1734 global matchinglines selectedline | |
1735 if {![info exists matchinglines]} { | |
1736 dofind | |
1737 return | |
1738 } | |
1739 if {![info exists selectedline]} return | |
1740 set prev {} | |
1741 foreach l $matchinglines { | |
1742 if {$l >= $selectedline} break | |
1743 set prev $l | |
1744 } | |
1745 if {$prev != {}} { | |
1746 findselectline $prev | |
1747 } else { | |
1748 bell | |
1749 } | |
1750 } | |
1751 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1752 proc findlocchange {name ix op} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1753 global findloc findtype findtypemenu |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1754 if {$findloc == "Pickaxe"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1755 set findtype Exact |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1756 set state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1757 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1758 set state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1759 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1760 $findtypemenu entryconf 1 -state $state |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1761 $findtypemenu entryconf 2 -state $state |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1762 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1763 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1764 proc stopfindproc {{done 0}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1765 global findprocpid findprocfile findids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1766 global ctext findoldcursor phase maincursor textcursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1767 global findinprogress |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1768 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1769 catch {unset findids} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1770 if {[info exists findprocpid]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1771 if {!$done} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1772 catch {exec kill $findprocpid} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1773 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1774 catch {close $findprocfile} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1775 unset findprocpid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1776 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1777 if {[info exists findinprogress]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1778 unset findinprogress |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1779 if {$phase != "incrdraw"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1780 . config -cursor $maincursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1781 settextcursor $textcursor |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1782 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1783 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1784 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1785 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1786 proc findpatches {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1787 global findstring selectedline numcommits |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1788 global findprocpid findprocfile |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1789 global finddidsel ctext lineid findinprogress |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1790 global findinsertpos |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
1791 global env |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1792 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1793 if {$numcommits == 0} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1794 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1795 # make a list of all the ids to search, starting at the one |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1796 # after the selected line (if any) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1797 if {[info exists selectedline]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1798 set l $selectedline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1799 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1800 set l -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1801 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1802 set inputids {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1803 for {set i 0} {$i < $numcommits} {incr i} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1804 if {[incr l] >= $numcommits} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1805 set l 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1806 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1807 append inputids $lineid($l) "\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1808 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1809 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1810 if {[catch { |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
1811 set f [open [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree --stdin -s -r -S$findstring << $inputids] r] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1812 } err]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1813 error_popup "Error starting search process: $err" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1814 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1815 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1816 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1817 set findinsertpos end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1818 set findprocfile $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1819 set findprocpid [pid $f] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1820 fconfigure $f -blocking 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1821 fileevent $f readable readfindproc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1822 set finddidsel 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1823 . config -cursor watch |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1824 settextcursor watch |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1825 set findinprogress 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1826 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1827 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1828 proc readfindproc {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1829 global findprocfile finddidsel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1830 global idline matchinglines findinsertpos |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1831 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1832 set n [gets $findprocfile line] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1833 if {$n < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1834 if {[eof $findprocfile]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1835 stopfindproc 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1836 if {!$finddidsel} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1837 bell |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1838 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1839 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1840 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1841 } |
3059
3dab573a4330
hgk: use short changeset hashes
TK Soh <teekaysoh@yahoo.com>
parents:
2297
diff
changeset
|
1842 if {![regexp {^[0-9a-f]{12}} $line id]} { |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1843 error_popup "Can't parse git-diff-tree output: $line" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1844 stopfindproc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1845 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1846 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1847 if {![info exists idline($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1848 puts stderr "spurious id: $id" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1849 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1850 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1851 set l $idline($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1852 insertmatch $l $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1853 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1854 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1855 proc insertmatch {l id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1856 global matchinglines findinsertpos finddidsel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1857 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1858 if {$findinsertpos == "end"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1859 if {$matchinglines != {} && $l < [lindex $matchinglines 0]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1860 set matchinglines [linsert $matchinglines 0 $l] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1861 set findinsertpos 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1862 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1863 lappend matchinglines $l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1864 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1865 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1866 set matchinglines [linsert $matchinglines $findinsertpos $l] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1867 incr findinsertpos |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1868 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1869 markheadline $l $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1870 if {!$finddidsel} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1871 findselectline $l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1872 set finddidsel 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1873 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1874 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1875 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1876 proc findfiles {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1877 global selectedline numcommits lineid ctext |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1878 global ffileline finddidsel parents nparents |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1879 global findinprogress findstartline findinsertpos |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1880 global treediffs fdiffids fdiffsneeded fdiffpos |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1881 global findmergefiles |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
1882 global env |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1883 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1884 if {$numcommits == 0} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1885 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1886 if {[info exists selectedline]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1887 set l [expr {$selectedline + 1}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1888 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1889 set l 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1890 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1891 set ffileline $l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1892 set findstartline $l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1893 set diffsneeded {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1894 set fdiffsneeded {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1895 while 1 { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1896 set id $lineid($l) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1897 if {$findmergefiles || $nparents($id) == 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1898 foreach p $parents($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1899 if {![info exists treediffs([list $id $p])]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1900 append diffsneeded "$id $p\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1901 lappend fdiffsneeded [list $id $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1902 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1903 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1904 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1905 if {[incr l] >= $numcommits} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1906 set l 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1907 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1908 if {$l == $findstartline} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1909 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1910 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1911 # start off a git-diff-tree process if needed |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1912 if {$diffsneeded ne {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1913 if {[catch { |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
1914 set df [open [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree -r --stdin << $diffsneeded] r] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1915 } err ]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1916 error_popup "Error starting search process: $err" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1917 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1918 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1919 catch {unset fdiffids} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1920 set fdiffpos 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1921 fconfigure $df -blocking 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1922 fileevent $df readable [list readfilediffs $df] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1923 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1924 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1925 set finddidsel 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1926 set findinsertpos end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1927 set id $lineid($l) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1928 set p [lindex $parents($id) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1929 . config -cursor watch |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1930 settextcursor watch |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1931 set findinprogress 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1932 findcont [list $id $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1933 update |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1934 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1935 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1936 proc readfilediffs {df} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1937 global findids fdiffids fdiffs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1938 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1939 set n [gets $df line] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1940 if {$n < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1941 if {[eof $df]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1942 donefilediff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1943 if {[catch {close $df} err]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1944 stopfindproc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1945 bell |
1278 | 1946 error_popup "Error in hg debug-diff-tree: $err" |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1947 } elseif {[info exists findids]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1948 set ids $findids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1949 stopfindproc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1950 bell |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1951 error_popup "Couldn't find diffs for {$ids}" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1952 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1953 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1954 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1955 } |
3059
3dab573a4330
hgk: use short changeset hashes
TK Soh <teekaysoh@yahoo.com>
parents:
2297
diff
changeset
|
1956 if {[regexp {^([0-9a-f]{12}) \(from ([0-9a-f]{12})\)} $line match id p]} { |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1957 # start of a new string of diffs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1958 donefilediff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1959 set fdiffids [list $id $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1960 set fdiffs {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1961 } elseif {[string match ":*" $line]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1962 lappend fdiffs [lindex $line 5] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1963 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1964 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1965 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1966 proc donefilediff {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1967 global fdiffids fdiffs treediffs findids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1968 global fdiffsneeded fdiffpos |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1969 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1970 if {[info exists fdiffids]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1971 while {[lindex $fdiffsneeded $fdiffpos] ne $fdiffids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1972 && $fdiffpos < [llength $fdiffsneeded]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1973 # git-diff-tree doesn't output anything for a commit |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1974 # which doesn't change anything |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1975 set nullids [lindex $fdiffsneeded $fdiffpos] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1976 set treediffs($nullids) {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1977 if {[info exists findids] && $nullids eq $findids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1978 unset findids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1979 findcont $nullids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1980 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1981 incr fdiffpos |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1982 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1983 incr fdiffpos |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1984 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1985 if {![info exists treediffs($fdiffids)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1986 set treediffs($fdiffids) $fdiffs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1987 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1988 if {[info exists findids] && $fdiffids eq $findids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1989 unset findids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1990 findcont $fdiffids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1991 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1992 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1993 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1994 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1995 proc findcont {ids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1996 global findids treediffs parents nparents |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1997 global ffileline findstartline finddidsel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1998 global lineid numcommits matchinglines findinprogress |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
1999 global findmergefiles |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2000 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2001 set id [lindex $ids 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2002 set p [lindex $ids 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2003 set pi [lsearch -exact $parents($id) $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2004 set l $ffileline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2005 while 1 { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2006 if {$findmergefiles || $nparents($id) == 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2007 if {![info exists treediffs($ids)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2008 set findids $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2009 set ffileline $l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2010 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2011 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2012 set doesmatch 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2013 foreach f $treediffs($ids) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2014 set x [findmatches $f] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2015 if {$x != {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2016 set doesmatch 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2017 break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2018 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2019 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2020 if {$doesmatch} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2021 insertmatch $l $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2022 set pi $nparents($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2023 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2024 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2025 set pi $nparents($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2026 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2027 if {[incr pi] >= $nparents($id)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2028 set pi 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2029 if {[incr l] >= $numcommits} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2030 set l 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2031 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2032 if {$l == $findstartline} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2033 set id $lineid($l) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2034 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2035 set p [lindex $parents($id) $pi] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2036 set ids [list $id $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2037 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2038 stopfindproc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2039 if {!$finddidsel} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2040 bell |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2041 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2042 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2043 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2044 # mark a commit as matching by putting a yellow background |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2045 # behind the headline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2046 proc markheadline {l id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2047 global canv mainfont linehtag commitinfo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2048 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2049 set bbox [$canv bbox $linehtag($l)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2050 set t [$canv create rect $bbox -outline {} -tags matches -fill yellow] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2051 $canv lower $t |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2052 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2053 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2054 # mark the bits of a headline, author or date that match a find string |
267 | 2055 proc markmatches {canv l str tag matches font} { |
2056 set bbox [$canv bbox $tag] | |
2057 set x0 [lindex $bbox 0] | |
2058 set y0 [lindex $bbox 1] | |
2059 set y1 [lindex $bbox 3] | |
2060 foreach match $matches { | |
2061 set start [lindex $match 0] | |
2062 set end [lindex $match 1] | |
2063 if {$start > $end} continue | |
2064 set xoff [font measure $font [string range $str 0 [expr $start-1]]] | |
2065 set xlen [font measure $font [string range $str 0 [expr $end]]] | |
2066 set t [$canv create rect [expr $x0+$xoff] $y0 [expr $x0+$xlen+2] $y1 \ | |
2067 -outline {} -tags matches -fill yellow] | |
2068 $canv lower $t | |
2069 } | |
2070 } | |
2071 | |
2072 proc unmarkmatches {} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2073 global matchinglines findids |
267 | 2074 allcanvs delete matches |
2075 catch {unset matchinglines} | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2076 catch {unset findids} |
267 | 2077 } |
2078 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2079 proc selcanvline {w x y} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2080 global canv canvy0 ctext linespc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2081 global lineid linehtag linentag linedtag rowtextx |
267 | 2082 set ymax [lindex [$canv cget -scrollregion] 3] |
2083 if {$ymax == {}} return | |
2084 set yfrac [lindex [$canv yview] 0] | |
2085 set y [expr {$y + $yfrac * $ymax}] | |
2086 set l [expr {int(($y - $canvy0) / $linespc + 0.5)}] | |
2087 if {$l < 0} { | |
2088 set l 0 | |
2089 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2090 if {$w eq $canv} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2091 if {![info exists rowtextx($l)] || $x < $rowtextx($l)} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2092 } |
267 | 2093 unmarkmatches |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2094 selectline $l 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2095 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2096 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2097 proc commit_descriptor {p} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2098 global commitinfo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2099 set l "..." |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2100 if {[info exists commitinfo($p)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2101 set l [lindex $commitinfo($p) 0] |
3092
d0fcce3728d1
hgk: add revision numbers
Brendan Cully <brendan@kublai.com>
parents:
3059
diff
changeset
|
2102 set r [lindex $commitinfo($p) 6] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2103 } |
3092
d0fcce3728d1
hgk: add revision numbers
Brendan Cully <brendan@kublai.com>
parents:
3059
diff
changeset
|
2104 return "$r:$p ($l)" |
267 | 2105 } |
2106 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2107 # append some text to the ctext widget, and make any SHA1 ID |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2108 # that we know about be a clickable link. |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2109 proc appendwithlinks {text} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2110 global ctext idline linknum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2111 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2112 set start [$ctext index "end - 1c"] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2113 $ctext insert end $text |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2114 $ctext insert end "\n" |
3059
3dab573a4330
hgk: use short changeset hashes
TK Soh <teekaysoh@yahoo.com>
parents:
2297
diff
changeset
|
2115 set links [regexp -indices -all -inline {[0-9a-f]{12}} $text] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2116 foreach l $links { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2117 set s [lindex $l 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2118 set e [lindex $l 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2119 set linkid [string range $text $s $e] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2120 if {![info exists idline($linkid)]} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2121 incr e |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2122 $ctext tag add link "$start + $s c" "$start + $e c" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2123 $ctext tag add link$linknum "$start + $s c" "$start + $e c" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2124 $ctext tag bind link$linknum <1> [list selectline $idline($linkid) 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2125 incr linknum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2126 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2127 $ctext tag conf link -foreground blue -underline 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2128 $ctext tag bind link <Enter> { %W configure -cursor hand2 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2129 $ctext tag bind link <Leave> { %W configure -cursor $curtextcursor } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2130 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2131 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2132 proc selectline {l isnew} { |
267 | 2133 global canv canv2 canv3 ctext commitinfo selectedline |
2134 global lineid linehtag linentag linedtag | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2135 global canvy0 linespc parents nparents children |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2136 global cflist currentid sha1entry |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2137 global commentend idtags idline linknum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2138 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2139 $canv delete hover |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2140 normalline |
267 | 2141 if {![info exists lineid($l)] || ![info exists linehtag($l)]} return |
2142 $canv delete secsel | |
2143 set t [eval $canv create rect [$canv bbox $linehtag($l)] -outline {{}} \ | |
2144 -tags secsel -fill [$canv cget -selectbackground]] | |
2145 $canv lower $t | |
2146 $canv2 delete secsel | |
2147 set t [eval $canv2 create rect [$canv2 bbox $linentag($l)] -outline {{}} \ | |
2148 -tags secsel -fill [$canv2 cget -selectbackground]] | |
2149 $canv2 lower $t | |
2150 $canv3 delete secsel | |
2151 set t [eval $canv3 create rect [$canv3 bbox $linedtag($l)] -outline {{}} \ | |
2152 -tags secsel -fill [$canv3 cget -selectbackground]] | |
2153 $canv3 lower $t | |
2154 set y [expr {$canvy0 + $l * $linespc}] | |
2155 set ymax [lindex [$canv cget -scrollregion] 3] | |
2156 set ytop [expr {$y - $linespc - 1}] | |
2157 set ybot [expr {$y + $linespc + 1}] | |
2158 set wnow [$canv yview] | |
2159 set wtop [expr [lindex $wnow 0] * $ymax] | |
2160 set wbot [expr [lindex $wnow 1] * $ymax] | |
2161 set wh [expr {$wbot - $wtop}] | |
2162 set newtop $wtop | |
2163 if {$ytop < $wtop} { | |
2164 if {$ybot < $wtop} { | |
2165 set newtop [expr {$y - $wh / 2.0}] | |
2166 } else { | |
2167 set newtop $ytop | |
2168 if {$newtop > $wtop - $linespc} { | |
2169 set newtop [expr {$wtop - $linespc}] | |
2170 } | |
2171 } | |
2172 } elseif {$ybot > $wbot} { | |
2173 if {$ytop > $wbot} { | |
2174 set newtop [expr {$y - $wh / 2.0}] | |
2175 } else { | |
2176 set newtop [expr {$ybot - $wh}] | |
2177 if {$newtop < $wtop + $linespc} { | |
2178 set newtop [expr {$wtop + $linespc}] | |
2179 } | |
2180 } | |
2181 } | |
2182 if {$newtop != $wtop} { | |
2183 if {$newtop < 0} { | |
2184 set newtop 0 | |
2185 } | |
2186 allcanvs yview moveto [expr $newtop * 1.0 / $ymax] | |
2187 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2188 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2189 if {$isnew} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2190 addtohistory [list selectline $l 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2191 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2192 |
267 | 2193 set selectedline $l |
2194 | |
2195 set id $lineid($l) | |
2196 set currentid $id | |
2197 $sha1entry delete 0 end | |
2198 $sha1entry insert 0 $id | |
2199 $sha1entry selection from 0 | |
2200 $sha1entry selection to end | |
2201 | |
2202 $ctext conf -state normal | |
2203 $ctext delete 0.0 end | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2204 set linknum 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2205 $ctext mark set fmark.0 0.0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2206 $ctext mark gravity fmark.0 left |
267 | 2207 set info $commitinfo($id) |
3092
d0fcce3728d1
hgk: add revision numbers
Brendan Cully <brendan@kublai.com>
parents:
3059
diff
changeset
|
2208 $ctext insert end "Revision: [lindex $info 6]\n" |
267 | 2209 $ctext insert end "Author: [lindex $info 1] [lindex $info 2]\n" |
2210 $ctext insert end "Committer: [lindex $info 3] [lindex $info 4]\n" | |
2211 if {[info exists idtags($id)]} { | |
2212 $ctext insert end "Tags:" | |
2213 foreach tag $idtags($id) { | |
2214 $ctext insert end " $tag" | |
2215 } | |
2216 $ctext insert end "\n" | |
2217 } | |
1308
2073e5a71008
Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1278
diff
changeset
|
2218 |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2219 set comment {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2220 if {[info exists parents($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2221 foreach p $parents($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2222 append comment "Parent: [commit_descriptor $p]\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2223 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2224 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2225 if {[info exists children($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2226 foreach c $children($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2227 append comment "Child: [commit_descriptor $c]\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2228 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2229 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2230 append comment "\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2231 append comment [lindex $info 5] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2232 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2233 # make anything that looks like a SHA1 ID be a clickable link |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2234 appendwithlinks $comment |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2235 |
267 | 2236 $ctext tag delete Comments |
2237 $ctext tag remove found 1.0 end | |
2238 $ctext conf -state disabled | |
2239 set commentend [$ctext index "end - 1c"] | |
2240 | |
2241 $cflist delete 0 end | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2242 $cflist insert end "Comments" |
267 | 2243 if {$nparents($id) == 1} { |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2244 startdiff [concat $id $parents($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2245 } elseif {$nparents($id) > 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2246 mergediff $id |
267 | 2247 } |
2248 } | |
2249 | |
2250 proc selnextline {dir} { | |
2251 global selectedline | |
2252 if {![info exists selectedline]} return | |
2253 set l [expr $selectedline + $dir] | |
2254 unmarkmatches | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2255 selectline $l 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2256 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2257 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2258 proc unselectline {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2259 global selectedline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2260 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2261 catch {unset selectedline} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2262 allcanvs delete secsel |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2263 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2264 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2265 proc addtohistory {cmd} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2266 global history historyindex |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2267 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2268 if {$historyindex > 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2269 && [lindex $history [expr {$historyindex - 1}]] == $cmd} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2270 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2271 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2272 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2273 if {$historyindex < [llength $history]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2274 set history [lreplace $history $historyindex end $cmd] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2275 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2276 lappend history $cmd |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2277 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2278 incr historyindex |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2279 if {$historyindex > 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2280 .ctop.top.bar.leftbut conf -state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2281 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2282 .ctop.top.bar.leftbut conf -state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2283 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2284 .ctop.top.bar.rightbut conf -state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2285 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2286 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2287 proc goback {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2288 global history historyindex |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2289 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2290 if {$historyindex > 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2291 incr historyindex -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2292 set cmd [lindex $history [expr {$historyindex - 1}]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2293 eval $cmd |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2294 .ctop.top.bar.rightbut conf -state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2295 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2296 if {$historyindex <= 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2297 .ctop.top.bar.leftbut conf -state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2298 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2299 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2300 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2301 proc goforw {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2302 global history historyindex |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2303 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2304 if {$historyindex < [llength $history]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2305 set cmd [lindex $history $historyindex] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2306 incr historyindex |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2307 eval $cmd |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2308 .ctop.top.bar.leftbut conf -state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2309 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2310 if {$historyindex >= [llength $history]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2311 .ctop.top.bar.rightbut conf -state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2312 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2313 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2314 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2315 proc mergediff {id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2316 global parents diffmergeid diffmergegca mergefilelist diffpindex |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2317 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2318 set diffmergeid $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2319 set diffpindex -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2320 set diffmergegca [findgca $parents($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2321 if {[info exists mergefilelist($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2322 if {$mergefilelist($id) ne {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2323 showmergediff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2324 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2325 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2326 contmergediff {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2327 } |
267 | 2328 } |
2329 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2330 proc findgca {ids} { |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
2331 global env |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2332 set gca {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2333 foreach id $ids { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2334 if {$gca eq {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2335 set gca $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2336 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2337 if {[catch { |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
2338 set gca [exec $env(HG) --config ui.report_untrusted=false debug-merge-base $gca $id] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2339 } err]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2340 return {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2341 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2342 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2343 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2344 return $gca |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2345 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2346 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2347 proc contmergediff {ids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2348 global diffmergeid diffpindex parents nparents diffmergegca |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2349 global treediffs mergefilelist diffids treepending |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2350 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2351 # diff the child against each of the parents, and diff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2352 # each of the parents against the GCA. |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2353 while 1 { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2354 if {[lindex $ids 0] == $diffmergeid && $diffmergegca ne {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2355 set ids [list [lindex $ids 1] $diffmergegca] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2356 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2357 if {[incr diffpindex] >= $nparents($diffmergeid)} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2358 set p [lindex $parents($diffmergeid) $diffpindex] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2359 set ids [list $diffmergeid $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2360 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2361 if {![info exists treediffs($ids)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2362 set diffids $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2363 if {![info exists treepending]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2364 gettreediffs $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2365 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2366 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2367 } |
267 | 2368 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2369 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2370 # If a file in some parent is different from the child and also |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2371 # different from the GCA, then it's interesting. |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2372 # If we don't have a GCA, then a file is interesting if it is |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2373 # different from the child in all the parents. |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2374 if {$diffmergegca ne {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2375 set files {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2376 foreach p $parents($diffmergeid) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2377 set gcadiffs $treediffs([list $p $diffmergegca]) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2378 foreach f $treediffs([list $diffmergeid $p]) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2379 if {[lsearch -exact $files $f] < 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2380 && [lsearch -exact $gcadiffs $f] >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2381 lappend files $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2382 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2383 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2384 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2385 set files [lsort $files] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2386 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2387 set p [lindex $parents($diffmergeid) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2388 set files $treediffs([list $diffmergeid $p]) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2389 for {set i 1} {$i < $nparents($diffmergeid) && $files ne {}} {incr i} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2390 set p [lindex $parents($diffmergeid) $i] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2391 set df $treediffs([list $diffmergeid $p]) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2392 set nf {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2393 foreach f $files { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2394 if {[lsearch -exact $df $f] >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2395 lappend nf $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2396 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2397 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2398 set files $nf |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2399 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2400 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2401 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2402 set mergefilelist($diffmergeid) $files |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2403 if {$files ne {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2404 showmergediff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2405 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2406 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2407 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2408 proc showmergediff {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2409 global cflist diffmergeid mergefilelist parents |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2410 global diffopts diffinhunk currentfile currenthunk filelines |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2411 global diffblocked groupfilelast mergefds groupfilenum grouphunks |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
2412 global env |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2413 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2414 set files $mergefilelist($diffmergeid) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2415 foreach f $files { |
267 | 2416 $cflist insert end $f |
2417 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2418 set env(GIT_DIFF_OPTS) $diffopts |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2419 set flist {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2420 catch {unset currentfile} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2421 catch {unset currenthunk} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2422 catch {unset filelines} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2423 catch {unset groupfilenum} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2424 catch {unset grouphunks} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2425 set groupfilelast -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2426 foreach p $parents($diffmergeid) { |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
2427 set cmd [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree -p $p $diffmergeid] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2428 set cmd [concat $cmd $mergefilelist($diffmergeid)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2429 if {[catch {set f [open $cmd r]} err]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2430 error_popup "Error getting diffs: $err" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2431 foreach f $flist { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2432 catch {close $f} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2433 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2434 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2435 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2436 lappend flist $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2437 set ids [list $diffmergeid $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2438 set mergefds($ids) $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2439 set diffinhunk($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2440 set diffblocked($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2441 fconfigure $f -blocking 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2442 fileevent $f readable [list getmergediffline $f $ids $diffmergeid] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2443 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2444 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2445 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2446 proc getmergediffline {f ids id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2447 global diffmergeid diffinhunk diffoldlines diffnewlines |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2448 global currentfile currenthunk |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2449 global diffoldstart diffnewstart diffoldlno diffnewlno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2450 global diffblocked mergefilelist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2451 global noldlines nnewlines difflcounts filelines |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2452 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2453 set n [gets $f line] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2454 if {$n < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2455 if {![eof $f]} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2456 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2457 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2458 if {!([info exists diffmergeid] && $diffmergeid == $id)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2459 if {$n < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2460 close $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2461 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2462 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2463 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2464 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2465 if {$diffinhunk($ids) != 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2466 set fi $currentfile($ids) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2467 if {$n > 0 && [regexp {^[-+ \\]} $line match]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2468 # continuing an existing hunk |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2469 set line [string range $line 1 end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2470 set p [lindex $ids 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2471 if {$match eq "-" || $match eq " "} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2472 set filelines($p,$fi,$diffoldlno($ids)) $line |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2473 incr diffoldlno($ids) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2474 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2475 if {$match eq "+" || $match eq " "} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2476 set filelines($id,$fi,$diffnewlno($ids)) $line |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2477 incr diffnewlno($ids) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2478 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2479 if {$match eq " "} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2480 if {$diffinhunk($ids) == 2} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2481 lappend difflcounts($ids) \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2482 [list $noldlines($ids) $nnewlines($ids)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2483 set noldlines($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2484 set diffinhunk($ids) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2485 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2486 incr noldlines($ids) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2487 } elseif {$match eq "-" || $match eq "+"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2488 if {$diffinhunk($ids) == 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2489 lappend difflcounts($ids) [list $noldlines($ids)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2490 set noldlines($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2491 set nnewlines($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2492 set diffinhunk($ids) 2 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2493 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2494 if {$match eq "-"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2495 incr noldlines($ids) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2496 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2497 incr nnewlines($ids) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2498 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2499 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2500 # and if it's \ No newline at end of line, then what? |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2501 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2502 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2503 # end of a hunk |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2504 if {$diffinhunk($ids) == 1 && $noldlines($ids) != 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2505 lappend difflcounts($ids) [list $noldlines($ids)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2506 } elseif {$diffinhunk($ids) == 2 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2507 && ($noldlines($ids) != 0 || $nnewlines($ids) != 0)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2508 lappend difflcounts($ids) [list $noldlines($ids) $nnewlines($ids)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2509 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2510 set currenthunk($ids) [list $currentfile($ids) \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2511 $diffoldstart($ids) $diffnewstart($ids) \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2512 $diffoldlno($ids) $diffnewlno($ids) \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2513 $difflcounts($ids)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2514 set diffinhunk($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2515 # -1 = need to block, 0 = unblocked, 1 = is blocked |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2516 set diffblocked($ids) -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2517 processhunks |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2518 if {$diffblocked($ids) == -1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2519 fileevent $f readable {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2520 set diffblocked($ids) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2521 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2522 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2523 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2524 if {$n < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2525 # eof |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2526 if {!$diffblocked($ids)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2527 close $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2528 set currentfile($ids) [llength $mergefilelist($diffmergeid)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2529 set currenthunk($ids) [list $currentfile($ids) 0 0 0 0 {}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2530 processhunks |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2531 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2532 } elseif {[regexp {^diff --git a/(.*) b/} $line match fname]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2533 # start of a new file |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2534 set currentfile($ids) \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2535 [lsearch -exact $mergefilelist($diffmergeid) $fname] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2536 } elseif {[regexp {^@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@(.*)} \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2537 $line match f1l f1c f2l f2c rest]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2538 if {[info exists currentfile($ids)] && $currentfile($ids) >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2539 # start of a new hunk |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2540 if {$f1l == 0 && $f1c == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2541 set f1l 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2542 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2543 if {$f2l == 0 && $f2c == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2544 set f2l 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2545 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2546 set diffinhunk($ids) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2547 set diffoldstart($ids) $f1l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2548 set diffnewstart($ids) $f2l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2549 set diffoldlno($ids) $f1l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2550 set diffnewlno($ids) $f2l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2551 set difflcounts($ids) {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2552 set noldlines($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2553 set nnewlines($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2554 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2555 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2556 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2557 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2558 proc processhunks {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2559 global diffmergeid parents nparents currenthunk |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2560 global mergefilelist diffblocked mergefds |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2561 global grouphunks grouplinestart grouplineend groupfilenum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2562 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2563 set nfiles [llength $mergefilelist($diffmergeid)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2564 while 1 { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2565 set fi $nfiles |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2566 set lno 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2567 # look for the earliest hunk |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2568 foreach p $parents($diffmergeid) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2569 set ids [list $diffmergeid $p] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2570 if {![info exists currenthunk($ids)]} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2571 set i [lindex $currenthunk($ids) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2572 set l [lindex $currenthunk($ids) 2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2573 if {$i < $fi || ($i == $fi && $l < $lno)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2574 set fi $i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2575 set lno $l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2576 set pi $p |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2577 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2578 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2579 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2580 if {$fi < $nfiles} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2581 set ids [list $diffmergeid $pi] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2582 set hunk $currenthunk($ids) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2583 unset currenthunk($ids) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2584 if {$diffblocked($ids) > 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2585 fileevent $mergefds($ids) readable \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2586 [list getmergediffline $mergefds($ids) $ids $diffmergeid] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2587 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2588 set diffblocked($ids) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2589 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2590 if {[info exists groupfilenum] && $groupfilenum == $fi |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2591 && $lno <= $grouplineend} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2592 # add this hunk to the pending group |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2593 lappend grouphunks($pi) $hunk |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2594 set endln [lindex $hunk 4] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2595 if {$endln > $grouplineend} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2596 set grouplineend $endln |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2597 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2598 continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2599 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2600 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2601 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2602 # succeeding stuff doesn't belong in this group, so |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2603 # process the group now |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2604 if {[info exists groupfilenum]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2605 processgroup |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2606 unset groupfilenum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2607 unset grouphunks |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2608 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2609 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2610 if {$fi >= $nfiles} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2611 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2612 # start a new group |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2613 set groupfilenum $fi |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2614 set grouphunks($pi) [list $hunk] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2615 set grouplinestart $lno |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2616 set grouplineend [lindex $hunk 4] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2617 } |
267 | 2618 } |
2619 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2620 proc processgroup {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2621 global groupfilelast groupfilenum difffilestart |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2622 global mergefilelist diffmergeid ctext filelines |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2623 global parents diffmergeid diffoffset |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2624 global grouphunks grouplinestart grouplineend nparents |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2625 global mergemax |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2626 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2627 $ctext conf -state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2628 set id $diffmergeid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2629 set f $groupfilenum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2630 if {$groupfilelast != $f} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2631 $ctext insert end "\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2632 set here [$ctext index "end - 1c"] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2633 set difffilestart($f) $here |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2634 set mark fmark.[expr {$f + 1}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2635 $ctext mark set $mark $here |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2636 $ctext mark gravity $mark left |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2637 set header [lindex $mergefilelist($id) $f] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2638 set l [expr {(78 - [string length $header]) / 2}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2639 set pad [string range "----------------------------------------" 1 $l] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2640 $ctext insert end "$pad $header $pad\n" filesep |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2641 set groupfilelast $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2642 foreach p $parents($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2643 set diffoffset($p) 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2644 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2645 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2646 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2647 $ctext insert end "@@" msep |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2648 set nlines [expr {$grouplineend - $grouplinestart}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2649 set events {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2650 set pnum 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2651 foreach p $parents($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2652 set startline [expr {$grouplinestart + $diffoffset($p)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2653 set ol $startline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2654 set nl $grouplinestart |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2655 if {[info exists grouphunks($p)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2656 foreach h $grouphunks($p) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2657 set l [lindex $h 2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2658 if {$nl < $l} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2659 for {} {$nl < $l} {incr nl} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2660 set filelines($p,$f,$ol) $filelines($id,$f,$nl) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2661 incr ol |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2662 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2663 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2664 foreach chunk [lindex $h 5] { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2665 if {[llength $chunk] == 2} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2666 set olc [lindex $chunk 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2667 set nlc [lindex $chunk 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2668 set nnl [expr {$nl + $nlc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2669 lappend events [list $nl $nnl $pnum $olc $nlc] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2670 incr ol $olc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2671 set nl $nnl |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2672 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2673 incr ol [lindex $chunk 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2674 incr nl [lindex $chunk 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2675 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2676 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2677 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2678 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2679 if {$nl < $grouplineend} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2680 for {} {$nl < $grouplineend} {incr nl} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2681 set filelines($p,$f,$ol) $filelines($id,$f,$nl) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2682 incr ol |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2683 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2684 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2685 set nlines [expr {$ol - $startline}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2686 $ctext insert end " -$startline,$nlines" msep |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2687 incr pnum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2688 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2689 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2690 set nlines [expr {$grouplineend - $grouplinestart}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2691 $ctext insert end " +$grouplinestart,$nlines @@\n" msep |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2692 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2693 set events [lsort -integer -index 0 $events] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2694 set nevents [llength $events] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2695 set nmerge $nparents($diffmergeid) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2696 set l $grouplinestart |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2697 for {set i 0} {$i < $nevents} {set i $j} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2698 set nl [lindex $events $i 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2699 while {$l < $nl} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2700 $ctext insert end " $filelines($id,$f,$l)\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2701 incr l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2702 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2703 set e [lindex $events $i] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2704 set enl [lindex $e 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2705 set j $i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2706 set active {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2707 while 1 { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2708 set pnum [lindex $e 2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2709 set olc [lindex $e 3] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2710 set nlc [lindex $e 4] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2711 if {![info exists delta($pnum)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2712 set delta($pnum) [expr {$olc - $nlc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2713 lappend active $pnum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2714 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2715 incr delta($pnum) [expr {$olc - $nlc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2716 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2717 if {[incr j] >= $nevents} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2718 set e [lindex $events $j] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2719 if {[lindex $e 0] >= $enl} break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2720 if {[lindex $e 1] > $enl} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2721 set enl [lindex $e 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2722 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2723 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2724 set nlc [expr {$enl - $l}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2725 set ncol mresult |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2726 set bestpn -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2727 if {[llength $active] == $nmerge - 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2728 # no diff for one of the parents, i.e. it's identical |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2729 for {set pnum 0} {$pnum < $nmerge} {incr pnum} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2730 if {![info exists delta($pnum)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2731 if {$pnum < $mergemax} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2732 lappend ncol m$pnum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2733 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2734 lappend ncol mmax |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2735 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2736 break |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2737 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2738 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2739 } elseif {[llength $active] == $nmerge} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2740 # all parents are different, see if one is very similar |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2741 set bestsim 30 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2742 for {set pnum 0} {$pnum < $nmerge} {incr pnum} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2743 set sim [similarity $pnum $l $nlc $f \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2744 [lrange $events $i [expr {$j-1}]]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2745 if {$sim > $bestsim} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2746 set bestsim $sim |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2747 set bestpn $pnum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2748 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2749 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2750 if {$bestpn >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2751 lappend ncol m$bestpn |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2752 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2753 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2754 set pnum -1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2755 foreach p $parents($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2756 incr pnum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2757 if {![info exists delta($pnum)] || $pnum == $bestpn} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2758 set olc [expr {$nlc + $delta($pnum)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2759 set ol [expr {$l + $diffoffset($p)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2760 incr diffoffset($p) $delta($pnum) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2761 unset delta($pnum) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2762 for {} {$olc > 0} {incr olc -1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2763 $ctext insert end "-$filelines($p,$f,$ol)\n" m$pnum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2764 incr ol |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2765 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2766 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2767 set endl [expr {$l + $nlc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2768 if {$bestpn >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2769 # show this pretty much as a normal diff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2770 set p [lindex $parents($id) $bestpn] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2771 set ol [expr {$l + $diffoffset($p)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2772 incr diffoffset($p) $delta($bestpn) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2773 unset delta($bestpn) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2774 for {set k $i} {$k < $j} {incr k} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2775 set e [lindex $events $k] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2776 if {[lindex $e 2] != $bestpn} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2777 set nl [lindex $e 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2778 set ol [expr {$ol + $nl - $l}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2779 for {} {$l < $nl} {incr l} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2780 $ctext insert end "+$filelines($id,$f,$l)\n" $ncol |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2781 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2782 set c [lindex $e 3] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2783 for {} {$c > 0} {incr c -1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2784 $ctext insert end "-$filelines($p,$f,$ol)\n" m$bestpn |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2785 incr ol |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2786 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2787 set nl [lindex $e 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2788 for {} {$l < $nl} {incr l} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2789 $ctext insert end "+$filelines($id,$f,$l)\n" mresult |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2790 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2791 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2792 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2793 for {} {$l < $endl} {incr l} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2794 $ctext insert end "+$filelines($id,$f,$l)\n" $ncol |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2795 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2796 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2797 while {$l < $grouplineend} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2798 $ctext insert end " $filelines($id,$f,$l)\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2799 incr l |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2800 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2801 $ctext conf -state disabled |
267 | 2802 } |
2803 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2804 proc similarity {pnum l nlc f events} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2805 global diffmergeid parents diffoffset filelines |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2806 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2807 set id $diffmergeid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2808 set p [lindex $parents($id) $pnum] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2809 set ol [expr {$l + $diffoffset($p)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2810 set endl [expr {$l + $nlc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2811 set same 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2812 set diff 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2813 foreach e $events { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2814 if {[lindex $e 2] != $pnum} continue |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2815 set nl [lindex $e 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2816 set ol [expr {$ol + $nl - $l}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2817 for {} {$l < $nl} {incr l} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2818 incr same [string length $filelines($id,$f,$l)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2819 incr same |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2820 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2821 set oc [lindex $e 3] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2822 for {} {$oc > 0} {incr oc -1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2823 incr diff [string length $filelines($p,$f,$ol)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2824 incr diff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2825 incr ol |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2826 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2827 set nl [lindex $e 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2828 for {} {$l < $nl} {incr l} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2829 incr diff [string length $filelines($id,$f,$l)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2830 incr diff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2831 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2832 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2833 for {} {$l < $endl} {incr l} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2834 incr same [string length $filelines($id,$f,$l)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2835 incr same |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2836 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2837 if {$same == 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2838 return 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2839 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2840 return [expr {200 * $same / (2 * $same + $diff)}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2841 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2842 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2843 proc startdiff {ids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2844 global treediffs diffids treepending diffmergeid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2845 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2846 set diffids $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2847 catch {unset diffmergeid} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2848 if {![info exists treediffs($ids)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2849 if {![info exists treepending]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2850 gettreediffs $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2851 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2852 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2853 addtocflist $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2854 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2855 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2856 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2857 proc addtocflist {ids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2858 global treediffs cflist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2859 foreach f $treediffs($ids) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2860 $cflist insert end $f |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2861 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2862 getblobdiffs $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2863 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2864 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2865 proc gettreediffs {ids} { |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
2866 global treediff parents treepending env |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2867 set treepending $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2868 set treediff {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2869 set id [lindex $ids 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2870 set p [lindex $ids 1] |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
2871 if [catch {set gdtf [open "|{$env(HG)} --config ui.report_untrusted=false debug-diff-tree -r $p $id" r]}] return |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2872 fconfigure $gdtf -blocking 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2873 fileevent $gdtf readable [list gettreediffline $gdtf $ids] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2874 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2875 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2876 proc gettreediffline {gdtf ids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2877 global treediff treediffs treepending diffids diffmergeid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2878 |
267 | 2879 set n [gets $gdtf line] |
2880 if {$n < 0} { | |
2881 if {![eof $gdtf]} return | |
2882 close $gdtf | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2883 set treediffs($ids) $treediff |
267 | 2884 unset treepending |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2885 if {$ids != $diffids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2886 gettreediffs $diffids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2887 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2888 if {[info exists diffmergeid]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2889 contmergediff $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2890 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2891 addtocflist $ids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2892 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2893 } |
267 | 2894 return |
2895 } | |
4741
4a84f7421692
Make hgk handle filenames with spaces (issue49)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4740
diff
changeset
|
2896 set tab1 [expr [string first "\t" $line] + 1] |
4a84f7421692
Make hgk handle filenames with spaces (issue49)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4740
diff
changeset
|
2897 set tab2 [expr [string first "\t" $line $tab1] - 1] |
4a84f7421692
Make hgk handle filenames with spaces (issue49)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4740
diff
changeset
|
2898 set file [string range $line $tab1 $tab2] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2899 lappend treediff $file |
267 | 2900 } |
2901 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2902 proc getblobdiffs {ids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2903 global diffopts blobdifffd diffids env curdifftag curtagstart |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2904 global difffilestart nextupdate diffinhdr treediffs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2905 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2906 set id [lindex $ids 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2907 set p [lindex $ids 1] |
267 | 2908 set env(GIT_DIFF_OPTS) $diffopts |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
2909 set cmd [list | $env(HG) --config ui.report_untrusted=false debug-diff-tree -r -p -C $p $id] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2910 if {[catch {set bdf [open $cmd r]} err]} { |
267 | 2911 puts "error getting diffs: $err" |
2912 return | |
2913 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2914 set diffinhdr 0 |
267 | 2915 fconfigure $bdf -blocking 0 |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2916 set blobdifffd($ids) $bdf |
267 | 2917 set curdifftag Comments |
2918 set curtagstart 0.0 | |
2919 catch {unset difffilestart} | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2920 fileevent $bdf readable [list getblobdiffline $bdf $diffids] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2921 set nextupdate [expr {[clock clicks -milliseconds] + 100}] |
267 | 2922 } |
2923 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2924 proc getblobdiffline {bdf ids} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2925 global diffids blobdifffd ctext curdifftag curtagstart |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2926 global diffnexthead diffnextnote difffilestart |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2927 global nextupdate diffinhdr treediffs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2928 global gaudydiff |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2929 |
267 | 2930 set n [gets $bdf line] |
2931 if {$n < 0} { | |
2932 if {[eof $bdf]} { | |
2933 close $bdf | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2934 if {$ids == $diffids && $bdf == $blobdifffd($ids)} { |
267 | 2935 $ctext tag add $curdifftag $curtagstart end |
2936 } | |
2937 } | |
2938 return | |
2939 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2940 if {$ids != $diffids || $bdf != $blobdifffd($ids)} { |
267 | 2941 return |
2942 } | |
3940
a33ddd20105c
hgk - fix CR issues on windows
"Andrei Vermel <avermel@mail.ru>"
parents:
3093
diff
changeset
|
2943 regsub -all "\r" $line "" line |
267 | 2944 $ctext conf -state normal |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2945 if {[regexp {^diff --git a/(.*) b/(.*)} $line match fname newname]} { |
267 | 2946 # start of a new file |
2947 $ctext insert end "\n" | |
2948 $ctext tag add $curdifftag $curtagstart end | |
2949 set curtagstart [$ctext index "end - 1c"] | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2950 set header $newname |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2951 set here [$ctext index "end - 1c"] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2952 set i [lsearch -exact $treediffs($diffids) $fname] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2953 if {$i >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2954 set difffilestart($i) $here |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2955 incr i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2956 $ctext mark set fmark.$i $here |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2957 $ctext mark gravity fmark.$i left |
267 | 2958 } |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2959 if {$newname != $fname} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2960 set i [lsearch -exact $treediffs($diffids) $newname] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2961 if {$i >= 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2962 set difffilestart($i) $here |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2963 incr i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2964 $ctext mark set fmark.$i $here |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2965 $ctext mark gravity fmark.$i left |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2966 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2967 } |
267 | 2968 set curdifftag "f:$fname" |
2969 $ctext tag delete $curdifftag | |
2970 set l [expr {(78 - [string length $header]) / 2}] | |
2971 set pad [string range "----------------------------------------" 1 $l] | |
2972 $ctext insert end "$pad $header $pad\n" filesep | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2973 set diffinhdr 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2974 } elseif {[regexp {^(---|\+\+\+)} $line]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2975 set diffinhdr 0 |
267 | 2976 } elseif {[regexp {^@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@(.*)} \ |
2977 $line match f1l f1c f2l f2c rest]} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2978 if {$gaudydiff} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2979 $ctext insert end "\t" hunksep |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2980 $ctext insert end " $f1l " d0 " $f2l " d1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2981 $ctext insert end " $rest \n" hunksep |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2982 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2983 $ctext insert end "$line\n" hunksep |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2984 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2985 set diffinhdr 0 |
267 | 2986 } else { |
2987 set x [string range $line 0 0] | |
2988 if {$x == "-" || $x == "+"} { | |
2989 set tag [expr {$x == "+"}] | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2990 if {$gaudydiff} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2991 set line [string range $line 1 end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2992 } |
267 | 2993 $ctext insert end "$line\n" d$tag |
2994 } elseif {$x == " "} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2995 if {$gaudydiff} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2996 set line [string range $line 1 end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2997 } |
267 | 2998 $ctext insert end "$line\n" |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
2999 } elseif {$diffinhdr || $x == "\\"} { |
267 | 3000 # e.g. "\ No newline at end of file" |
3001 $ctext insert end "$line\n" filesep | |
3940
a33ddd20105c
hgk - fix CR issues on windows
"Andrei Vermel <avermel@mail.ru>"
parents:
3093
diff
changeset
|
3002 } elseif {$line != ""} { |
267 | 3003 # Something else we don't recognize |
3004 if {$curdifftag != "Comments"} { | |
3005 $ctext insert end "\n" | |
3006 $ctext tag add $curdifftag $curtagstart end | |
3007 set curtagstart [$ctext index "end - 1c"] | |
3008 set curdifftag Comments | |
3009 } | |
3010 $ctext insert end "$line\n" filesep | |
3011 } | |
3012 } | |
3013 $ctext conf -state disabled | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3014 if {[clock clicks -milliseconds] >= $nextupdate} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3015 incr nextupdate 100 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3016 fileevent $bdf readable {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3017 update |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3018 fileevent $bdf readable "getblobdiffline $bdf {$ids}" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3019 } |
267 | 3020 } |
3021 | |
3022 proc nextfile {} { | |
3023 global difffilestart ctext | |
3024 set here [$ctext index @0,0] | |
3025 for {set i 0} {[info exists difffilestart($i)]} {incr i} { | |
3026 if {[$ctext compare $difffilestart($i) > $here]} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3027 if {![info exists pos] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3028 || [$ctext compare $difffilestart($i) < $pos]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3029 set pos $difffilestart($i) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3030 } |
267 | 3031 } |
3032 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3033 if {[info exists pos]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3034 $ctext yview $pos |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3035 } |
267 | 3036 } |
3037 | |
3038 proc listboxsel {} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3039 global ctext cflist currentid |
267 | 3040 if {![info exists currentid]} return |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3041 set sel [lsort [$cflist curselection]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3042 if {$sel eq {}} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3043 set first [lindex $sel 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3044 catch {$ctext yview fmark.$first} |
267 | 3045 } |
3046 | |
3047 proc setcoords {} { | |
3048 global linespc charspc canvx0 canvy0 mainfont | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3049 global xspc1 xspc2 lthickness |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3050 |
267 | 3051 set linespc [font metrics $mainfont -linespace] |
3052 set charspc [font measure $mainfont "m"] | |
3053 set canvy0 [expr 3 + 0.5 * $linespc] | |
3054 set canvx0 [expr 3 + 0.5 * $linespc] | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3055 set lthickness [expr {int($linespc / 9) + 1}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3056 set xspc1(0) $linespc |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3057 set xspc2 $linespc |
267 | 3058 } |
3059 | |
3060 proc redisplay {} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3061 global stopped redisplaying phase |
267 | 3062 if {$stopped > 1} return |
3063 if {$phase == "getcommits"} return | |
3064 set redisplaying 1 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3065 if {$phase == "drawgraph" || $phase == "incrdraw"} { |
267 | 3066 set stopped 1 |
3067 } else { | |
3068 drawgraph | |
3069 } | |
3070 } | |
3071 | |
3072 proc incrfont {inc} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3073 global mainfont namefont textfont ctext canv phase |
267 | 3074 global stopped entries |
3075 unmarkmatches | |
3076 set mainfont [lreplace $mainfont 1 1 [expr {[lindex $mainfont 1] + $inc}]] | |
3077 set namefont [lreplace $namefont 1 1 [expr {[lindex $namefont 1] + $inc}]] | |
3078 set textfont [lreplace $textfont 1 1 [expr {[lindex $textfont 1] + $inc}]] | |
3079 setcoords | |
3080 $ctext conf -font $textfont | |
3081 $ctext tag conf filesep -font [concat $textfont bold] | |
3082 foreach e $entries { | |
3083 $e conf -font $mainfont | |
3084 } | |
3085 if {$phase == "getcommits"} { | |
3086 $canv itemconf textitems -font $mainfont | |
3087 } | |
3088 redisplay | |
3089 } | |
3090 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3091 proc clearsha1 {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3092 global sha1entry sha1string |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3093 if {[string length $sha1string] == 40} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3094 $sha1entry delete 0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3095 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3096 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3097 |
267 | 3098 proc sha1change {n1 n2 op} { |
3099 global sha1string currentid sha1but | |
3100 if {$sha1string == {} | |
3101 || ([info exists currentid] && $sha1string == $currentid)} { | |
3102 set state disabled | |
3103 } else { | |
3104 set state normal | |
3105 } | |
3106 if {[$sha1but cget -state] == $state} return | |
3107 if {$state == "normal"} { | |
3108 $sha1but conf -state normal -relief raised -text "Goto: " | |
3109 } else { | |
3110 $sha1but conf -state disabled -relief flat -text "SHA1 ID: " | |
3111 } | |
3112 } | |
3113 | |
3114 proc gotocommit {} { | |
3115 global sha1string currentid idline tagids | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3116 global lineid numcommits |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3117 |
267 | 3118 if {$sha1string == {} |
3119 || ([info exists currentid] && $sha1string == $currentid)} return | |
3120 if {[info exists tagids($sha1string)]} { | |
3121 set id $tagids($sha1string) | |
3122 } else { | |
3123 set id [string tolower $sha1string] | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3124 if {[regexp {^[0-9a-f]{4,39}$} $id]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3125 set matches {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3126 for {set l 0} {$l < $numcommits} {incr l} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3127 if {[string match $id* $lineid($l)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3128 lappend matches $lineid($l) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3129 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3130 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3131 if {$matches ne {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3132 if {[llength $matches] > 1} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3133 error_popup "Short SHA1 id $id is ambiguous" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3134 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3135 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3136 set id [lindex $matches 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3137 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3138 } |
267 | 3139 } |
3140 if {[info exists idline($id)]} { | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3141 selectline $idline($id) 1 |
267 | 3142 return |
3143 } | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3144 if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} { |
267 | 3145 set type "SHA1 id" |
3146 } else { | |
3147 set type "Tag" | |
3148 } | |
3149 error_popup "$type $sha1string is not known" | |
3150 } | |
3151 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3152 proc lineenter {x y id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3153 global hoverx hovery hoverid hovertimer |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3154 global commitinfo canv |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3155 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3156 if {![info exists commitinfo($id)]} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3157 set hoverx $x |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3158 set hovery $y |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3159 set hoverid $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3160 if {[info exists hovertimer]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3161 after cancel $hovertimer |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3162 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3163 set hovertimer [after 500 linehover] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3164 $canv delete hover |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3165 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3166 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3167 proc linemotion {x y id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3168 global hoverx hovery hoverid hovertimer |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3169 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3170 if {[info exists hoverid] && $id == $hoverid} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3171 set hoverx $x |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3172 set hovery $y |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3173 if {[info exists hovertimer]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3174 after cancel $hovertimer |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3175 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3176 set hovertimer [after 500 linehover] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3177 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3178 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3179 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3180 proc lineleave {id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3181 global hoverid hovertimer canv |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3182 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3183 if {[info exists hoverid] && $id == $hoverid} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3184 $canv delete hover |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3185 if {[info exists hovertimer]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3186 after cancel $hovertimer |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3187 unset hovertimer |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3188 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3189 unset hoverid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3190 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3191 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3192 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3193 proc linehover {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3194 global hoverx hovery hoverid hovertimer |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3195 global canv linespc lthickness |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3196 global commitinfo mainfont |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3197 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3198 set text [lindex $commitinfo($hoverid) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3199 set ymax [lindex [$canv cget -scrollregion] 3] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3200 if {$ymax == {}} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3201 set yfrac [lindex [$canv yview] 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3202 set x [expr {$hoverx + 2 * $linespc}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3203 set y [expr {$hovery + $yfrac * $ymax - $linespc / 2}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3204 set x0 [expr {$x - 2 * $lthickness}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3205 set y0 [expr {$y - 2 * $lthickness}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3206 set x1 [expr {$x + [font measure $mainfont $text] + 2 * $lthickness}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3207 set y1 [expr {$y + $linespc + 2 * $lthickness}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3208 set t [$canv create rectangle $x0 $y0 $x1 $y1 \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3209 -fill \#ffff80 -outline black -width 1 -tags hover] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3210 $canv raise $t |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3211 set t [$canv create text $x $y -anchor nw -text $text -tags hover] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3212 $canv raise $t |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3213 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3214 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3215 proc clickisonarrow {id y} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3216 global mainline mainlinearrow sidelines lthickness |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3217 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3218 set thresh [expr {2 * $lthickness + 6}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3219 if {[info exists mainline($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3220 if {$mainlinearrow($id) ne "none"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3221 if {abs([lindex $mainline($id) 1] - $y) < $thresh} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3222 return "up" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3223 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3224 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3225 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3226 if {[info exists sidelines($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3227 foreach ls $sidelines($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3228 set coords [lindex $ls 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3229 set arrow [lindex $ls 2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3230 if {$arrow eq "first" || $arrow eq "both"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3231 if {abs([lindex $coords 1] - $y) < $thresh} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3232 return "up" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3233 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3234 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3235 if {$arrow eq "last" || $arrow eq "both"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3236 if {abs([lindex $coords end] - $y) < $thresh} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3237 return "down" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3238 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3239 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3240 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3241 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3242 return {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3243 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3244 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3245 proc arrowjump {id dirn y} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3246 global mainline sidelines canv |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3247 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3248 set yt {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3249 if {$dirn eq "down"} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3250 if {[info exists mainline($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3251 set y1 [lindex $mainline($id) 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3252 if {$y1 > $y} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3253 set yt $y1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3254 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3255 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3256 if {[info exists sidelines($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3257 foreach ls $sidelines($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3258 set y1 [lindex $ls 0 1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3259 if {$y1 > $y && ($yt eq {} || $y1 < $yt)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3260 set yt $y1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3261 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3262 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3263 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3264 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3265 if {[info exists sidelines($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3266 foreach ls $sidelines($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3267 set y1 [lindex $ls 0 end] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3268 if {$y1 < $y && ($yt eq {} || $y1 > $yt)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3269 set yt $y1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3270 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3271 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3272 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3273 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3274 if {$yt eq {}} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3275 set ymax [lindex [$canv cget -scrollregion] 3] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3276 if {$ymax eq {} || $ymax <= 0} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3277 set view [$canv yview] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3278 set yspan [expr {[lindex $view 1] - [lindex $view 0]}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3279 set yfrac [expr {$yt / $ymax - $yspan / 2}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3280 if {$yfrac < 0} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3281 set yfrac 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3282 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3283 $canv yview moveto $yfrac |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3284 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3285 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3286 proc lineclick {x y id isnew} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3287 global ctext commitinfo children cflist canv thickerline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3288 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3289 unmarkmatches |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3290 unselectline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3291 normalline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3292 $canv delete hover |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3293 # draw this line thicker than normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3294 drawlines $id 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3295 set thickerline $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3296 if {$isnew} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3297 set ymax [lindex [$canv cget -scrollregion] 3] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3298 if {$ymax eq {}} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3299 set yfrac [lindex [$canv yview] 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3300 set y [expr {$y + $yfrac * $ymax}] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3301 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3302 set dirn [clickisonarrow $id $y] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3303 if {$dirn ne {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3304 arrowjump $id $dirn $y |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3305 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3306 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3307 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3308 if {$isnew} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3309 addtohistory [list lineclick $x $y $id 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3310 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3311 # fill the details pane with info about this line |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3312 $ctext conf -state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3313 $ctext delete 0.0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3314 $ctext tag conf link -foreground blue -underline 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3315 $ctext tag bind link <Enter> { %W configure -cursor hand2 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3316 $ctext tag bind link <Leave> { %W configure -cursor $curtextcursor } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3317 $ctext insert end "Parent:\t" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3318 $ctext insert end $id [list link link0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3319 $ctext tag bind link0 <1> [list selbyid $id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3320 set info $commitinfo($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3321 $ctext insert end "\n\t[lindex $info 0]\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3322 $ctext insert end "\tAuthor:\t[lindex $info 1]\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3323 $ctext insert end "\tDate:\t[lindex $info 2]\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3324 if {[info exists children($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3325 $ctext insert end "\nChildren:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3326 set i 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3327 foreach child $children($id) { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3328 incr i |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3329 set info $commitinfo($child) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3330 $ctext insert end "\n\t" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3331 $ctext insert end $child [list link link$i] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3332 $ctext tag bind link$i <1> [list selbyid $child] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3333 $ctext insert end "\n\t[lindex $info 0]" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3334 $ctext insert end "\n\tAuthor:\t[lindex $info 1]" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3335 $ctext insert end "\n\tDate:\t[lindex $info 2]\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3336 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3337 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3338 $ctext conf -state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3339 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3340 $cflist delete 0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3341 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3342 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3343 proc normalline {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3344 global thickerline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3345 if {[info exists thickerline]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3346 drawlines $thickerline 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3347 unset thickerline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3348 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3349 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3350 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3351 proc selbyid {id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3352 global idline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3353 if {[info exists idline($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3354 selectline $idline($id) 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3355 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3356 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3357 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3358 proc mstime {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3359 global startmstime |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3360 if {![info exists startmstime]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3361 set startmstime [clock clicks -milliseconds] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3362 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3363 return [format "%.3f" [expr {([clock click -milliseconds] - $startmstime) / 1000.0}]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3364 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3365 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3366 proc rowmenu {x y id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3367 global rowctxmenu idline selectedline rowmenuid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3368 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3369 if {![info exists selectedline] || $idline($id) eq $selectedline} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3370 set state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3371 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3372 set state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3373 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3374 $rowctxmenu entryconfigure 0 -state $state |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3375 $rowctxmenu entryconfigure 1 -state $state |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3376 $rowctxmenu entryconfigure 2 -state $state |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3377 set rowmenuid $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3378 tk_popup $rowctxmenu $x $y |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3379 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3380 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3381 proc diffvssel {dirn} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3382 global rowmenuid selectedline lineid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3383 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3384 if {![info exists selectedline]} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3385 if {$dirn} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3386 set oldid $lineid($selectedline) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3387 set newid $rowmenuid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3388 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3389 set oldid $rowmenuid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3390 set newid $lineid($selectedline) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3391 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3392 addtohistory [list doseldiff $oldid $newid] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3393 doseldiff $oldid $newid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3394 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3395 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3396 proc doseldiff {oldid newid} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3397 global ctext cflist |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3398 global commitinfo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3399 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3400 $ctext conf -state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3401 $ctext delete 0.0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3402 $ctext mark set fmark.0 0.0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3403 $ctext mark gravity fmark.0 left |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3404 $cflist delete 0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3405 $cflist insert end "Top" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3406 $ctext insert end "From " |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3407 $ctext tag conf link -foreground blue -underline 1 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3408 $ctext tag bind link <Enter> { %W configure -cursor hand2 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3409 $ctext tag bind link <Leave> { %W configure -cursor $curtextcursor } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3410 $ctext tag bind link0 <1> [list selbyid $oldid] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3411 $ctext insert end $oldid [list link link0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3412 $ctext insert end "\n " |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3413 $ctext insert end [lindex $commitinfo($oldid) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3414 $ctext insert end "\n\nTo " |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3415 $ctext tag bind link1 <1> [list selbyid $newid] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3416 $ctext insert end $newid [list link link1] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3417 $ctext insert end "\n " |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3418 $ctext insert end [lindex $commitinfo($newid) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3419 $ctext insert end "\n" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3420 $ctext conf -state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3421 $ctext tag delete Comments |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3422 $ctext tag remove found 1.0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3423 startdiff [list $newid $oldid] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3424 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3425 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3426 proc mkpatch {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3427 global rowmenuid currentid commitinfo patchtop patchnum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3428 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3429 if {![info exists currentid]} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3430 set oldid $currentid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3431 set oldhead [lindex $commitinfo($oldid) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3432 set newid $rowmenuid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3433 set newhead [lindex $commitinfo($newid) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3434 set top .patch |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3435 set patchtop $top |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3436 catch {destroy $top} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3437 toplevel $top |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3438 label $top.title -text "Generate patch" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3439 grid $top.title - -pady 10 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3440 label $top.from -text "From:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3441 entry $top.fromsha1 -width 40 -relief flat |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3442 $top.fromsha1 insert 0 $oldid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3443 $top.fromsha1 conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3444 grid $top.from $top.fromsha1 -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3445 entry $top.fromhead -width 60 -relief flat |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3446 $top.fromhead insert 0 $oldhead |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3447 $top.fromhead conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3448 grid x $top.fromhead -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3449 label $top.to -text "To:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3450 entry $top.tosha1 -width 40 -relief flat |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3451 $top.tosha1 insert 0 $newid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3452 $top.tosha1 conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3453 grid $top.to $top.tosha1 -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3454 entry $top.tohead -width 60 -relief flat |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3455 $top.tohead insert 0 $newhead |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3456 $top.tohead conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3457 grid x $top.tohead -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3458 button $top.rev -text "Reverse" -command mkpatchrev -padx 5 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3459 grid $top.rev x -pady 10 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3460 label $top.flab -text "Output file:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3461 entry $top.fname -width 60 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3462 $top.fname insert 0 [file normalize "patch$patchnum.patch"] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3463 incr patchnum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3464 grid $top.flab $top.fname -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3465 frame $top.buts |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3466 button $top.buts.gen -text "Generate" -command mkpatchgo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3467 button $top.buts.can -text "Cancel" -command mkpatchcan |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3468 grid $top.buts.gen $top.buts.can |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3469 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3470 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3471 grid $top.buts - -pady 10 -sticky ew |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3472 focus $top.fname |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3473 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3474 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3475 proc mkpatchrev {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3476 global patchtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3477 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3478 set oldid [$patchtop.fromsha1 get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3479 set oldhead [$patchtop.fromhead get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3480 set newid [$patchtop.tosha1 get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3481 set newhead [$patchtop.tohead get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3482 foreach e [list fromsha1 fromhead tosha1 tohead] \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3483 v [list $newid $newhead $oldid $oldhead] { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3484 $patchtop.$e conf -state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3485 $patchtop.$e delete 0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3486 $patchtop.$e insert 0 $v |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3487 $patchtop.$e conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3488 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3489 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3490 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3491 proc mkpatchgo {} { |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
3492 global patchtop env |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3493 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3494 set oldid [$patchtop.fromsha1 get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3495 set newid [$patchtop.tosha1 get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3496 set fname [$patchtop.fname get] |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
3497 if {[catch {exec $env(HG) --config ui.report_untrusted=false debug-diff-tree -p $oldid $newid >$fname &} err]} { |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3498 error_popup "Error creating patch: $err" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3499 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3500 catch {destroy $patchtop} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3501 unset patchtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3502 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3503 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3504 proc mkpatchcan {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3505 global patchtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3506 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3507 catch {destroy $patchtop} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3508 unset patchtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3509 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3510 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3511 proc mktag {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3512 global rowmenuid mktagtop commitinfo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3513 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3514 set top .maketag |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3515 set mktagtop $top |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3516 catch {destroy $top} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3517 toplevel $top |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3518 label $top.title -text "Create tag" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3519 grid $top.title - -pady 10 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3520 label $top.id -text "ID:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3521 entry $top.sha1 -width 40 -relief flat |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3522 $top.sha1 insert 0 $rowmenuid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3523 $top.sha1 conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3524 grid $top.id $top.sha1 -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3525 entry $top.head -width 60 -relief flat |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3526 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3527 $top.head conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3528 grid x $top.head -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3529 label $top.tlab -text "Tag name:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3530 entry $top.tag -width 60 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3531 grid $top.tlab $top.tag -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3532 frame $top.buts |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3533 button $top.buts.gen -text "Create" -command mktaggo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3534 button $top.buts.can -text "Cancel" -command mktagcan |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3535 grid $top.buts.gen $top.buts.can |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3536 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3537 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3538 grid $top.buts - -pady 10 -sticky ew |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3539 focus $top.tag |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3540 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3541 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3542 proc domktag {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3543 global mktagtop env tagids idtags |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3544 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3545 set id [$mktagtop.sha1 get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3546 set tag [$mktagtop.tag get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3547 if {$tag == {}} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3548 error_popup "No tag name specified" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3549 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3550 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3551 if {[info exists tagids($tag)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3552 error_popup "Tag \"$tag\" already exists" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3553 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3554 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3555 if {[catch { |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
3556 set out [exec $env(HG) --config ui.report_untrusted=false tag -r $id $tag] |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3557 } err]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3558 error_popup "Error creating tag: $err" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3559 return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3560 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3561 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3562 set tagids($tag) $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3563 lappend idtags($id) $tag |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3564 redrawtags $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3565 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3566 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3567 proc redrawtags {id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3568 global canv linehtag idline idpos selectedline |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3569 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3570 if {![info exists idline($id)]} return |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3571 $canv delete tag.$id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3572 set xt [eval drawtags $id $idpos($id)] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3573 $canv coords $linehtag($idline($id)) $xt [lindex $idpos($id) 2] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3574 if {[info exists selectedline] && $selectedline == $idline($id)} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3575 selectline $selectedline 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3576 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3577 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3578 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3579 proc mktagcan {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3580 global mktagtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3581 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3582 catch {destroy $mktagtop} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3583 unset mktagtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3584 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3585 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3586 proc mktaggo {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3587 domktag |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3588 mktagcan |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3589 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3590 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3591 proc writecommit {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3592 global rowmenuid wrcomtop commitinfo wrcomcmd |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3593 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3594 set top .writecommit |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3595 set wrcomtop $top |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3596 catch {destroy $top} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3597 toplevel $top |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3598 label $top.title -text "Write commit to file" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3599 grid $top.title - -pady 10 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3600 label $top.id -text "ID:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3601 entry $top.sha1 -width 40 -relief flat |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3602 $top.sha1 insert 0 $rowmenuid |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3603 $top.sha1 conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3604 grid $top.id $top.sha1 -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3605 entry $top.head -width 60 -relief flat |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3606 $top.head insert 0 [lindex $commitinfo($rowmenuid) 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3607 $top.head conf -state readonly |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3608 grid x $top.head -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3609 label $top.clab -text "Command:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3610 entry $top.cmd -width 60 -textvariable wrcomcmd |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3611 grid $top.clab $top.cmd -sticky w -pady 10 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3612 label $top.flab -text "Output file:" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3613 entry $top.fname -width 60 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3614 $top.fname insert 0 [file normalize "commit-[string range $rowmenuid 0 6]"] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3615 grid $top.flab $top.fname -sticky w |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3616 frame $top.buts |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3617 button $top.buts.gen -text "Write" -command wrcomgo |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3618 button $top.buts.can -text "Cancel" -command wrcomcan |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3619 grid $top.buts.gen $top.buts.can |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3620 grid columnconfigure $top.buts 0 -weight 1 -uniform a |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3621 grid columnconfigure $top.buts 1 -weight 1 -uniform a |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3622 grid $top.buts - -pady 10 -sticky ew |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3623 focus $top.fname |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3624 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3625 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3626 proc wrcomgo {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3627 global wrcomtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3628 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3629 set id [$wrcomtop.sha1 get] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3630 set cmd "echo $id | [$wrcomtop.cmd get]" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3631 set fname [$wrcomtop.fname get] |
4688
39001f4b7d99
hgk: Use $HG instead of hg (see 849f011dbf79)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4502
diff
changeset
|
3632 if {[catch {exec sh -c $cmd > $fname &} err]} { |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3633 error_popup "Error writing commit: $err" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3634 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3635 catch {destroy $wrcomtop} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3636 unset wrcomtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3637 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3638 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3639 proc wrcomcan {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3640 global wrcomtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3641 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3642 catch {destroy $wrcomtop} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3643 unset wrcomtop |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3644 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3645 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3646 proc listrefs {id} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3647 global idtags idheads idotherrefs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3648 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3649 set x {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3650 if {[info exists idtags($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3651 set x $idtags($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3652 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3653 set y {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3654 if {[info exists idheads($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3655 set y $idheads($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3656 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3657 set z {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3658 if {[info exists idotherrefs($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3659 set z $idotherrefs($id) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3660 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3661 return [list $x $y $z] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3662 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3663 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3664 proc rereadrefs {} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3665 global idtags idheads idotherrefs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3666 global tagids headids otherrefids |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3667 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3668 set refids [concat [array names idtags] \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3669 [array names idheads] [array names idotherrefs]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3670 foreach id $refids { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3671 if {![info exists ref($id)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3672 set ref($id) [listrefs $id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3673 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3674 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3675 foreach v {tagids idtags headids idheads otherrefids idotherrefs} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3676 catch {unset $v} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3677 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3678 readrefs |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3679 set refids [lsort -unique [concat $refids [array names idtags] \ |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3680 [array names idheads] [array names idotherrefs]]] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3681 foreach id $refids { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3682 set v [listrefs $id] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3683 if {![info exists ref($id)] || $ref($id) != $v} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3684 redrawtags $id |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3685 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3686 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3687 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3688 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3689 proc showtag {tag isnew} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3690 global ctext cflist tagcontents tagids linknum |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3691 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3692 if {$isnew} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3693 addtohistory [list showtag $tag 0] |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3694 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3695 $ctext conf -state normal |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3696 $ctext delete 0.0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3697 set linknum 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3698 if {[info exists tagcontents($tag)]} { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3699 set text $tagcontents($tag) |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3700 } else { |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3701 set text "Tag: $tag\nId: $tagids($tag)" |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3702 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3703 appendwithlinks $text |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3704 $ctext conf -state disabled |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3705 $cflist delete 0 end |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3706 } |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3707 |
267 | 3708 proc doquit {} { |
3709 global stopped | |
3710 set stopped 100 | |
3711 destroy . | |
3712 } | |
3713 | |
3714 # defaults... | |
3715 set datemode 0 | |
3716 set boldnames 0 | |
3717 set diffopts "-U 5 -p" | |
4740
e1d1b22bab57
Use "--config ui.report_untrusted=false" for hg calls in hgk, fixes issue523.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4688
diff
changeset
|
3718 set wrcomcmd "\"\$HG\" --config ui.report_untrusted=false debug-diff-tree --stdin -p --pretty" |
267 | 3719 |
3720 set mainfont {Helvetica 9} | |
3721 set textfont {Courier 9} | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3722 set findmergefiles 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3723 set gaudydiff 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3724 set maxgraphpct 50 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3725 set maxwidth 16 |
267 | 3726 |
3727 set colors {green red blue magenta darkgrey brown orange} | |
3728 | |
3729 catch {source ~/.gitk} | |
3730 | |
3731 set namefont $mainfont | |
3732 if {$boldnames} { | |
3733 lappend namefont bold | |
3734 } | |
3735 | |
3736 set revtreeargs {} | |
3737 foreach arg $argv { | |
3738 switch -regexp -- $arg { | |
3739 "^$" { } | |
3740 "^-b" { set boldnames 1 } | |
3741 "^-d" { set datemode 1 } | |
3742 default { | |
3743 lappend revtreeargs $arg | |
3744 } | |
3745 } | |
3746 } | |
3747 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3748 set history {} |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3749 set historyindex 0 |
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3750 |
267 | 3751 set stopped 0 |
3752 set redisplaying 0 | |
3753 set stuffsaved 0 | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3754 set patchnum 0 |
267 | 3755 setcoords |
3756 makewindow | |
3757 readrefs | |
1240
cc756ffd4d04
Convert hgk to use the hgit extension, and upate to the latest gitk
mason@suse.com
parents:
283
diff
changeset
|
3758 getcommits $revtreeargs |