@matheusbsbs / matheus-bagliano / commits / e244588eb6
Fork 0

gitk: replace tabs with spaces

The source code is a mix of tabs and spaces. The indentation style currently is four spaces per indent level but uses tabs every other level (at eight spaces). Fix this inconsistent spacing and tabbing by just using a space-indent for everything. This was done mechanically by running: $ expand -i gitk >gitk.new $ mv gitk.new gitk This patch should be empty with `--ignore-all-space`. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Denton Liu committed Sep 10, 2020 at 21:36 UTC e244588eb6ceef86a6a183b3bb032960e26033bb
1 file changed +5310 -5310
gitk
+5310 -5310
@@ -11,14 +11,14 @@ package require Tk
11
12 proc hasworktree {} {
13 return [expr {[exec git rev-parse --is-bare-repository] == "false" &&
14 - [exec git rev-parse --is-inside-git-dir] == "false"}]
14 + [exec git rev-parse --is-inside-git-dir] == "false"}]
15 }
16
17 proc reponame {} {
18 global gitdir
19 set n [file normalize $gitdir]
20 if {[string match "*/.git" $n]} {
21 - set n [string range $n 0 end-5]
21 + set n [string range $n 0 end-5]
22 }
23 return [file tail $n]
24 }
@@ -26,7 +26,7 @@ proc reponame {} {
26 proc gitworktree {} {
27 variable _gitworktree
28 if {[info exists _gitworktree]} {
29 - return $_gitworktree
29 + return $_gitworktree
30 }
31 # v1.7.0 introduced --show-toplevel to return the canonical work-tree
32 if {[catch {set _gitworktree [exec git rev-parse --show-toplevel]}]} {
@@ -34,9 +34,9 @@ proc gitworktree {} {
34 # cdup to obtain a relative path to the top of the worktree. If
35 # run from the top, the ./ prefix ensures normalize expands pwd.
36 if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
37 - if {[catch {set _gitworktree [exec git config --get core.worktree]}]} {
38 - set _gitworktree [file normalize ./[exec git rev-parse --show-cdup]]
39 - }
37 + if {[catch {set _gitworktree [exec git config --get core.worktree]}]} {
38 + set _gitworktree [file normalize ./[exec git rev-parse --show-cdup]]
39 + }
40 }
41 }
42 return $_gitworktree
@@ -53,7 +53,7 @@ proc run args {
53 set script $args
54 if {[info exists isonrunq($script)]} return
55 if {$runq eq {} && ![info exists currunq]} {
56 - after idle dorunq
56 + after idle dorunq
57 }
58 lappend runq [list {} $script]
59 set isonrunq($script) 1
@@ -68,7 +68,7 @@ proc filereadable {fd script} {
68
69 fileevent $fd readable {}
70 if {$runq eq {} && ![info exists currunq]} {
71 - after idle dorunq
71 + after idle dorunq
72 }
73 lappend runq [list $fd $script]
74 }
@@ -77,11 +77,11 @@ proc nukefile {fd} {
77 global runq
78
79 for {set i 0} {$i < [llength $runq]} {} {
80 - if {[lindex $runq $i 0] eq $fd} {
81 - set runq [lreplace $runq $i $i]
82 - } else {
83 - incr i
84 - }
80 + if {[lindex $runq $i 0] eq $fd} {
81 + set runq [lreplace $runq $i $i]
82 + } else {
83 + incr i
84 + }
85 }
86 }
87
@@ -91,30 +91,30 @@ proc dorunq {} {
91 set tstart [clock clicks -milliseconds]
92 set t0 $tstart
93 while {[llength $runq] > 0} {
94 - set fd [lindex $runq 0 0]
95 - set script [lindex $runq 0 1]
96 - set currunq [lindex $runq 0]
97 - set runq [lrange $runq 1 end]
98 - set repeat [eval $script]
99 - unset currunq
100 - set t1 [clock clicks -milliseconds]
101 - set t [expr {$t1 - $t0}]
102 - if {$repeat ne {} && $repeat} {
103 - if {$fd eq {} || $repeat == 2} {
104 - # script returns 1 if it wants to be readded
105 - # file readers return 2 if they could do more straight away
106 - lappend runq [list $fd $script]
107 - } else {
108 - fileevent $fd readable [list filereadable $fd $script]
109 - }
110 - } elseif {$fd eq {}} {
111 - unset isonrunq($script)
112 - }
113 - set t0 $t1
114 - if {$t1 - $tstart >= 80} break
94 + set fd [lindex $runq 0 0]
95 + set script [lindex $runq 0 1]
96 + set currunq [lindex $runq 0]
97 + set runq [lrange $runq 1 end]
98 + set repeat [eval $script]
99 + unset currunq
100 + set t1 [clock clicks -milliseconds]
101 + set t [expr {$t1 - $t0}]
102 + if {$repeat ne {} && $repeat} {
103 + if {$fd eq {} || $repeat == 2} {
104 + # script returns 1 if it wants to be readded
105 + # file readers return 2 if they could do more straight away
106 + lappend runq [list $fd $script]
107 + } else {
108 + fileevent $fd readable [list filereadable $fd $script]
109 + }
110 + } elseif {$fd eq {}} {
111 + unset isonrunq($script)
112 + }
113 + set t0 $t1
114 + if {$t1 - $tstart >= 80} break
115 }
116 if {$runq ne {}} {
117 - after idle dorunq
117 + after idle dorunq
118 }
119 }
120
@@ -134,20 +134,20 @@ proc unmerged_files {files} {
134 set mlist {}
135 set nr_unmerged 0
136 if {[catch {
137 - set fd [open "| git ls-files -u" r]
137 + set fd [open "| git ls-files -u" r]
138 } err]} {
139 - show_error {} . "[mc "Couldn't get list of unmerged files:"] $err"
140 - exit 1
139 + show_error {} . "[mc "Couldn't get list of unmerged files:"] $err"
140 + exit 1
141 }
142 while {[gets $fd line] >= 0} {
143 - set i [string first "\t" $line]
144 - if {$i < 0} continue
145 - set fname [string range $line [expr {$i+1}] end]
146 - if {[lsearch -exact $mlist $fname] >= 0} continue
147 - incr nr_unmerged
148 - if {$files eq {} || [path_filter $files $fname]} {
149 - lappend mlist $fname
150 - }
143 + set i [string first "\t" $line]
144 + if {$i < 0} continue
145 + set fname [string range $line [expr {$i+1}] end]
146 + if {[lsearch -exact $mlist $fname] >= 0} continue
147 + incr nr_unmerged
148 + if {$files eq {} || [path_filter $files $fname]} {
149 + lappend mlist $fname
150 + }
151 }
152 catch {close $fd}
153 return $mlist
@@ -170,115 +170,115 @@ proc parseviewargs {n arglist} {
170 set filtered 0
171 set i -1
172 foreach arg $arglist {
173 - incr i
174 - if {$nextisval} {
175 - lappend glflags $arg
176 - set nextisval 0
177 - continue
178 - }
179 - switch -glob -- $arg {
180 - "-d" -
181 - "--date-order" {
182 - set vdatemode($n) 1
183 - # remove from origargs in case we hit an unknown option
184 - set origargs [lreplace $origargs $i $i]
185 - incr i -1
186 - }
187 - "-[puabwcrRBMC]" -
188 - "--no-renames" - "--full-index" - "--binary" - "--abbrev=*" -
189 - "--find-copies-harder" - "-l*" - "--ext-diff" - "--no-ext-diff" -
190 - "--src-prefix=*" - "--dst-prefix=*" - "--no-prefix" -
191 - "-O*" - "--text" - "--full-diff" - "--ignore-space-at-eol" -
192 - "--ignore-space-change" - "-U*" - "--unified=*" {
193 - # These request or affect diff output, which we don't want.
194 - # Some could be used to set our defaults for diff display.
195 - lappend diffargs $arg
196 - }
197 - "--raw" - "--patch-with-raw" - "--patch-with-stat" -
198 - "--name-only" - "--name-status" - "--color" -
199 - "--log-size" - "--pretty=*" - "--decorate" - "--abbrev-commit" -
200 - "--cc" - "-z" - "--header" - "--parents" - "--boundary" -
201 - "--no-color" - "-g" - "--walk-reflogs" - "--no-walk" -
202 - "--timestamp" - "relative-date" - "--date=*" - "--stdin" -
203 - "--objects" - "--objects-edge" - "--reverse" {
204 - # These cause our parsing of git log's output to fail, or else
205 - # they're options we want to set ourselves, so ignore them.
206 - }
207 - "--color-words*" - "--word-diff=color" {
208 - # These trigger a word diff in the console interface,
209 - # so help the user by enabling our own support
210 - if {[package vcompare $git_version "1.7.2"] >= 0} {
211 - set worddiff [mc "Color words"]
212 - }
213 - }
214 - "--word-diff*" {
215 - if {[package vcompare $git_version "1.7.2"] >= 0} {
216 - set worddiff [mc "Markup words"]
217 - }
218 - }
219 - "--stat=*" - "--numstat" - "--shortstat" - "--summary" -
220 - "--check" - "--exit-code" - "--quiet" - "--topo-order" -
221 - "--full-history" - "--dense" - "--sparse" -
222 - "--follow" - "--left-right" - "--encoding=*" {
223 - # These are harmless, and some are even useful
224 - lappend glflags $arg
225 - }
226 - "--diff-filter=*" - "--no-merges" - "--unpacked" -
227 - "--max-count=*" - "--skip=*" - "--since=*" - "--after=*" -
228 - "--until=*" - "--before=*" - "--max-age=*" - "--min-age=*" -
229 - "--author=*" - "--committer=*" - "--grep=*" - "-[iE]" -
230 - "--remove-empty" - "--first-parent" - "--cherry-pick" -
231 - "-S*" - "-G*" - "--pickaxe-all" - "--pickaxe-regex" -
232 - "--simplify-by-decoration" {
233 - # These mean that we get a subset of the commits
234 - set filtered 1
235 - lappend glflags $arg
236 - }
237 - "-L*" {
238 - # Line-log with 'stuck' argument (unstuck form is
239 - # not supported)
240 - set filtered 1
241 - set vinlinediff($n) 1
242 - set allknown 0
243 - lappend glflags $arg
244 - }
245 - "-n" {
246 - # This appears to be the only one that has a value as a
247 - # separate word following it
248 - set filtered 1
249 - set nextisval 1
250 - lappend glflags $arg
251 - }
252 - "--not" - "--all" {
253 - lappend revargs $arg
254 - }
255 - "--merge" {
256 - set vmergeonly($n) 1
257 - # git rev-parse doesn't understand --merge
258 - lappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD
259 - }
260 - "--no-replace-objects" {
261 - set env(GIT_NO_REPLACE_OBJECTS) "1"
262 - }
263 - "-*" {
264 - # Other flag arguments including -<n>
265 - if {[string is digit -strict [string range $arg 1 end]]} {
266 - set filtered 1
267 - } else {
268 - # a flag argument that we don't recognize;
269 - # that means we can't optimize
270 - set allknown 0
271 - }
272 - lappend glflags $arg
273 - }
274 - default {
275 - # Non-flag arguments specify commits or ranges of commits
276 - if {[string match "*...*" $arg]} {
277 - lappend revargs --gitk-symmetric-diff-marker
278 - }
279 - lappend revargs $arg
280 - }
281 - }
173 + incr i
174 + if {$nextisval} {
175 + lappend glflags $arg
176 + set nextisval 0
177 + continue
178 + }
179 + switch -glob -- $arg {
180 + "-d" -
181 + "--date-order" {
182 + set vdatemode($n) 1
183 + # remove from origargs in case we hit an unknown option
184 + set origargs [lreplace $origargs $i $i]
185 + incr i -1
186 + }
187 + "-[puabwcrRBMC]" -
188 + "--no-renames" - "--full-index" - "--binary" - "--abbrev=*" -
189 + "--find-copies-harder" - "-l*" - "--ext-diff" - "--no-ext-diff" -
190 + "--src-prefix=*" - "--dst-prefix=*" - "--no-prefix" -
191 + "-O*" - "--text" - "--full-diff" - "--ignore-space-at-eol" -
192 + "--ignore-space-change" - "-U*" - "--unified=*" {
193 + # These request or affect diff output, which we don't want.
194 + # Some could be used to set our defaults for diff display.
195 + lappend diffargs $arg
196 + }
197 + "--raw" - "--patch-with-raw" - "--patch-with-stat" -
198 + "--name-only" - "--name-status" - "--color" -
199 + "--log-size" - "--pretty=*" - "--decorate" - "--abbrev-commit" -
200 + "--cc" - "-z" - "--header" - "--parents" - "--boundary" -
201 + "--no-color" - "-g" - "--walk-reflogs" - "--no-walk" -
202 + "--timestamp" - "relative-date" - "--date=*" - "--stdin" -
203 + "--objects" - "--objects-edge" - "--reverse" {
204 + # These cause our parsing of git log's output to fail, or else
205 + # they're options we want to set ourselves, so ignore them.
206 + }
207 + "--color-words*" - "--word-diff=color" {
208 + # These trigger a word diff in the console interface,
209 + # so help the user by enabling our own support
210 + if {[package vcompare $git_version "1.7.2"] >= 0} {
211 + set worddiff [mc "Color words"]
212 + }
213 + }
214 + "--word-diff*" {
215 + if {[package vcompare $git_version "1.7.2"] >= 0} {
216 + set worddiff [mc "Markup words"]
217 + }
218 + }
219 + "--stat=*" - "--numstat" - "--shortstat" - "--summary" -
220 + "--check" - "--exit-code" - "--quiet" - "--topo-order" -
221 + "--full-history" - "--dense" - "--sparse" -
222 + "--follow" - "--left-right" - "--encoding=*" {
223 + # These are harmless, and some are even useful
224 + lappend glflags $arg
225 + }
226 + "--diff-filter=*" - "--no-merges" - "--unpacked" -
227 + "--max-count=*" - "--skip=*" - "--since=*" - "--after=*" -
228 + "--until=*" - "--before=*" - "--max-age=*" - "--min-age=*" -
229 + "--author=*" - "--committer=*" - "--grep=*" - "-[iE]" -
230 + "--remove-empty" - "--first-parent" - "--cherry-pick" -
231 + "-S*" - "-G*" - "--pickaxe-all" - "--pickaxe-regex" -
232 + "--simplify-by-decoration" {
233 + # These mean that we get a subset of the commits
234 + set filtered 1
235 + lappend glflags $arg
236 + }
237 + "-L*" {
238 + # Line-log with 'stuck' argument (unstuck form is
239 + # not supported)
240 + set filtered 1
241 + set vinlinediff($n) 1
242 + set allknown 0
243 + lappend glflags $arg
244 + }
245 + "-n" {
246 + # This appears to be the only one that has a value as a
247 + # separate word following it
248 + set filtered 1
249 + set nextisval 1
250 + lappend glflags $arg
251 + }
252 + "--not" - "--all" {
253 + lappend revargs $arg
254 + }
255 + "--merge" {
256 + set vmergeonly($n) 1
257 + # git rev-parse doesn't understand --merge
258 + lappend revargs --gitk-symmetric-diff-marker MERGE_HEAD...HEAD
259 + }
260 + "--no-replace-objects" {
261 + set env(GIT_NO_REPLACE_OBJECTS) "1"
262 + }
263 + "-*" {
264 + # Other flag arguments including -<n>
265 + if {[string is digit -strict [string range $arg 1 end]]} {
266 + set filtered 1
267 + } else {
268 + # a flag argument that we don't recognize;
269 + # that means we can't optimize
270 + set allknown 0
271 + }
272 + lappend glflags $arg
273 + }
274 + default {
275 + # Non-flag arguments specify commits or ranges of commits
276 + if {[string match "*...*" $arg]} {
277 + lappend revargs --gitk-symmetric-diff-marker
278 + }
279 + lappend revargs $arg
280 + }
281 + }
282 }
283 set vdflags($n) $diffargs
284 set vflags($n) $glflags
@@ -292,61 +292,61 @@ proc parseviewrevs {view revs} {
292 global vposids vnegids
293
294 if {$revs eq {}} {
295 - set revs HEAD
295 + set revs HEAD
296 } elseif {[lsearch -exact $revs --all] >= 0} {
297 - lappend revs HEAD
297 + lappend revs HEAD
298 }
299 if {[catch {set ids [eval exec git rev-parse $revs]} err]} {
300 - # we get stdout followed by stderr in $err
301 - # for an unknown rev, git rev-parse echoes it and then errors out
302 - set errlines [split $err "\n"]
303 - set badrev {}
304 - for {set l 0} {$l < [llength $errlines]} {incr l} {
305 - set line [lindex $errlines $l]
306 - if {!([string length $line] == 40 && [string is xdigit $line])} {
307 - if {[string match "fatal:*" $line]} {
308 - if {[string match "fatal: ambiguous argument*" $line]
309 - && $badrev ne {}} {
310 - if {[llength $badrev] == 1} {
311 - set err "unknown revision $badrev"
312 - } else {
313 - set err "unknown revisions: [join $badrev ", "]"
314 - }
315 - } else {
316 - set err [join [lrange $errlines $l end] "\n"]
317 - }
318 - break
319 - }
320 - lappend badrev $line
321 - }
322 - }
323 - error_popup "[mc "Error parsing revisions:"] $err"
324 - return {}
300 + # we get stdout followed by stderr in $err
301 + # for an unknown rev, git rev-parse echoes it and then errors out
302 + set errlines [split $err "\n"]
303 + set badrev {}
304 + for {set l 0} {$l < [llength $errlines]} {incr l} {
305 + set line [lindex $errlines $l]
306 + if {!([string length $line] == 40 && [string is xdigit $line])} {
307 + if {[string match "fatal:*" $line]} {
308 + if {[string match "fatal: ambiguous argument*" $line]
309 + && $badrev ne {}} {
310 + if {[llength $badrev] == 1} {
311 + set err "unknown revision $badrev"
312 + } else {
313 + set err "unknown revisions: [join $badrev ", "]"
314 + }
315 + } else {
316 + set err [join [lrange $errlines $l end] "\n"]
317 + }
318 + break
319 + }
320 + lappend badrev $line
321 + }
322 + }
323 + error_popup "[mc "Error parsing revisions:"] $err"
324 + return {}
325 }
326 set ret {}
327 set pos {}
328 set neg {}
329 set sdm 0
330 foreach id [split $ids "\n"] {
331 - if {$id eq "--gitk-symmetric-diff-marker"} {
332 - set sdm 4
333 - } elseif {[string match "^*" $id]} {
334 - if {$sdm != 1} {
335 - lappend ret $id
336 - if {$sdm == 3} {
337 - set sdm 0
338 - }
339 - }
340 - lappend neg [string range $id 1 end]
341 - } else {
342 - if {$sdm != 2} {
343 - lappend ret $id
344 - } else {
345 - lset ret end $id...[lindex $ret end]
346 - }
347 - lappend pos $id
348 - }
349 - incr sdm -1
331 + if {$id eq "--gitk-symmetric-diff-marker"} {
332 + set sdm 4
333 + } elseif {[string match "^*" $id]} {
334 + if {$sdm != 1} {
335 + lappend ret $id
336 + if {$sdm == 3} {
337 + set sdm 0
338 + }
339 + }
340 + lappend neg [string range $id 1 end]
341 + } else {
342 + if {$sdm != 2} {
343 + lappend ret $id
344 + } else {
345 + lset ret end $id...[lindex $ret end]
346 + }
347 + lappend pos $id
348 + }
349 + incr sdm -1
350 }
351 set vposids($view) $pos
352 set vnegids($view) $neg
@@ -373,63 +373,63 @@ proc start_rev_list {view} {
373
374 set args $viewargs($view)
375 if {$viewargscmd($view) ne {}} {
376 - if {[catch {
377 - set str [exec sh -c $viewargscmd($view)]
378 - } err]} {
379 - error_popup "[mc "Error executing --argscmd command:"] $err"
380 - return 0
381 - }
382 - set args [concat $args [split $str "\n"]]
376 + if {[catch {
377 + set str [exec sh -c $viewargscmd($view)]
378 + } err]} {
379 + error_popup "[mc "Error executing --argscmd command:"] $err"
380 + return 0
381 + }
382 + set args [concat $args [split $str "\n"]]
383 }
384 set vcanopt($view) [parseviewargs $view $args]
385
386 set files $viewfiles($view)
387 if {$vmergeonly($view)} {
388 - set files [unmerged_files $files]
389 - if {$files eq {}} {
390 - global nr_unmerged
391 - if {$nr_unmerged == 0} {
392 - error_popup [mc "No files selected: --merge specified but\
393 - no files are unmerged."]
394 - } else {
395 - error_popup [mc "No files selected: --merge specified but\
396 - no unmerged files are within file limit."]
397 - }
398 - return 0
399 - }
388 + set files [unmerged_files $files]
389 + if {$files eq {}} {
390 + global nr_unmerged
391 + if {$nr_unmerged == 0} {
392 + error_popup [mc "No files selected: --merge specified but\
393 + no files are unmerged."]
394 + } else {
395 + error_popup [mc "No files selected: --merge specified but\
396 + no unmerged files are within file limit."]
397 + }
398 + return 0
399 + }
400 }
401 set vfilelimit($view) $files
402
403 if {$vcanopt($view)} {
404 - set revs [parseviewrevs $view $vrevs($view)]
405 - if {$revs eq {}} {
406 - return 0
407 - }
408 - set args [concat $vflags($view) $revs]
404 + set revs [parseviewrevs $view $vrevs($view)]
405 + if {$revs eq {}} {
406 + return 0
407 + }
408 + set args [concat $vflags($view) $revs]
409 } else {
410 - set args $vorigargs($view)
410 + set args $vorigargs($view)
411 }
412
413 if {[catch {
414 - set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
415 - --parents --boundary $args "--" $files] r]
414 + set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
415 + --parents --boundary $args "--" $files] r]
416 } err]} {
417 - error_popup "[mc "Error executing git log:"] $err"
418 - return 0
417 + error_popup "[mc "Error executing git log:"] $err"
418 + return 0
419 }
420 set i [reg_instance $fd]
421 set viewinstances($view) [list $i]
422 set viewmainheadid($view) $mainheadid
423 set viewmainheadid_orig($view) $mainheadid
424 if {$files ne {} && $mainheadid ne {}} {
425 - get_viewmainhead $view
425 + get_viewmainhead $view
426 }
427 if {$showlocalchanges && $viewmainheadid($view) ne {}} {
428 - interestedin $viewmainheadid($view) dodiffindex
428 + interestedin $viewmainheadid($view) dodiffindex
429 }
430 fconfigure $fd -blocking 0 -translation lf -eofchar {}
431 if {$tclencoding != {}} {
432 - fconfigure $fd -encoding $tclencoding
432 + fconfigure $fd -encoding $tclencoding
433 }
434 filerun $fd [list getcommitlines $fd $i $view 0]
435 nowbusy $view [mc "Reading"]
@@ -443,13 +443,13 @@ proc stop_instance {inst} {
443
444 set fd $commfd($inst)
445 catch {
446 - set pid [pid $fd]
446 + set pid [pid $fd]
447
448 - if {$::tcl_platform(platform) eq {windows}} {
449 - exec taskkill /pid $pid
450 - } else {
451 - exec kill $pid
452 - }
448 + if {$::tcl_platform(platform) eq {windows}} {
449 + exec taskkill /pid $pid
450 + } else {
451 + exec kill $pid
452 + }
453 }
454 catch {close $fd}
455 nukefile $fd
@@ -461,7 +461,7 @@ proc stop_backends {} {
461 global commfd
462
463 foreach inst [array names commfd] {
464 - stop_instance $inst
464 + stop_instance $inst
465 }
466 }
467
@@ -469,7 +469,7 @@ proc stop_rev_list {view} {
469 global viewinstances
470
471 foreach inst $viewinstances($view) {
472 - stop_instance $inst
472 + stop_instance $inst
473 }
474 set viewinstances($view) {}
475 }
@@ -478,11 +478,11 @@ proc reset_pending_select {selid} {
478 global pending_select mainheadid selectheadid
479
480 if {$selid ne {}} {
481 - set pending_select $selid
481 + set pending_select $selid
482 } elseif {$selectheadid ne {}} {
483 - set pending_select $selectheadid
483 + set pending_select $selectheadid
484 } else {
485 - set pending_select $mainheadid
485 + set pending_select $mainheadid
486 }
487 }
488
@@ -491,11 +491,11 @@ proc getcommits {selid} {
491
492 initlayout
493 if {[start_rev_list $curview]} {
494 - reset_pending_select $selid
495 - show_status [mc "Reading commits..."]
496 - set need_redisplay 1
494 + reset_pending_select $selid
495 + show_status [mc "Reading commits..."]
496 + set need_redisplay 1
497 } else {
498 - show_status [mc "No commits selected"]
498 + show_status [mc "No commits selected"]
499 }
500 }
501
@@ -512,67 +512,67 @@ proc updatecommits {} {
512 rereadrefs
513 set view $curview
514 if {$mainheadid ne $viewmainheadid_orig($view)} {
515 - if {$showlocalchanges} {
516 - dohidelocalchanges
517 - }
518 - set viewmainheadid($view) $mainheadid
519 - set viewmainheadid_orig($view) $mainheadid
520 - if {$vfilelimit($view) ne {}} {
521 - get_viewmainhead $view
522 - }
515 + if {$showlocalchanges} {
516 + dohidelocalchanges
517 + }
518 + set viewmainheadid($view) $mainheadid
519 + set viewmainheadid_orig($view) $mainheadid
520 + if {$vfilelimit($view) ne {}} {
521 + get_viewmainhead $view
522 + }
523 }
524 if {$showlocalchanges} {
525 - doshowlocalchanges
525 + doshowlocalchanges
526 }
527 if {$vcanopt($view)} {
528 - set oldpos $vposids($view)
529 - set oldneg $vnegids($view)
530 - set revs [parseviewrevs $view $vrevs($view)]
531 - if {$revs eq {}} {
532 - return
533 - }
534 - # note: getting the delta when negative refs change is hard,
535 - # and could require multiple git log invocations, so in that
536 - # case we ask git log for all the commits (not just the delta)
537 - if {$oldneg eq $vnegids($view)} {
538 - set newrevs {}
539 - set npos 0
540 - # take out positive refs that we asked for before or
541 - # that we have already seen
542 - foreach rev $revs {
543 - if {[string length $rev] == 40} {
544 - if {[lsearch -exact $oldpos $rev] < 0
545 - && ![info exists varcid($view,$rev)]} {
546 - lappend newrevs $rev
547 - incr npos
548 - }
549 - } else {
550 - lappend $newrevs $rev
551 - }
552 - }
553 - if {$npos == 0} return
554 - set revs $newrevs
555 - set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]
556 - }
557 - set args [concat $vflags($view) $revs --not $oldpos]
528 + set oldpos $vposids($view)
529 + set oldneg $vnegids($view)
530 + set revs [parseviewrevs $view $vrevs($view)]
531 + if {$revs eq {}} {
532 + return
533 + }
534 + # note: getting the delta when negative refs change is hard,
535 + # and could require multiple git log invocations, so in that
536 + # case we ask git log for all the commits (not just the delta)
537 + if {$oldneg eq $vnegids($view)} {
538 + set newrevs {}
539 + set npos 0
540 + # take out positive refs that we asked for before or
541 + # that we have already seen
542 + foreach rev $revs {
543 + if {[string length $rev] == 40} {
544 + if {[lsearch -exact $oldpos $rev] < 0
545 + && ![info exists varcid($view,$rev)]} {
546 + lappend newrevs $rev
547 + incr npos
548 + }
549 + } else {
550 + lappend $newrevs $rev
551 + }
552 + }
553 + if {$npos == 0} return
554 + set revs $newrevs
555 + set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]
556 + }
557 + set args [concat $vflags($view) $revs --not $oldpos]
558 } else {
559 - set args $vorigargs($view)
559 + set args $vorigargs($view)
560 }
561 if {[catch {
562 - set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
563 - --parents --boundary $args "--" $vfilelimit($view)] r]
562 + set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
563 + --parents --boundary $args "--" $vfilelimit($view)] r]
564 } err]} {
565 - error_popup "[mc "Error executing git log:"] $err"
566 - return
565 + error_popup "[mc "Error executing git log:"] $err"
566 + return
567 }
568 if {$viewactive($view) == 0} {
569 - set startmsecs [clock clicks -milliseconds]
569 + set startmsecs [clock clicks -milliseconds]
570 }
571 set i [reg_instance $fd]
572 lappend viewinstances($view) $i
573 fconfigure $fd -blocking 0 -translation lf -eofchar {}
574 if {$tclencoding != {}} {
575 - fconfigure $fd -encoding $tclencoding
575 + fconfigure $fd -encoding $tclencoding
576 }
577 filerun $fd [list getcommitlines $fd $i $view 1]
578 incr viewactive($view)
@@ -580,7 +580,7 @@ proc updatecommits {} {
580 reset_pending_select {}
581 nowbusy $view [mc "Reading"]
582 if {$showneartags} {
583 - getallcommits
583 + getallcommits
584 }
585 }
586
@@ -591,11 +591,11 @@ proc reloadcommits {} {
591
592 set selid {}
593 if {$selectedline ne {}} {
594 - set selid $currentid
594 + set selid $currentid
595 }
596
597 if {!$viewcomplete($curview)} {
598 - stop_rev_list $curview
598 + stop_rev_list $curview
599 }
600 resetvarcs $curview
601 set selectedline {}
@@ -605,7 +605,7 @@ proc reloadcommits {} {
605 readrefs
606 changedrefs
607 if {$showneartags} {
608 - getallcommits
608 + getallcommits
609 }
610 clear_display
611 unset -nocomplain commitinfo
@@ -621,11 +621,11 @@ proc reloadcommits {} {
621 # sorts as a string in numerical order
622 proc strrep {n} {
623 if {$n < 16} {
624 - return [format "%x" $n]
624 + return [format "%x" $n]
625 } elseif {$n < 256} {
626 - return [format "x%.2x" $n]
626 + return [format "x%.2x" $n]
627 } elseif {$n < 65536} {
628 - return [format "y%.4x" $n]
628 + return [format "y%.4x" $n]
629 }
630 return [format "z%.8x" $n]
631 }
@@ -656,22 +656,22 @@ proc resetvarcs {view} {
656 global vshortids
657
658 foreach vid [array names varcid $view,*] {
659 - unset varcid($vid)
660 - unset children($vid)
661 - unset parents($vid)
659 + unset varcid($vid)
660 + unset children($vid)
661 + unset parents($vid)
662 }
663 foreach vid [array names vshortids $view,*] {
664 - unset vshortids($vid)
664 + unset vshortids($vid)
665 }
666 # some commits might have children but haven't been seen yet
667 foreach vid [array names children $view,*] {
668 - unset children($vid)
668 + unset children($vid)
669 }
670 foreach va [array names varccommits $view,*] {
671 - unset varccommits($va)
671 + unset varccommits($va)
672 }
673 foreach vd [array names vseedcount $view,*] {
674 - unset vseedcount($vd)
674 + unset vseedcount($vd)
675 }
676 unset -nocomplain ordertok
677 }
@@ -683,8 +683,8 @@ proc seeds {v} {
683 set ret {}
684 set a [lindex $vdownptr($v) 0]
685 while {$a != 0} {
686 - lappend ret [lindex $varcstart($v) $a]
687 - set a [lindex $vleftptr($v) $a]
686 + lappend ret [lindex $varcstart($v) $a]
687 + set a [lindex $vleftptr($v) $a]
688 }
689 return $ret
690 }
@@ -697,60 +697,60 @@ proc newvarc {view id} {
697 set a [llength $varctok($view)]
698 set vid $view,$id
699 if {[llength $children($vid)] == 0 || $vdatemode($view)} {
700 - if {![info exists commitinfo($id)]} {
701 - parsecommit $id $commitdata($id) 1
702 - }
703 - set cdate [lindex [lindex $commitinfo($id) 4] 0]
704 - if {![string is integer -strict $cdate]} {
705 - set cdate 0
706 - }
707 - if {![info exists vseedcount($view,$cdate)]} {
708 - set vseedcount($view,$cdate) -1
709 - }
710 - set c [incr vseedcount($view,$cdate)]
711 - set cdate [expr {$cdate ^ 0xffffffff}]
712 - set tok "s[strrep $cdate][strrep $c]"
700 + if {![info exists commitinfo($id)]} {
701 + parsecommit $id $commitdata($id) 1
702 + }
703 + set cdate [lindex [lindex $commitinfo($id) 4] 0]
704 + if {![string is integer -strict $cdate]} {
705 + set cdate 0
706 + }
707 + if {![info exists vseedcount($view,$cdate)]} {
708 + set vseedcount($view,$cdate) -1
709 + }
710 + set c [incr vseedcount($view,$cdate)]
711 + set cdate [expr {$cdate ^ 0xffffffff}]
712 + set tok "s[strrep $cdate][strrep $c]"
713 } else {
714 - set tok {}
714 + set tok {}
715 }
716 set ka 0
717 if {[llength $children($vid)] > 0} {
718 - set kid [lindex $children($vid) end]
719 - set k $varcid($view,$kid)
720 - if {[string compare [lindex $varctok($view) $k] $tok] > 0} {
721 - set ki $kid
722 - set ka $k
723 - set tok [lindex $varctok($view) $k]
724 - }
718 + set kid [lindex $children($vid) end]
719 + set k $varcid($view,$kid)
720 + if {[string compare [lindex $varctok($view) $k] $tok] > 0} {
721 + set ki $kid
722 + set ka $k
723 + set tok [lindex $varctok($view) $k]
724 + }
725 }
726 if {$ka != 0} {
727 - set i [lsearch -exact $parents($view,$ki) $id]
728 - set j [expr {[llength $parents($view,$ki)] - 1 - $i}]
729 - append tok [strrep $j]
727 + set i [lsearch -exact $parents($view,$ki) $id]
728 + set j [expr {[llength $parents($view,$ki)] - 1 - $i}]
729 + append tok [strrep $j]
730 }
731 set c [lindex $vlastins($view) $ka]
732 if {$c == 0 || [string compare $tok [lindex $varctok($view) $c]] < 0} {
733 - set c $ka
734 - set b [lindex $vdownptr($view) $ka]
733 + set c $ka
734 + set b [lindex $vdownptr($view) $ka]
735 } else {
736 - set b [lindex $vleftptr($view) $c]
736 + set b [lindex $vleftptr($view) $c]
737 }
738 while {$b != 0 && [string compare $tok [lindex $varctok($view) $b]] >= 0} {
739 - set c $b
740 - set b [lindex $vleftptr($view) $c]
739 + set c $b
740 + set b [lindex $vleftptr($view) $c]
741 }
742 if {$c == $ka} {
743 - lset vdownptr($view) $ka $a
744 - lappend vbackptr($view) 0
743 + lset vdownptr($view) $ka $a
744 + lappend vbackptr($view) 0
745 } else {
746 - lset vleftptr($view) $c $a
747 - lappend vbackptr($view) $c
746 + lset vleftptr($view) $c $a
747 + lappend vbackptr($view) $c
748 }
749 lset vlastins($view) $ka $a
750 lappend vupptr($view) $ka
751 lappend vleftptr($view) $b
752 if {$b != 0} {
753 - lset vbackptr($view) $b $a
753 + lset vbackptr($view) $b $a
754 }
755 lappend varctok($view) $tok
756 lappend varcstart($view) $id
@@ -781,7 +781,7 @@ proc splitvarc {p v} {
781 set varccommits($v,$na) [lrange $ac $i end]
782 lappend varcstart($v) $p
783 foreach id $varccommits($v,$na) {
784 - set varcid($v,$id) $na
784 + set varcid($v,$id) $na
785 }
786 lappend vdownptr($v) [lindex $vdownptr($v) $oa]
787 lappend vlastins($v) [lindex $vlastins($v) $oa]
@@ -791,10 +791,10 @@ proc splitvarc {p v} {
791 lappend vleftptr($v) 0
792 lappend vbackptr($v) 0
793 for {set b [lindex $vdownptr($v) $na]} {$b != 0} {set b [lindex $vleftptr($v) $b]} {
794 - lset vupptr($v) $b $na
794 + lset vupptr($v) $b $na
795 }
796 if {[string compare $otok $vtokmod($v)] <= 0} {
797 - modify_arc $v $oa
797 + modify_arc $v $oa
798 }
799 }
800
@@ -808,120 +808,120 @@ proc renumbervarc {a v} {
808 set kidchanged($a) 1
809 set ntot 0
810 while {$a != 0} {
811 - if {[info exists isrelated($a)]} {
812 - lappend todo $a
813 - set id [lindex $varccommits($v,$a) end]
814 - foreach p $parents($v,$id) {
815 - if {[info exists varcid($v,$p)]} {
816 - set isrelated($varcid($v,$p)) 1
817 - }
818 - }
819 - }
820 - incr ntot
821 - set b [lindex $vdownptr($v) $a]
822 - if {$b == 0} {
823 - while {$a != 0} {
824 - set b [lindex $vleftptr($v) $a]
825 - if {$b != 0} break
826 - set a [lindex $vupptr($v) $a]
827 - }
828 - }
829 - set a $b
811 + if {[info exists isrelated($a)]} {
812 + lappend todo $a
813 + set id [lindex $varccommits($v,$a) end]
814 + foreach p $parents($v,$id) {
815 + if {[info exists varcid($v,$p)]} {
816 + set isrelated($varcid($v,$p)) 1
817 + }
818 + }
819 + }
820 + incr ntot
821 + set b [lindex $vdownptr($v) $a]
822 + if {$b == 0} {
823 + while {$a != 0} {
824 + set b [lindex $vleftptr($v) $a]
825 + if {$b != 0} break
826 + set a [lindex $vupptr($v) $a]
827 + }
828 + }
829 + set a $b
830 }
831 foreach a $todo {
832 - if {![info exists kidchanged($a)]} continue
833 - set id [lindex $varcstart($v) $a]
834 - if {[llength $children($v,$id)] > 1} {
835 - set children($v,$id) [lsort -command [list vtokcmp $v] \
836 - $children($v,$id)]
837 - }
838 - set oldtok [lindex $varctok($v) $a]
839 - if {!$vdatemode($v)} {
840 - set tok {}
841 - } else {
842 - set tok $oldtok
843 - }
844 - set ka 0
845 - set kid [last_real_child $v,$id]
846 - if {$kid ne {}} {
847 - set k $varcid($v,$kid)
848 - if {[string compare [lindex $varctok($v) $k] $tok] > 0} {
849 - set ki $kid
850 - set ka $k
851 - set tok [lindex $varctok($v) $k]
852 - }
853 - }
854 - if {$ka != 0} {
855 - set i [lsearch -exact $parents($v,$ki) $id]
856 - set j [expr {[llength $parents($v,$ki)] - 1 - $i}]
857 - append tok [strrep $j]
858 - }
859 - if {$tok eq $oldtok} {
860 - continue
861 - }
862 - set id [lindex $varccommits($v,$a) end]
863 - foreach p $parents($v,$id) {
864 - if {[info exists varcid($v,$p)]} {
865 - set kidchanged($varcid($v,$p)) 1
866 - } else {
867 - set sortkids($p) 1
868 - }
869 - }
870 - lset varctok($v) $a $tok
871 - set b [lindex $vupptr($v) $a]
872 - if {$b != $ka} {
873 - if {[string compare [lindex $varctok($v) $ka] $vtokmod($v)] < 0} {
874 - modify_arc $v $ka
875 - }
876 - if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {
877 - modify_arc $v $b
878 - }
879 - set c [lindex $vbackptr($v) $a]
880 - set d [lindex $vleftptr($v) $a]
881 - if {$c == 0} {
882 - lset vdownptr($v) $b $d
883 - } else {
884 - lset vleftptr($v) $c $d
885 - }
886 - if {$d != 0} {
887 - lset vbackptr($v) $d $c
888 - }
889 - if {[lindex $vlastins($v) $b] == $a} {
890 - lset vlastins($v) $b $c
891 - }
892 - lset vupptr($v) $a $ka
893 - set c [lindex $vlastins($v) $ka]
894 - if {$c == 0 || \
895 - [string compare $tok [lindex $varctok($v) $c]] < 0} {
896 - set c $ka
897 - set b [lindex $vdownptr($v) $ka]
898 - } else {
899 - set b [lindex $vleftptr($v) $c]
900 - }
901 - while {$b != 0 && \
902 - [string compare $tok [lindex $varctok($v) $b]] >= 0} {
903 - set c $b
904 - set b [lindex $vleftptr($v) $c]
905 - }
906 - if {$c == $ka} {
907 - lset vdownptr($v) $ka $a
908 - lset vbackptr($v) $a 0
909 - } else {
910 - lset vleftptr($v) $c $a
911 - lset vbackptr($v) $a $c
912 - }
913 - lset vleftptr($v) $a $b
914 - if {$b != 0} {
915 - lset vbackptr($v) $b $a
916 - }
917 - lset vlastins($v) $ka $a
918 - }
832 + if {![info exists kidchanged($a)]} continue
833 + set id [lindex $varcstart($v) $a]
834 + if {[llength $children($v,$id)] > 1} {
835 + set children($v,$id) [lsort -command [list vtokcmp $v] \
836 + $children($v,$id)]
837 + }
838 + set oldtok [lindex $varctok($v) $a]
839 + if {!$vdatemode($v)} {
840 + set tok {}
841 + } else {
842 + set tok $oldtok
843 + }
844 + set ka 0
845 + set kid [last_real_child $v,$id]
846 + if {$kid ne {}} {
847 + set k $varcid($v,$kid)
848 + if {[string compare [lindex $varctok($v) $k] $tok] > 0} {
849 + set ki $kid
850 + set ka $k
851 + set tok [lindex $varctok($v) $k]
852 + }
853 + }
854 + if {$ka != 0} {
855 + set i [lsearch -exact $parents($v,$ki) $id]
856 + set j [expr {[llength $parents($v,$ki)] - 1 - $i}]
857 + append tok [strrep $j]
858 + }
859 + if {$tok eq $oldtok} {
860 + continue
861 + }
862 + set id [lindex $varccommits($v,$a) end]
863 + foreach p $parents($v,$id) {
864 + if {[info exists varcid($v,$p)]} {
865 + set kidchanged($varcid($v,$p)) 1
866 + } else {
867 + set sortkids($p) 1
868 + }
869 + }
870 + lset varctok($v) $a $tok
871 + set b [lindex $vupptr($v) $a]
872 + if {$b != $ka} {
873 + if {[string compare [lindex $varctok($v) $ka] $vtokmod($v)] < 0} {
874 + modify_arc $v $ka
875 + }
876 + if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {
877 + modify_arc $v $b
878 + }
879 + set c [lindex $vbackptr($v) $a]
880 + set d [lindex $vleftptr($v) $a]
881 + if {$c == 0} {
882 + lset vdownptr($v) $b $d
883 + } else {
884 + lset vleftptr($v) $c $d
885 + }
886 + if {$d != 0} {
887 + lset vbackptr($v) $d $c
888 + }
889 + if {[lindex $vlastins($v) $b] == $a} {
890 + lset vlastins($v) $b $c
891 + }
892 + lset vupptr($v) $a $ka
893 + set c [lindex $vlastins($v) $ka]
894 + if {$c == 0 || \
895 + [string compare $tok [lindex $varctok($v) $c]] < 0} {
896 + set c $ka
897 + set b [lindex $vdownptr($v) $ka]
898 + } else {
899 + set b [lindex $vleftptr($v) $c]
900 + }
901 + while {$b != 0 && \
902 + [string compare $tok [lindex $varctok($v) $b]] >= 0} {
903 + set c $b
904 + set b [lindex $vleftptr($v) $c]
905 + }
906 + if {$c == $ka} {
907 + lset vdownptr($v) $ka $a
908 + lset vbackptr($v) $a 0
909 + } else {
910 + lset vleftptr($v) $c $a
911 + lset vbackptr($v) $a $c
912 + }
913 + lset vleftptr($v) $a $b
914 + if {$b != 0} {
915 + lset vbackptr($v) $b $a
916 + }
917 + lset vlastins($v) $ka $a
918 + }
919 }
920 foreach id [array names sortkids] {
921 - if {[llength $children($v,$id)] > 1} {
922 - set children($v,$id) [lsort -command [list vtokcmp $v] \
923 - $children($v,$id)]
924 - }
921 + if {[llength $children($v,$id)] > 1} {
922 + set children($v,$id) [lsort -command [list vtokcmp $v] \
923 + $children($v,$id)]
924 + }
925 }
926 set t2 [clock clicks -milliseconds]
927 #puts "renumbervarc did [llength $todo] of $ntot arcs in [expr {$t2-$t1}]ms"
@@ -935,14 +935,14 @@ proc fix_reversal {p a v} {
935
936 set pa $varcid($v,$p)
937 if {$p ne [lindex $varcstart($v) $pa]} {
938 - splitvarc $p $v
939 - set pa $varcid($v,$p)
938 + splitvarc $p $v
939 + set pa $varcid($v,$p)
940 }
941 # seeds always need to be renumbered
942 if {[lindex $vupptr($v) $pa] == 0 ||
943 - [string compare [lindex $varctok($v) $a] \
944 - [lindex $varctok($v) $pa]] > 0} {
945 - renumbervarc $pa $v
943 + [string compare [lindex $varctok($v) $a] \
944 + [lindex $varctok($v) $pa]] > 0} {
945 + renumbervarc $pa $v
946 }
947 }
948
@@ -960,24 +960,24 @@ proc insertrow {id p v} {
960 set varcid($vid) $a
961 lappend vshortids($v,[string range $id 0 3]) $id
962 if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {
963 - modify_arc $v $a
963 + modify_arc $v $a
964 }
965 lappend varccommits($v,$a) $id
966 set vp $v,$p
967 if {[llength [lappend children($vp) $id]] > 1} {
968 - set children($vp) [lsort -command [list vtokcmp $v] $children($vp)]
969 - unset -nocomplain ordertok
968 + set children($vp) [lsort -command [list vtokcmp $v] $children($vp)]
969 + unset -nocomplain ordertok
970 }
971 fix_reversal $p $a $v
972 incr commitidx($v)
973 if {$v == $curview} {
974 - set numcommits $commitidx($v)
975 - setcanvscroll
976 - if {[info exists targetid]} {
977 - if {![comes_before $targetid $p]} {
978 - incr targetrow
979 - }
980 - }
974 + set numcommits $commitidx($v)
975 + setcanvscroll
976 + if {[info exists targetid]} {
977 + if {![comes_before $targetid $p]} {
978 + incr targetrow
979 + }
980 + }
981 }
982 }
983
@@ -989,8 +989,8 @@ proc insertfakerow {id p} {
989 set a $varcid($v,$p)
990 set i [lsearch -exact $varccommits($v,$a) $p]
991 if {$i < 0} {
992 - puts "oops: insertfakerow can't find [shortids $p] on arc $a"
993 - return
992 + puts "oops: insertfakerow can't find [shortids $p] on arc $a"
993 + return
994 }
995 set children($v,$id) {}
996 set parents($v,$id) [list $p]
@@ -1002,9 +1002,9 @@ proc insertfakerow {id p} {
1002 set varccommits($v,$a) [linsert $varccommits($v,$a) $i $id]
1003 modify_arc $v $a $i
1004 if {[info exists targetid]} {
1005 - if {![comes_before $targetid $p]} {
1006 - incr targetrow
1007 - }
1005 + if {![comes_before $targetid $p]} {
1006 + incr targetrow
1007 + }
1008 }
1009 setcanvscroll
1010 drawvisible
@@ -1017,15 +1017,15 @@ proc removefakerow {id} {
1017
1018 set v $curview
1019 if {[llength $parents($v,$id)] != 1} {
1020 - puts "oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents"
1021 - return
1020 + puts "oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents"
1021 + return
1022 }
1023 set p [lindex $parents($v,$id) 0]
1024 set a $varcid($v,$id)
1025 set i [lsearch -exact $varccommits($v,$a) $id]
1026 if {$i < 0} {
1027 - puts "oops: removefakerow can't find [shortids $id] on arc $a"
1028 - return
1027 + puts "oops: removefakerow can't find [shortids $id] on arc $a"
1028 + return
1029 }
1030 unset varcid($v,$id)
1031 set varccommits($v,$a) [lreplace $varccommits($v,$a) $i $i]
@@ -1035,15 +1035,15 @@ proc removefakerow {id} {
1035 set numcommits [incr commitidx($v) -1]
1036 set j [lsearch -exact $children($v,$p) $id]
1037 if {$j >= 0} {
1038 - set children($v,$p) [lreplace $children($v,$p) $j $j]
1038 + set children($v,$p) [lreplace $children($v,$p) $j $j]
1039 }
1040 modify_arc $v $a $i
1041 if {[info exist currentid] && $id eq $currentid} {
1042 - unset currentid
1043 - set selectedline {}
1042 + unset currentid
1043 + set selectedline {}
1044 }
1045 if {[info exists targetid] && $targetid eq $id} {
1046 - set targetid $p
1046 + set targetid $p
1047 }
1048 setcanvscroll
1049 drawvisible
@@ -1054,9 +1054,9 @@ proc real_children {vp} {
1054
1055 set kids {}
1056 foreach id $children($vp) {
1057 - if {$id ne $nullid && $id ne $nullid2} {
1058 - lappend kids $id
1059 - }
1057 + if {$id ne $nullid && $id ne $nullid2} {
1058 + lappend kids $id
1059 + }
1060 }
1061 return $kids
1062 }
@@ -1065,9 +1065,9 @@ proc first_real_child {vp} {
1065 global children nullid nullid2
1066
1067 foreach id $children($vp) {
1068 - if {$id ne $nullid && $id ne $nullid2} {
1069 - return $id
1070 - }
1068 + if {$id ne $nullid && $id ne $nullid2} {
1069 + return $id
1070 + }
1071 }
1072 return {}
1073 }
@@ -1077,10 +1077,10 @@ proc last_real_child {vp} {
1077
1078 set kids $children($vp)
1079 for {set i [llength $kids]} {[incr i -1] >= 0} {} {
1080 - set id [lindex $kids $i]
1081 - if {$id ne $nullid && $id ne $nullid2} {
1082 - return $id
1083 - }
1080 + set id [lindex $kids $i]
1081 + if {$id ne $nullid && $id ne $nullid2} {
1082 + return $id
1083 + }
1084 }
1085 return {}
1086 }
@@ -1089,7 +1089,7 @@ proc vtokcmp {v a b} {
1089 global varctok varcid
1090
1091 return [string compare [lindex $varctok($v) $varcid($v,$a)] \
1092 - [lindex $varctok($v) $varcid($v,$b)]]
1092 + [lindex $varctok($v) $varcid($v,$b)]]
1093 }
1094
1095 # This assumes that if lim is not given, the caller has checked that
@@ -1098,29 +1098,29 @@ proc modify_arc {v a {lim {}}} {
1098 global varctok vtokmod varcmod varcrow vupptr curview vrowmod varccommits
1099
1100 if {$lim ne {}} {
1101 - set c [string compare [lindex $varctok($v) $a] $vtokmod($v)]
1102 - if {$c > 0} return
1103 - if {$c == 0} {
1104 - set r [lindex $varcrow($v) $a]
1105 - if {$r ne {} && $vrowmod($v) <= $r + $lim} return
1106 - }
1101 + set c [string compare [lindex $varctok($v) $a] $vtokmod($v)]
1102 + if {$c > 0} return
1103 + if {$c == 0} {
1104 + set r [lindex $varcrow($v) $a]
1105 + if {$r ne {} && $vrowmod($v) <= $r + $lim} return
1106 + }
1107 }
1108 set vtokmod($v) [lindex $varctok($v) $a]
1109 set varcmod($v) $a
1110 if {$v == $curview} {
1111 - while {$a != 0 && [lindex $varcrow($v) $a] eq {}} {
1112 - set a [lindex $vupptr($v) $a]
1113 - set lim {}
1114 - }
1115 - set r 0
1116 - if {$a != 0} {
1117 - if {$lim eq {}} {
1118 - set lim [llength $varccommits($v,$a)]
1119 - }
1120 - set r [expr {[lindex $varcrow($v) $a] + $lim}]
1121 - }
1122 - set vrowmod($v) $r
1123 - undolayout $r
1111 + while {$a != 0 && [lindex $varcrow($v) $a] eq {}} {
1112 + set a [lindex $vupptr($v) $a]
1113 + set lim {}
1114 + }
1115 + set r 0
1116 + if {$a != 0} {
1117 + if {$lim eq {}} {
1118 + set lim [llength $varccommits($v,$a)]
1119 + }
1120 + set r [expr {[lindex $varcrow($v) $a] + $lim}]
1121 + }
1122 + set vrowmod($v) $r
1123 + undolayout $r
1124 }
1125 }
1126
@@ -1132,62 +1132,62 @@ proc update_arcrows {v} {
1132
1133 if {$vrowmod($v) == $commitidx($v)} return
1134 if {$v == $curview} {
1135 - if {[llength $displayorder] > $vrowmod($v)} {
1136 - set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]
1137 - set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]
1138 - }
1139 - unset -nocomplain cached_commitrow
1135 + if {[llength $displayorder] > $vrowmod($v)} {
1136 + set displayorder [lrange $displayorder 0 [expr {$vrowmod($v) - 1}]]
1137 + set parentlist [lrange $parentlist 0 [expr {$vrowmod($v) - 1}]]
1138 + }
1139 + unset -nocomplain cached_commitrow
1140 }
1141 set narctot [expr {[llength $varctok($v)] - 1}]
1142 set a $varcmod($v)
1143 while {$a != 0 && [lindex $varcix($v) $a] eq {}} {
1144 - # go up the tree until we find something that has a row number,
1145 - # or we get to a seed
1146 - set a [lindex $vupptr($v) $a]
1144 + # go up the tree until we find something that has a row number,
1145 + # or we get to a seed
1146 + set a [lindex $vupptr($v) $a]
1147 }
1148 if {$a == 0} {
1149 - set a [lindex $vdownptr($v) 0]
1150 - if {$a == 0} return
1151 - set vrownum($v) {0}
1152 - set varcorder($v) [list $a]
1153 - lset varcix($v) $a 0
1154 - lset varcrow($v) $a 0
1155 - set arcn 0
1156 - set row 0
1149 + set a [lindex $vdownptr($v) 0]
1150 + if {$a == 0} return
1151 + set vrownum($v) {0}
1152 + set varcorder($v) [list $a]
1153 + lset varcix($v) $a 0
1154 + lset varcrow($v) $a 0
1155 + set arcn 0
1156 + set row 0
1157 } else {
1158 - set arcn [lindex $varcix($v) $a]
1159 - if {[llength $vrownum($v)] > $arcn + 1} {
1160 - set vrownum($v) [lrange $vrownum($v) 0 $arcn]
1161 - set varcorder($v) [lrange $varcorder($v) 0 $arcn]
1162 - }
1163 - set row [lindex $varcrow($v) $a]
1158 + set arcn [lindex $varcix($v) $a]
1159 + if {[llength $vrownum($v)] > $arcn + 1} {
1160 + set vrownum($v) [lrange $vrownum($v) 0 $arcn]
1161 + set varcorder($v) [lrange $varcorder($v) 0 $arcn]
1162 + }
1163 + set row [lindex $varcrow($v) $a]
1164 }
1165 while {1} {
1166 - set p $a
1167 - incr row [llength $varccommits($v,$a)]
1168 - # go down if possible
1169 - set b [lindex $vdownptr($v) $a]
1170 - if {$b == 0} {
1171 - # if not, go left, or go up until we can go left
1172 - while {$a != 0} {
1173 - set b [lindex $vleftptr($v) $a]
1174 - if {$b != 0} break
1175 - set a [lindex $vupptr($v) $a]
1176 - }
1177 - if {$a == 0} break
1178 - }
1179 - set a $b
1180 - incr arcn
1181 - lappend vrownum($v) $row
1182 - lappend varcorder($v) $a
1183 - lset varcix($v) $a $arcn
1184 - lset varcrow($v) $a $row
1166 + set p $a
1167 + incr row [llength $varccommits($v,$a)]
1168 + # go down if possible
1169 + set b [lindex $vdownptr($v) $a]
1170 + if {$b == 0} {
1171 + # if not, go left, or go up until we can go left
1172 + while {$a != 0} {
1173 + set b [lindex $vleftptr($v) $a]
1174 + if {$b != 0} break
1175 + set a [lindex $vupptr($v) $a]
1176 + }
1177 + if {$a == 0} break
1178 + }
1179 + set a $b
1180 + incr arcn
1181 + lappend vrownum($v) $row
1182 + lappend varcorder($v) $a
1183 + lset varcix($v) $a $arcn
1184 + lset varcrow($v) $a $row
1185 }
1186 set vtokmod($v) [lindex $varctok($v) $p]
1187 set varcmod($v) $p
1188 set vrowmod($v) $row
1189 if {[info exists currentid]} {
1190 - set selectedline [rowofcommit $currentid]
1190 + set selectedline [rowofcommit $currentid]
1191 }
1192 }
1193
@@ -1205,20 +1205,20 @@ proc rowofcommit {id} {
1205
1206 set v $curview
1207 if {![info exists varcid($v,$id)]} {
1208 - puts "oops rowofcommit no arc for [shortids $id]"
1209 - return {}
1208 + puts "oops rowofcommit no arc for [shortids $id]"
1209 + return {}
1210 }
1211 set a $varcid($v,$id)
1212 if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] >= 0} {
1213 - update_arcrows $v
1213 + update_arcrows $v
1214 }
1215 if {[info exists cached_commitrow($id)]} {
1216 - return $cached_commitrow($id)
1216 + return $cached_commitrow($id)
1217 }
1218 set i [lsearch -exact $varccommits($v,$a) $id]
1219 if {$i < 0} {
1220 - puts "oops didn't find commit [shortids $id] in arc $a"
1221 - return {}
1220 + puts "oops didn't find commit [shortids $id] in arc $a"
1221 + return {}
1222 }
1223 incr i [lindex $varcrow($v) $a]
1224 set cached_commitrow($id) $i
@@ -1231,32 +1231,32 @@ proc comes_before {a b} {
1231
1232 set v $curview
1233 if {$a eq $b || ![info exists varcid($v,$a)] || \
1234 - ![info exists varcid($v,$b)]} {
1235 - return 0
1234 + ![info exists varcid($v,$b)]} {
1235 + return 0
1236 }
1237 if {$varcid($v,$a) != $varcid($v,$b)} {
1238 - return [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \
1239 - [lindex $varctok($v) $varcid($v,$b)]] < 0}]
1238 + return [expr {[string compare [lindex $varctok($v) $varcid($v,$a)] \
1239 + [lindex $varctok($v) $varcid($v,$b)]] < 0}]
1240 }
1241 return [expr {[rowofcommit $a] < [rowofcommit $b]}]
1242 }
1243
1244 proc bsearch {l elt} {
1245 if {[llength $l] == 0 || $elt <= [lindex $l 0]} {
1246 - return 0
1246 + return 0
1247 }
1248 set lo 0
1249 set hi [llength $l]
1250 while {$hi - $lo > 1} {
1251 - set mid [expr {int(($lo + $hi) / 2)}]
1252 - set t [lindex $l $mid]
1253 - if {$elt < $t} {
1254 - set hi $mid
1255 - } elseif {$elt > $t} {
1256 - set lo $mid
1257 - } else {
1258 - return $mid
1259 - }
1251 + set mid [expr {int(($lo + $hi) / 2)}]
1252 + set t [lindex $l $mid]
1253 + if {$elt < $t} {
1254 + set hi $mid
1255 + } elseif {$elt > $t} {
1256 + set lo $mid
1257 + } else {
1258 + return $mid
1259 + }
1260 }
1261 return $lo
1262 }
@@ -1268,37 +1268,37 @@ proc make_disporder {start end} {
1268 global d_valid_start d_valid_end
1269
1270 if {$end > $vrowmod($curview)} {
1271 - update_arcrows $curview
1271 + update_arcrows $curview
1272 }
1273 set ai [bsearch $vrownum($curview) $start]
1274 set start [lindex $vrownum($curview) $ai]
1275 set narc [llength $vrownum($curview)]
1276 for {set r $start} {$ai < $narc && $r < $end} {incr ai} {
1277 - set a [lindex $varcorder($curview) $ai]
1278 - set l [llength $displayorder]
1279 - set al [llength $varccommits($curview,$a)]
1280 - if {$l < $r + $al} {
1281 - if {$l < $r} {
1282 - set pad [ntimes [expr {$r - $l}] {}]
1283 - set displayorder [concat $displayorder $pad]
1284 - set parentlist [concat $parentlist $pad]
1285 - } elseif {$l > $r} {
1286 - set displayorder [lrange $displayorder 0 [expr {$r - 1}]]
1287 - set parentlist [lrange $parentlist 0 [expr {$r - 1}]]
1288 - }
1289 - foreach id $varccommits($curview,$a) {
1290 - lappend displayorder $id
1291 - lappend parentlist $parents($curview,$id)
1292 - }
1293 - } elseif {[lindex $displayorder [expr {$r + $al - 1}]] eq {}} {
1294 - set i $r
1295 - foreach id $varccommits($curview,$a) {
1296 - lset displayorder $i $id
1297 - lset parentlist $i $parents($curview,$id)
1298 - incr i
1299 - }
1300 - }
1301 - incr r $al
1277 + set a [lindex $varcorder($curview) $ai]
1278 + set l [llength $displayorder]
1279 + set al [llength $varccommits($curview,$a)]
1280 + if {$l < $r + $al} {
1281 + if {$l < $r} {
1282 + set pad [ntimes [expr {$r - $l}] {}]
1283 + set displayorder [concat $displayorder $pad]
1284 + set parentlist [concat $parentlist $pad]
1285 + } elseif {$l > $r} {
1286 + set displayorder [lrange $displayorder 0 [expr {$r - 1}]]
1287 + set parentlist [lrange $parentlist 0 [expr {$r - 1}]]
1288 + }
1289 + foreach id $varccommits($curview,$a) {
1290 + lappend displayorder $id
1291 + lappend parentlist $parents($curview,$id)
1292 + }
1293 + } elseif {[lindex $displayorder [expr {$r + $al - 1}]] eq {}} {
1294 + set i $r
1295 + foreach id $varccommits($curview,$a) {
1296 + lset displayorder $i $id
1297 + lset parentlist $i $parents($curview,$id)
1298 + incr i
1299 + }
1300 + }
1301 + incr r $al
1302 }
1303 }
1304
@@ -1307,8 +1307,8 @@ proc commitonrow {row} {
1307
1308 set id [lindex $displayorder $row]
1309 if {$id eq {}} {
1310 - make_disporder $row [expr {$row + 1}]
1311 - set id [lindex $displayorder $row]
1310 + make_disporder $row [expr {$row + 1}]
1311 + set id [lindex $displayorder $row]
1312 }
1313 return $id
1314 }
@@ -1321,35 +1321,35 @@ proc closevarcs {v} {
1321 set scripts {}
1322 set narcs [llength $varctok($v)]
1323 for {set a 1} {$a < $narcs} {incr a} {
1324 - set id [lindex $varccommits($v,$a) end]
1325 - foreach p $parents($v,$id) {
1326 - if {[info exists varcid($v,$p)]} continue
1327 - # add p as a new commit
1328 - incr missing_parents
1329 - set cmitlisted($v,$p) 0
1330 - set parents($v,$p) {}
1331 - if {[llength $children($v,$p)] == 1 &&
1332 - [llength $parents($v,$id)] == 1} {
1333 - set b $a
1334 - } else {
1335 - set b [newvarc $v $p]
1336 - }
1337 - set varcid($v,$p) $b
1338 - if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {
1339 - modify_arc $v $b
1340 - }
1341 - lappend varccommits($v,$b) $p
1342 - incr commitidx($v)
1343 - if {$v == $curview} {
1344 - set numcommits $commitidx($v)
1345 - }
1346 - set scripts [check_interest $p $scripts]
1347 - }
1324 + set id [lindex $varccommits($v,$a) end]
1325 + foreach p $parents($v,$id) {
1326 + if {[info exists varcid($v,$p)]} continue
1327 + # add p as a new commit
1328 + incr missing_parents
1329 + set cmitlisted($v,$p) 0
1330 + set parents($v,$p) {}
1331 + if {[llength $children($v,$p)] == 1 &&
1332 + [llength $parents($v,$id)] == 1} {
1333 + set b $a
1334 + } else {
1335 + set b [newvarc $v $p]
1336 + }
1337 + set varcid($v,$p) $b
1338 + if {[string compare [lindex $varctok($v) $b] $vtokmod($v)] < 0} {
1339 + modify_arc $v $b
1340 + }
1341 + lappend varccommits($v,$b) $p
1342 + incr commitidx($v)
1343 + if {$v == $curview} {
1344 + set numcommits $commitidx($v)
1345 + }
1346 + set scripts [check_interest $p $scripts]
1347 + }
1348 }
1349 if {$missing_parents > 0} {
1350 - foreach s $scripts {
1351 - eval $s
1352 - }
1350 + foreach s $scripts {
1351 + eval $s
1352 + }
1353 }
1354 }
1355
@@ -1359,23 +1359,23 @@ proc rewrite_commit {v id rwid} {
1359 global children parents varcid varctok vtokmod varccommits
1360
1361 foreach ch $children($v,$id) {
1362 - # make $rwid be $ch's parent in place of $id
1363 - set i [lsearch -exact $parents($v,$ch) $id]
1364 - if {$i < 0} {
1365 - puts "oops rewrite_commit didn't find $id in parent list for $ch"
1366 - }
1367 - set parents($v,$ch) [lreplace $parents($v,$ch) $i $i $rwid]
1368 - # add $ch to $rwid's children and sort the list if necessary
1369 - if {[llength [lappend children($v,$rwid) $ch]] > 1} {
1370 - set children($v,$rwid) [lsort -command [list vtokcmp $v] \
1371 - $children($v,$rwid)]
1372 - }
1373 - # fix the graph after joining $id to $rwid
1374 - set a $varcid($v,$ch)
1375 - fix_reversal $rwid $a $v
1376 - # parentlist is wrong for the last element of arc $a
1377 - # even if displayorder is right, hence the 3rd arg here
1378 - modify_arc $v $a [expr {[llength $varccommits($v,$a)] - 1}]
1362 + # make $rwid be $ch's parent in place of $id
1363 + set i [lsearch -exact $parents($v,$ch) $id]
1364 + if {$i < 0} {
1365 + puts "oops rewrite_commit didn't find $id in parent list for $ch"
1366 + }
1367 + set parents($v,$ch) [lreplace $parents($v,$ch) $i $i $rwid]
1368 + # add $ch to $rwid's children and sort the list if necessary
1369 + if {[llength [lappend children($v,$rwid) $ch]] > 1} {
1370 + set children($v,$rwid) [lsort -command [list vtokcmp $v] \
1371 + $children($v,$rwid)]
1372 + }
1373 + # fix the graph after joining $id to $rwid
1374 + set a $varcid($v,$ch)
1375 + fix_reversal $rwid $a $v
1376 + # parentlist is wrong for the last element of arc $a
1377 + # even if displayorder is right, hence the 3rd arg here
1378 + modify_arc $v $a [expr {[llength $varccommits($v,$a)] - 1}]
1379 }
1380 }
1381
@@ -1395,19 +1395,19 @@ proc check_interest {id scripts} {
1395
1396 set prefix [string range $id 0 3]
1397 if {[info exists commitinterest($prefix)]} {
1398 - set newlist {}
1399 - foreach {i script} $commitinterest($prefix) {
1400 - if {[string match "$i*" $id]} {
1401 - lappend scripts [string map [list "%I" $id "%P" $i] $script]
1402 - } else {
1403 - lappend newlist $i $script
1404 - }
1405 - }
1406 - if {$newlist ne {}} {
1407 - set commitinterest($prefix) $newlist
1408 - } else {
1409 - unset commitinterest($prefix)
1410 - }
1398 + set newlist {}
1399 + foreach {i script} $commitinterest($prefix) {
1400 + if {[string match "$i*" $id]} {
1401 + lappend scripts [string map [list "%I" $id "%P" $i] $script]
1402 + } else {
1403 + lappend newlist $i $script
1404 + }
1405 + }
1406 + if {$newlist ne {}} {
1407 + set commitinterest($prefix) $newlist
1408 + } else {
1409 + unset commitinterest($prefix)
1410 + }
1411 }
1412 return $scripts
1413 }
@@ -1422,192 +1422,192 @@ proc getcommitlines {fd inst view updating} {
1422 set stuff [read $fd 500000]
1423 # git log doesn't terminate the last commit with a null...
1424 if {$stuff == {} && $leftover($inst) ne {} && [eof $fd]} {
1425 - set stuff "\0"
1425 + set stuff "\0"
1426 }
1427 if {$stuff == {}} {
1428 - if {![eof $fd]} {
1429 - return 1
1430 - }
1431 - global commfd viewcomplete viewactive viewname
1432 - global viewinstances
1433 - unset commfd($inst)
1434 - set i [lsearch -exact $viewinstances($view) $inst]
1435 - if {$i >= 0} {
1436 - set viewinstances($view) [lreplace $viewinstances($view) $i $i]
1437 - }
1438 - # set it blocking so we wait for the process to terminate
1439 - fconfigure $fd -blocking 1
1440 - if {[catch {close $fd} err]} {
1441 - set fv {}
1442 - if {$view != $curview} {
1443 - set fv " for the \"$viewname($view)\" view"
1444 - }
1445 - if {[string range $err 0 4] == "usage"} {
1446 - set err "Gitk: error reading commits$fv:\
1447 - bad arguments to git log."
1448 - if {$viewname($view) eq [mc "Command line"]} {
1449 - append err \
1450 - " (Note: arguments to gitk are passed to git log\
1451 - to allow selection of commits to be displayed.)"
1452 - }
1453 - } else {
1454 - set err "Error reading commits$fv: $err"
1455 - }
1456 - error_popup $err
1457 - }
1458 - if {[incr viewactive($view) -1] <= 0} {
1459 - set viewcomplete($view) 1
1460 - # Check if we have seen any ids listed as parents that haven't
1461 - # appeared in the list
1462 - closevarcs $view
1463 - notbusy $view
1464 - }
1465 - if {$view == $curview} {
1466 - run chewcommits
1467 - }
1468 - return 0
1428 + if {![eof $fd]} {
1429 + return 1
1430 + }
1431 + global commfd viewcomplete viewactive viewname
1432 + global viewinstances
1433 + unset commfd($inst)
1434 + set i [lsearch -exact $viewinstances($view) $inst]
1435 + if {$i >= 0} {
1436 + set viewinstances($view) [lreplace $viewinstances($view) $i $i]
1437 + }
1438 + # set it blocking so we wait for the process to terminate
1439 + fconfigure $fd -blocking 1
1440 + if {[catch {close $fd} err]} {
1441 + set fv {}
1442 + if {$view != $curview} {
1443 + set fv " for the \"$viewname($view)\" view"
1444 + }
1445 + if {[string range $err 0 4] == "usage"} {
1446 + set err "Gitk: error reading commits$fv:\
1447 + bad arguments to git log."
1448 + if {$viewname($view) eq [mc "Command line"]} {
1449 + append err \
1450 + " (Note: arguments to gitk are passed to git log\
1451 + to allow selection of commits to be displayed.)"
1452 + }
1453 + } else {
1454 + set err "Error reading commits$fv: $err"
1455 + }
1456 + error_popup $err
1457 + }
1458 + if {[incr viewactive($view) -1] <= 0} {
1459 + set viewcomplete($view) 1
1460 + # Check if we have seen any ids listed as parents that haven't
1461 + # appeared in the list
1462 + closevarcs $view
1463 + notbusy $view
1464 + }
1465 + if {$view == $curview} {
1466 + run chewcommits
1467 + }
1468 + return 0
1469 }
1470 set start 0
1471 set gotsome 0
1472 set scripts {}
1473 while 1 {
1474 - set i [string first "\0" $stuff $start]
1475 - if {$i < 0} {
1476 - append leftover($inst) [string range $stuff $start end]
1477 - break
1478 - }
1479 - if {$start == 0} {
1480 - set cmit $leftover($inst)
1481 - append cmit [string range $stuff 0 [expr {$i - 1}]]
1482 - set leftover($inst) {}
1483 - } else {
1484 - set cmit [string range $stuff $start [expr {$i - 1}]]
1485 - }
1486 - set start [expr {$i + 1}]
1487 - set j [string first "\n" $cmit]
1488 - set ok 0
1489 - set listed 1
1490 - if {$j >= 0 && [string match "commit *" $cmit]} {
1491 - set ids [string range $cmit 7 [expr {$j - 1}]]
1492 - if {[string match {[-^<>]*} $ids]} {
1493 - switch -- [string index $ids 0] {
1494 - "-" {set listed 0}
1495 - "^" {set listed 2}
1496 - "<" {set listed 3}
1497 - ">" {set listed 4}
1498 - }
1499 - set ids [string range $ids 1 end]
1500 - }
1501 - set ok 1
1502 - foreach id $ids {
1503 - if {[string length $id] != 40} {
1504 - set ok 0
1505 - break
1506 - }
1507 - }
1508 - }
1509 - if {!$ok} {
1510 - set shortcmit $cmit
1511 - if {[string length $shortcmit] > 80} {
1512 - set shortcmit "[string range $shortcmit 0 80]..."
1513 - }
1514 - error_popup "[mc "Can't parse git log output:"] {$shortcmit}"
1515 - exit 1
1516 - }
1517 - set id [lindex $ids 0]
1518 - set vid $view,$id
1519 -
1520 - lappend vshortids($view,[string range $id 0 3]) $id
1521 -
1522 - if {!$listed && $updating && ![info exists varcid($vid)] &&
1523 - $vfilelimit($view) ne {}} {
1524 - # git log doesn't rewrite parents for unlisted commits
1525 - # when doing path limiting, so work around that here
1526 - # by working out the rewritten parent with git rev-list
1527 - # and if we already know about it, using the rewritten
1528 - # parent as a substitute parent for $id's children.
1529 - if {![catch {
1530 - set rwid [exec git rev-list --first-parent --max-count=1 \
1531 - $id -- $vfilelimit($view)]
1532 - }]} {
1533 - if {$rwid ne {} && [info exists varcid($view,$rwid)]} {
1534 - # use $rwid in place of $id
1535 - rewrite_commit $view $id $rwid
1536 - continue
1537 - }
1538 - }
1539 - }
1540 -
1541 - set a 0
1542 - if {[info exists varcid($vid)]} {
1543 - if {$cmitlisted($vid) || !$listed} continue
1544 - set a $varcid($vid)
1545 - }
1546 - if {$listed} {
1547 - set olds [lrange $ids 1 end]
1548 - } else {
1549 - set olds {}
1550 - }
1551 - set commitdata($id) [string range $cmit [expr {$j + 1}] end]
1552 - set cmitlisted($vid) $listed
1553 - set parents($vid) $olds
1554 - if {![info exists children($vid)]} {
1555 - set children($vid) {}
1556 - } elseif {$a == 0 && [llength $children($vid)] == 1} {
1557 - set k [lindex $children($vid) 0]
1558 - if {[llength $parents($view,$k)] == 1 &&
1559 - (!$vdatemode($view) ||
1560 - $varcid($view,$k) == [llength $varctok($view)] - 1)} {
1561 - set a $varcid($view,$k)
1562 - }
1563 - }
1564 - if {$a == 0} {
1565 - # new arc
1566 - set a [newvarc $view $id]
1567 - }
1568 - if {[string compare [lindex $varctok($view) $a] $vtokmod($view)] < 0} {
1569 - modify_arc $view $a
1570 - }
1571 - if {![info exists varcid($vid)]} {
1572 - set varcid($vid) $a
1573 - lappend varccommits($view,$a) $id
1574 - incr commitidx($view)
1575 - }
1576 -
1577 - set i 0
1578 - foreach p $olds {
1579 - if {$i == 0 || [lsearch -exact $olds $p] >= $i} {
1580 - set vp $view,$p
1581 - if {[llength [lappend children($vp) $id]] > 1 &&
1582 - [vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {
1583 - set children($vp) [lsort -command [list vtokcmp $view] \
1584 - $children($vp)]
1585 - unset -nocomplain ordertok
1586 - }
1587 - if {[info exists varcid($view,$p)]} {
1588 - fix_reversal $p $a $view
1589 - }
1590 - }
1591 - incr i
1592 - }
1593 -
1594 - set scripts [check_interest $id $scripts]
1595 - set gotsome 1
1474 + set i [string first "\0" $stuff $start]
1475 + if {$i < 0} {
1476 + append leftover($inst) [string range $stuff $start end]
1477 + break
1478 + }
1479 + if {$start == 0} {
1480 + set cmit $leftover($inst)
1481 + append cmit [string range $stuff 0 [expr {$i - 1}]]
1482 + set leftover($inst) {}
1483 + } else {
1484 + set cmit [string range $stuff $start [expr {$i - 1}]]
1485 + }
1486 + set start [expr {$i + 1}]
1487 + set j [string first "\n" $cmit]
1488 + set ok 0
1489 + set listed 1
1490 + if {$j >= 0 && [string match "commit *" $cmit]} {
1491 + set ids [string range $cmit 7 [expr {$j - 1}]]
1492 + if {[string match {[-^<>]*} $ids]} {
1493 + switch -- [string index $ids 0] {
1494 + "-" {set listed 0}
1495 + "^" {set listed 2}
1496 + "<" {set listed 3}
1497 + ">" {set listed 4}
1498 + }
1499 + set ids [string range $ids 1 end]
1500 + }
1501 + set ok 1
1502 + foreach id $ids {
1503 + if {[string length $id] != 40} {
1504 + set ok 0
1505 + break
1506 + }
1507 + }
1508 + }
1509 + if {!$ok} {
1510 + set shortcmit $cmit
1511 + if {[string length $shortcmit] > 80} {
1512 + set shortcmit "[string range $shortcmit 0 80]..."
1513 + }
1514 + error_popup "[mc "Can't parse git log output:"] {$shortcmit}"
1515 + exit 1
1516 + }
1517 + set id [lindex $ids 0]
1518 + set vid $view,$id
1519 +
1520 + lappend vshortids($view,[string range $id 0 3]) $id
1521 +
1522 + if {!$listed && $updating && ![info exists varcid($vid)] &&
1523 + $vfilelimit($view) ne {}} {
1524 + # git log doesn't rewrite parents for unlisted commits
1525 + # when doing path limiting, so work around that here
1526 + # by working out the rewritten parent with git rev-list
1527 + # and if we already know about it, using the rewritten
1528 + # parent as a substitute parent for $id's children.
1529 + if {![catch {
1530 + set rwid [exec git rev-list --first-parent --max-count=1 \
1531 + $id -- $vfilelimit($view)]
1532 + }]} {
1533 + if {$rwid ne {} && [info exists varcid($view,$rwid)]} {
1534 + # use $rwid in place of $id
1535 + rewrite_commit $view $id $rwid
1536 + continue
1537 + }
1538 + }
1539 + }
1540 +
1541 + set a 0
1542 + if {[info exists varcid($vid)]} {
1543 + if {$cmitlisted($vid) || !$listed} continue
1544 + set a $varcid($vid)
1545 + }
1546 + if {$listed} {
1547 + set olds [lrange $ids 1 end]
1548 + } else {
1549 + set olds {}
1550 + }
1551 + set commitdata($id) [string range $cmit [expr {$j + 1}] end]
1552 + set cmitlisted($vid) $listed
1553 + set parents($vid) $olds
1554 + if {![info exists children($vid)]} {
1555 + set children($vid) {}
1556 + } elseif {$a == 0 && [llength $children($vid)] == 1} {
1557 + set k [lindex $children($vid) 0]
1558 + if {[llength $parents($view,$k)] == 1 &&
1559 + (!$vdatemode($view) ||
1560 + $varcid($view,$k) == [llength $varctok($view)] - 1)} {
1561 + set a $varcid($view,$k)
1562 + }
1563 + }
1564 + if {$a == 0} {
1565 + # new arc
1566 + set a [newvarc $view $id]
1567 + }
1568 + if {[string compare [lindex $varctok($view) $a] $vtokmod($view)] < 0} {
1569 + modify_arc $view $a
1570 + }
1571 + if {![info exists varcid($vid)]} {
1572 + set varcid($vid) $a
1573 + lappend varccommits($view,$a) $id
1574 + incr commitidx($view)
1575 + }
1576 +
1577 + set i 0
1578 + foreach p $olds {
1579 + if {$i == 0 || [lsearch -exact $olds $p] >= $i} {
1580 + set vp $view,$p
1581 + if {[llength [lappend children($vp) $id]] > 1 &&
1582 + [vtokcmp $view [lindex $children($vp) end-1] $id] > 0} {
1583 + set children($vp) [lsort -command [list vtokcmp $view] \
1584 + $children($vp)]
1585 + unset -nocomplain ordertok
1586 + }
1587 + if {[info exists varcid($view,$p)]} {
1588 + fix_reversal $p $a $view
1589 + }
1590 + }
1591 + incr i
1592 + }
1593 +
1594 + set scripts [check_interest $id $scripts]
1595 + set gotsome 1
1596 }
1597 if {$gotsome} {
1598 - global numcommits hlview
1599 -
1600 - if {$view == $curview} {
1601 - set numcommits $commitidx($view)
1602 - run chewcommits
1603 - }
1604 - if {[info exists hlview] && $view == $hlview} {
1605 - # we never actually get here...
1606 - run vhighlightmore
1607 - }
1608 - foreach s $scripts {
1609 - eval $s
1610 - }
1598 + global numcommits hlview
1599 +
1600 + if {$view == $curview} {
1601 + set numcommits $commitidx($view)
1602 + run chewcommits
1603 + }
1604 + if {[info exists hlview] && $view == $hlview} {
1605 + # we never actually get here...
1606 + run vhighlightmore
1607 + }
1608 + foreach s $scripts {
1609 + eval $s
1610 + }
1611 }
1612 return 2
1613 }
@@ -1618,28 +1618,28 @@ proc chewcommits {} {
1618
1619 layoutmore
1620 if {$viewcomplete($curview)} {
1621 - global commitidx varctok
1622 - global numcommits startmsecs
1623 -
1624 - if {[info exists pending_select]} {
1625 - update
1626 - reset_pending_select {}
1627 -
1628 - if {[commitinview $pending_select $curview]} {
1629 - selectline [rowofcommit $pending_select] 1
1630 - } else {
1631 - set row [first_real_row]
1632 - selectline $row 1
1633 - }
1634 - }
1635 - if {$commitidx($curview) > 0} {
1636 - #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
1637 - #puts "overall $ms ms for $numcommits commits"
1638 - #puts "[llength $varctok($view)] arcs, $commitidx($view) commits"
1639 - } else {
1640 - show_status [mc "No commits selected"]
1641 - }
1642 - notbusy layout
1621 + global commitidx varctok
1622 + global numcommits startmsecs
1623 +
1624 + if {[info exists pending_select]} {
1625 + update
1626 + reset_pending_select {}
1627 +
1628 + if {[commitinview $pending_select $curview]} {
1629 + selectline [rowofcommit $pending_select] 1
1630 + } else {
1631 + set row [first_real_row]
1632 + selectline $row 1
1633 + }
1634 + }
1635 + if {$commitidx($curview) > 0} {
1636 + #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
1637 + #puts "overall $ms ms for $numcommits commits"
1638 + #puts "[llength $varctok($view)] arcs, $commitidx($view) commits"
1639 + } else {
1640 + show_status [mc "No commits selected"]
1641 + }
1642 + notbusy layout
1643 }
1644 return 0
1645 }
@@ -1652,7 +1652,7 @@ proc do_readcommit {id} {
1652 # Read the results using i18n.logoutputencoding
1653 fconfigure $fd -translation lf -eofchar {}
1654 if {$tclencoding != {}} {
1655 - fconfigure $fd -encoding $tclencoding
1655 + fconfigure $fd -encoding $tclencoding
1656 }
1657 set contents [read $fd]
1658 close $fd
@@ -1679,44 +1679,44 @@ proc parsecommit {id contents listed} {
1679 set comdate {}
1680 set hdrend [string first "\n\n" $contents]
1681 if {$hdrend < 0} {
1682 - # should never happen...
1683 - set hdrend [string length $contents]
1682 + # should never happen...
1683 + set hdrend [string length $contents]
1684 }
1685 set header [string range $contents 0 [expr {$hdrend - 1}]]
1686 set comment [string range $contents [expr {$hdrend + 2}] end]
1687 foreach line [split $header "\n"] {
1688 - set line [split $line " "]
1689 - set tag [lindex $line 0]
1690 - if {$tag == "author"} {
1691 - set audate [lrange $line end-1 end]
1692 - set auname [join [lrange $line 1 end-2] " "]
1693 - } elseif {$tag == "committer"} {
1694 - set comdate [lrange $line end-1 end]
1695 - set comname [join [lrange $line 1 end-2] " "]
1696 - }
1688 + set line [split $line " "]
1689 + set tag [lindex $line 0]
1690 + if {$tag == "author"} {
1691 + set audate [lrange $line end-1 end]
1692 + set auname [join [lrange $line 1 end-2] " "]
1693 + } elseif {$tag == "committer"} {
1694 + set comdate [lrange $line end-1 end]
1695 + set comname [join [lrange $line 1 end-2] " "]
1696 + }
1697 }
1698 set headline {}
1699 # take the first non-blank line of the comment as the headline
1700 set headline [string trimleft $comment]
1701 set i [string first "\n" $headline]
1702 if {$i >= 0} {
1703 - set headline [string range $headline 0 $i]
1703 + set headline [string range $headline 0 $i]
1704 }
1705 set headline [string trimright $headline]
1706 set i [string first "\r" $headline]
1707 if {$i >= 0} {
1708 - set headline [string trimright [string range $headline 0 $i]]
1708 + set headline [string trimright [string range $headline 0 $i]]
1709 }
1710 if {!$listed} {
1711 - # git log indents the comment by 4 spaces;
1712 - # if we got this via git cat-file, add the indentation
1713 - set newcomment {}
1714 - foreach line [split $comment "\n"] {
1715 - append newcomment " "
1716 - append newcomment $line
1717 - append newcomment "\n"
1718 - }
1719 - set comment $newcomment
1711 + # git log indents the comment by 4 spaces;
1712 + # if we got this via git cat-file, add the indentation
1713 + set newcomment {}
1714 + foreach line [split $comment "\n"] {
1715 + append newcomment " "
1716 + append newcomment $line
1717 + append newcomment "\n"
1718 + }
1719 + set comment $newcomment
1720 }
1721 set hasnote [string first "\nNotes:\n" $contents]
1722 set diff ""
@@ -1725,23 +1725,23 @@ proc parsecommit {id contents listed} {
1725 # diff.
1726 set i [string first "\n\ndiff" $comment]
1727 if {$i >= 0} {
1728 - set diff [string range $comment $i+1 end]
1729 - set comment [string range $comment 0 $i-1]
1728 + set diff [string range $comment $i+1 end]
1729 + set comment [string range $comment 0 $i-1]
1730 }
1731 set commitinfo($id) [list $headline $auname $audate \
1732 - $comname $comdate $comment $hasnote $diff]
1732 + $comname $comdate $comment $hasnote $diff]
1733 }
1734
1735 proc getcommit {id} {
1736 global commitdata commitinfo
1737
1738 if {[info exists commitdata($id)]} {
1739 - parsecommit $id $commitdata($id) 1
1739 + parsecommit $id $commitdata($id) 1
1740 } else {
1741 - readcommit $id
1742 - if {![info exists commitinfo($id)]} {
1743 - set commitinfo($id) [list [mc "No commit information available"]]
1744 - }
1741 + readcommit $id
1742 + if {![info exists commitinfo($id)]} {
1743 + set commitinfo($id) [list [mc "No commit information available"]]
1744 + }
1745 }
1746 return 1
1747 }
@@ -1754,22 +1754,22 @@ proc longid {prefix} {
1754
1755 set ids {}
1756 if {[string length $prefix] >= 4} {
1757 - set vshortid $curview,[string range $prefix 0 3]
1758 - if {[info exists vshortids($vshortid)]} {
1759 - foreach id $vshortids($vshortid) {
1760 - if {[string match "$prefix*" $id]} {
1761 - if {[lsearch -exact $ids $id] < 0} {
1762 - lappend ids $id
1763 - if {[llength $ids] >= 2} break
1764 - }
1765 - }
1766 - }
1767 - }
1757 + set vshortid $curview,[string range $prefix 0 3]
1758 + if {[info exists vshortids($vshortid)]} {
1759 + foreach id $vshortids($vshortid) {
1760 + if {[string match "$prefix*" $id]} {
1761 + if {[lsearch -exact $ids $id] < 0} {
1762 + lappend ids $id
1763 + if {[llength $ids] >= 2} break
1764 + }
1765 + }
1766 + }
1767 + }
1768 } else {
1769 - foreach match [array names varcid "$curview,$prefix*"] {
1770 - lappend ids [lindex [split $match ","] 1]
1771 - if {[llength $ids] >= 2} break
1772 - }
1769 + foreach match [array names varcid "$curview,$prefix*"] {
1770 + lappend ids [lindex [split $match ","] 1]
1771 + if {[llength $ids] >= 2} break
1772 + }
1773 }
1774 return $ids
1775 }
@@ -1782,58 +1782,58 @@ proc readrefs {} {
1782 global tclencoding
1783
1784 foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
1785 - unset -nocomplain $v
1785 + unset -nocomplain $v
1786 }
1787 set refd [open [list | git show-ref -d] r]
1788 if {$tclencoding != {}} {
1789 - fconfigure $refd -encoding $tclencoding
1789 + fconfigure $refd -encoding $tclencoding
1790 }
1791 while {[gets $refd line] >= 0} {
1792 - if {[string index $line 40] ne " "} continue
1793 - set id [string range $line 0 39]
1794 - set ref [string range $line 41 end]
1795 - if {![string match "refs/*" $ref]} continue
1796 - set name [string range $ref 5 end]
1797 - if {[string match "remotes/*" $name]} {
1798 - if {![string match "*/HEAD" $name] && !$hideremotes} {
1799 - set headids($name) $id
1800 - lappend idheads($id) $name
1801 - }
1802 - } elseif {[string match "heads/*" $name]} {
1803 - set name [string range $name 6 end]
1804 - set headids($name) $id
1805 - lappend idheads($id) $name
1806 - } elseif {[string match "tags/*" $name]} {
1807 - # this lets refs/tags/foo^{} overwrite refs/tags/foo,
1808 - # which is what we want since the former is the commit ID
1809 - set name [string range $name 5 end]
1810 - if {[string match "*^{}" $name]} {
1811 - set name [string range $name 0 end-3]
1812 - } else {
1813 - set tagobjid($name) $id
1814 - }
1815 - set tagids($name) $id
1816 - lappend idtags($id) $name
1817 - } else {
1818 - set otherrefids($name) $id
1819 - lappend idotherrefs($id) $name
1820 - }
1792 + if {[string index $line 40] ne " "} continue
1793 + set id [string range $line 0 39]
1794 + set ref [string range $line 41 end]
1795 + if {![string match "refs/*" $ref]} continue
1796 + set name [string range $ref 5 end]
1797 + if {[string match "remotes/*" $name]} {
1798 + if {![string match "*/HEAD" $name] && !$hideremotes} {
1799 + set headids($name) $id
1800 + lappend idheads($id) $name
1801 + }
1802 + } elseif {[string match "heads/*" $name]} {
1803 + set name [string range $name 6 end]
1804 + set headids($name) $id
1805 + lappend idheads($id) $name
1806 + } elseif {[string match "tags/*" $name]} {
1807 + # this lets refs/tags/foo^{} overwrite refs/tags/foo,
1808 + # which is what we want since the former is the commit ID
1809 + set name [string range $name 5 end]
1810 + if {[string match "*^{}" $name]} {
1811 + set name [string range $name 0 end-3]
1812 + } else {
1813 + set tagobjid($name) $id
1814 + }
1815 + set tagids($name) $id
1816 + lappend idtags($id) $name
1817 + } else {
1818 + set otherrefids($name) $id
1819 + lappend idotherrefs($id) $name
1820 + }
1821 }
1822 catch {close $refd}
1823 set mainhead {}
1824 set mainheadid {}
1825 catch {
1826 - set mainheadid [exec git rev-parse HEAD]
1827 - set thehead [exec git symbolic-ref HEAD]
1828 - if {[string match "refs/heads/*" $thehead]} {
1829 - set mainhead [string range $thehead 11 end]
1830 - }
1826 + set mainheadid [exec git rev-parse HEAD]
1827 + set thehead [exec git symbolic-ref HEAD]
1828 + if {[string match "refs/heads/*" $thehead]} {
1829 + set mainhead [string range $thehead 11 end]
1830 + }
1831 }
1832 set selectheadid {}
1833 if {$selecthead ne {}} {
1834 - catch {
1835 - set selectheadid [exec git rev-parse --verify $selecthead]
1836 - }
1834 + catch {
1835 + set selectheadid [exec git rev-parse --verify $selecthead]
1836 + }
1837 }
1838 }
1839
@@ -1842,10 +1842,10 @@ proc first_real_row {} {
1842 global nullid nullid2 numcommits
1843
1844 for {set row 0} {$row < $numcommits} {incr row} {
1845 - set id [commitonrow $row]
1846 - if {$id ne $nullid && $id ne $nullid2} {
1847 - break
1848 - }
1845 + set id [commitonrow $row]
1846 + if {$id ne $nullid && $id ne $nullid2} {
1847 + break
1848 + }
1849 }
1850 return $row
1851 }
@@ -1864,12 +1864,12 @@ proc removehead {id name} {
1864 global headids idheads
1865
1866 if {$idheads($id) eq $name} {
1867 - unset idheads($id)
1867 + unset idheads($id)
1868 } else {
1869 - set i [lsearch -exact $idheads($id) $name]
1870 - if {$i >= 0} {
1871 - set idheads($id) [lreplace $idheads($id) $i $i]
1872 - }
1869 + set i [lsearch -exact $idheads($id) $name]
1870 + if {$i >= 0} {
1871 + set idheads($id) [lreplace $idheads($id) $i $i]
1872 + }
1873 }
1874 unset headids($name)
1875 }
@@ -1897,7 +1897,7 @@ proc make_transient {window origin} {
1897 # Windows fails to place transient windows normally, so
1898 # schedule a callback to center them on the parent.
1899 if {[tk windowingsystem] eq {win32}} {
1900 - after idle [list tk::PlaceWindow $window widget $origin]
1900 + after idle [list tk::PlaceWindow $window widget $origin]
1901 }
1902 }
1903
@@ -1997,41 +1997,41 @@ proc setttkstyle {} {
1997 proc makemenu {m items} {
1998 menu $m
1999 if {[tk windowingsystem] eq {aqua}} {
2000 - set Meta1 Cmd
2000 + set Meta1 Cmd
2001 } else {
2002 - set Meta1 Ctrl
2002 + set Meta1 Ctrl
2003 }
2004 foreach i $items {
2005 - set name [mc [lindex $i 1]]
2006 - set type [lindex $i 2]
2007 - set thing [lindex $i 3]
2008 - set params [list $type]
2009 - if {$name ne {}} {
2010 - set u [string first "&" [string map {&& x} $name]]
2011 - lappend params -label [string map {&& & & {}} $name]
2012 - if {$u >= 0} {
2013 - lappend params -underline $u
2014 - }
2015 - }
2016 - switch -- $type {
2017 - "cascade" {
2018 - set submenu [string tolower [string map {& ""} [lindex $i 1]]]
2019 - lappend params -menu $m.$submenu
2020 - }
2021 - "command" {
2022 - lappend params -command $thing
2023 - }
2024 - "radiobutton" {
2025 - lappend params -variable [lindex $thing 0] \
2026 - -value [lindex $thing 1]
2027 - }
2028 - }
2029 - set tail [lrange $i 4 end]
2030 - regsub -all {\yMeta1\y} $tail $Meta1 tail
2031 - eval $m add $params $tail
2032 - if {$type eq "cascade"} {
2033 - makemenu $m.$submenu $thing
2034 - }
2005 + set name [mc [lindex $i 1]]
2006 + set type [lindex $i 2]
2007 + set thing [lindex $i 3]
2008 + set params [list $type]
2009 + if {$name ne {}} {
2010 + set u [string first "&" [string map {&& x} $name]]
2011 + lappend params -label [string map {&& & & {}} $name]
2012 + if {$u >= 0} {
2013 + lappend params -underline $u
2014 + }
2015 + }
2016 + switch -- $type {
2017 + "cascade" {
2018 + set submenu [string tolower [string map {& ""} [lindex $i 1]]]
2019 + lappend params -menu $m.$submenu
2020 + }
2021 + "command" {
2022 + lappend params -command $thing
2023 + }
2024 + "radiobutton" {
2025 + lappend params -variable [lindex $thing 0] \
2026 + -value [lindex $thing 1]
2027 + }
2028 + }
2029 + set tail [lrange $i 4 end]
2030 + regsub -all {\yMeta1\y} $tail $Meta1 tail
2031 + eval $m add $params $tail
2032 + if {$type eq "cascade"} {
2033 + makemenu $m.$submenu $thing
2034 + }
2035 }
2036 }
2037
@@ -2051,12 +2051,12 @@ proc makedroplist {w varname args} {
2051 set cx [string length $label]
2052 if {$cx > $width} {set width $cx}
2053 }
2054 - set gm [ttk::combobox $w -width $width -state readonly\
2055 - -textvariable $varname -values $args \
2056 - -exportselection false]
2057 - bind $gm <<ComboboxSelected>> [list $gm selection clear]
2054 + set gm [ttk::combobox $w -width $width -state readonly\
2055 + -textvariable $varname -values $args \
2056 + -exportselection false]
2057 + bind $gm <<ComboboxSelected>> [list $gm selection clear]
2058 } else {
2059 - set gm [eval [linsert $args 0 tk_optionMenu $w $varname]]
2059 + set gm [eval [linsert $args 0 tk_optionMenu $w $varname]]
2060 }
2061 return $gm
2062 }
@@ -2086,49 +2086,49 @@ proc makewindow {} {
2086 # The "mc" arguments here are purely so that xgettext
2087 # sees the following string as needing to be translated
2088 set file {
2089 - mc "&File" cascade {
2090 - {mc "&Update" command updatecommits -accelerator F5}
2091 - {mc "&Reload" command reloadcommits -accelerator Shift-F5}
2092 - {mc "Reread re&ferences" command rereadrefs}
2093 - {mc "&List references" command showrefs -accelerator F2}
2094 - {xx "" separator}
2095 - {mc "Start git &gui" command {exec git gui &}}
2096 - {xx "" separator}
2097 - {mc "&Quit" command doquit -accelerator Meta1-Q}
2098 - }}
2089 + mc "&File" cascade {
2090 + {mc "&Update" command updatecommits -accelerator F5}
2091 + {mc "&Reload" command reloadcommits -accelerator Shift-F5}
2092 + {mc "Reread re&ferences" command rereadrefs}
2093 + {mc "&List references" command showrefs -accelerator F2}
2094 + {xx "" separator}
2095 + {mc "Start git &gui" command {exec git gui &}}
2096 + {xx "" separator}
2097 + {mc "&Quit" command doquit -accelerator Meta1-Q}
2098 + }}
2099 set edit {
2100 - mc "&Edit" cascade {
2101 - {mc "&Preferences" command doprefs}
2102 - }}
2100 + mc "&Edit" cascade {
2101 + {mc "&Preferences" command doprefs}
2102 + }}
2103 set view {
2104 - mc "&View" cascade {
2105 - {mc "&New view..." command {newview 0} -accelerator Shift-F4}
2106 - {mc "&Edit view..." command editview -state disabled -accelerator F4}
2107 - {mc "&Delete view" command delview -state disabled}
2108 - {xx "" separator}
2109 - {mc "&All files" radiobutton {selectedview 0} -command {showview 0}}
2110 - }}
2104 + mc "&View" cascade {
2105 + {mc "&New view..." command {newview 0} -accelerator Shift-F4}
2106 + {mc "&Edit view..." command editview -state disabled -accelerator F4}
2107 + {mc "&Delete view" command delview -state disabled}
2108 + {xx "" separator}
2109 + {mc "&All files" radiobutton {selectedview 0} -command {showview 0}}
2110 + }}
2111 if {[tk windowingsystem] ne "aqua"} {
2112 - set help {
2113 - mc "&Help" cascade {
2114 - {mc "&About gitk" command about}
2115 - {mc "&Key bindings" command keys}
2116 - }}
2117 - set bar [list $file $edit $view $help]
2112 + set help {
2113 + mc "&Help" cascade {
2114 + {mc "&About gitk" command about}
2115 + {mc "&Key bindings" command keys}
2116 + }}
2117 + set bar [list $file $edit $view $help]
2118 } else {
2119 - proc ::tk::mac::ShowPreferences {} {doprefs}
2120 - proc ::tk::mac::Quit {} {doquit}
2121 - lset file end [lreplace [lindex $file end] end-1 end]
2122 - set apple {
2123 - xx "&Apple" cascade {
2124 - {mc "&About gitk" command about}
2125 - {xx "" separator}
2126 - }}
2127 - set help {
2128 - mc "&Help" cascade {
2129 - {mc "&Key bindings" command keys}
2130 - }}
2131 - set bar [list $apple $file $view $help]
2119 + proc ::tk::mac::ShowPreferences {} {doprefs}
2120 + proc ::tk::mac::Quit {} {doquit}
2121 + lset file end [lreplace [lindex $file end] end-1 end]
2122 + set apple {
2123 + xx "&Apple" cascade {
2124 + {mc "&About gitk" command about}
2125 + {xx "" separator}
2126 + }}
2127 + set help {
2128 + mc "&Help" cascade {
2129 + {mc "&Key bindings" command keys}
2130 + }}
2131 + set bar [list $apple $file $view $help]
2132 }
2133 makemenu .bar $bar
2134 . configure -menu .bar
@@ -2156,36 +2156,36 @@ proc makewindow {} {
2156 ${NS}::frame .tf.histframe
2157 ${NS}::panedwindow .tf.histframe.pwclist -orient horizontal
2158 if {!$use_ttk} {
2159 - .tf.histframe.pwclist configure -sashpad 0 -handlesize 4
2159 + .tf.histframe.pwclist configure -sashpad 0 -handlesize 4
2160 }
2161
2162 # create three canvases
2163 set cscroll .tf.histframe.csb
2164 set canv .tf.histframe.pwclist.canv
2165 canvas $canv \
2166 - -selectbackground $selectbgcolor \
2167 - -background $bgcolor -bd 0 \
2168 - -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
2166 + -selectbackground $selectbgcolor \
2167 + -background $bgcolor -bd 0 \
2168 + -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
2169 .tf.histframe.pwclist add $canv
2170 set canv2 .tf.histframe.pwclist.canv2
2171 canvas $canv2 \
2172 - -selectbackground $selectbgcolor \
2173 - -background $bgcolor -bd 0 -yscrollincr $linespc
2172 + -selectbackground $selectbgcolor \
2173 + -background $bgcolor -bd 0 -yscrollincr $linespc
2174 .tf.histframe.pwclist add $canv2
2175 set canv3 .tf.histframe.pwclist.canv3
2176 canvas $canv3 \
2177 - -selectbackground $selectbgcolor \
2178 - -background $bgcolor -bd 0 -yscrollincr $linespc
2177 + -selectbackground $selectbgcolor \
2178 + -background $bgcolor -bd 0 -yscrollincr $linespc
2179 .tf.histframe.pwclist add $canv3
2180 if {$use_ttk} {
2181 - bind .tf.histframe.pwclist <Map> {
2182 - bind %W <Map> {}
2183 - .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0]
2184 - .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0]
2185 - }
2181 + bind .tf.histframe.pwclist <Map> {
2182 + bind %W <Map> {}
2183 + .tf.histframe.pwclist sashpos 1 [lindex $::geometry(pwsash1) 0]
2184 + .tf.histframe.pwclist sashpos 0 [lindex $::geometry(pwsash0) 0]
2185 + }
2186 } else {
2187 - eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)
2188 - eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)
2187 + eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)
2188 + eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)
2189 }
2190
2191 # a scroll bar to rule them
@@ -2204,7 +2204,7 @@ proc makewindow {} {
2204 set entries $sha1entry
2205 set sha1but .tf.bar.sha1label
2206 button $sha1but -text "[mc "SHA1 ID:"] " -state disabled -relief flat \
2207 - -command gotocommit -width 8
2207 + -command gotocommit -width 8
2208 $sha1but conf -disabledforeground [$sha1but cget -foreground]
2209 pack .tf.bar.sha1label -side left
2210 ${NS}::entry $sha1entry -width 40 -font textfont -textvariable sha1string
@@ -2212,20 +2212,20 @@ proc makewindow {} {
2212 pack $sha1entry -side left -pady 2
2213
2214 set bm_left_data {
2215 - #define left_width 16
2216 - #define left_height 16
2217 - static unsigned char left_bits[] = {
2218 - 0x00, 0x00, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00,
2219 - 0x0e, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x0e, 0x00, 0x1c, 0x00,
2220 - 0x38, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x01};
2215 + #define left_width 16
2216 + #define left_height 16
2217 + static unsigned char left_bits[] = {
2218 + 0x00, 0x00, 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1c, 0x00,
2219 + 0x0e, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x0e, 0x00, 0x1c, 0x00,
2220 + 0x38, 0x00, 0x70, 0x00, 0xe0, 0x00, 0xc0, 0x01};
2221 }
2222 set bm_right_data {
2223 - #define right_width 16
2224 - #define right_height 16
2225 - static unsigned char right_bits[] = {
2226 - 0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c,
2227 - 0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c,
2228 - 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01};
2223 + #define right_width 16
2224 + #define right_height 16
2225 + static unsigned char right_bits[] = {
2226 + 0x00, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x07, 0x00, 0x0e, 0x00, 0x1c,
2227 + 0x00, 0x38, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x00, 0x38, 0x00, 0x1c,
2228 + 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01};
2229 }
2230 image create bitmap bm-left -data $bm_left_data -foreground $uifgcolor
2231 image create bitmap bm-left-gray -data $bm_left_data -foreground $uifgdisabledcolor
@@ -2234,28 +2234,28 @@ proc makewindow {} {
2234
2235 ${NS}::button .tf.bar.leftbut -command goback -state disabled -width 26
2236 if {$use_ttk} {
2237 - .tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]
2237 + .tf.bar.leftbut configure -image [list bm-left disabled bm-left-gray]
2238 } else {
2239 - .tf.bar.leftbut configure -image bm-left
2239 + .tf.bar.leftbut configure -image bm-left
2240 }
2241 pack .tf.bar.leftbut -side left -fill y
2242 ${NS}::button .tf.bar.rightbut -command goforw -state disabled -width 26
2243 if {$use_ttk} {
2244 - .tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]
2244 + .tf.bar.rightbut configure -image [list bm-right disabled bm-right-gray]
2245 } else {
2246 - .tf.bar.rightbut configure -image bm-right
2246 + .tf.bar.rightbut configure -image bm-right
2247 }
2248 pack .tf.bar.rightbut -side left -fill y
2249
2250 ${NS}::label .tf.bar.rowlabel -text [mc "Row"]
2251 set rownumsel {}
2252 ${NS}::label .tf.bar.rownum -width 7 -textvariable rownumsel \
2253 - -relief sunken -anchor e
2253 + -relief sunken -anchor e
2254 ${NS}::label .tf.bar.rowlabel2 -text "/"
2255 ${NS}::label .tf.bar.numcommits -width 7 -textvariable numcommits \
2256 - -relief sunken -anchor e
2256 + -relief sunken -anchor e
2257 pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \
2258 - -side left
2258 + -side left
2259 if {!$use_ttk} {
2260 foreach w {rownum numcommits} {.tf.bar.$w configure -font textfont}
2261 }
@@ -2267,14 +2267,14 @@ proc makewindow {} {
2267 ${NS}::label $statusw -width 15 -relief sunken
2268 pack $statusw -side left -padx 5
2269 if {$use_ttk} {
2270 - set progresscanv [ttk::progressbar .tf.bar.progress]
2270 + set progresscanv [ttk::progressbar .tf.bar.progress]
2271 } else {
2272 - set h [expr {[font metrics uifont -linespace] + 2}]
2273 - set progresscanv .tf.bar.progress
2274 - canvas $progresscanv -relief sunken -height $h -borderwidth 2
2275 - set progressitem [$progresscanv create rect -1 0 0 $h -fill "#00ff00"]
2276 - set fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow]
2277 - set rprogitem [$progresscanv create rect -1 0 0 $h -fill red]
2272 + set h [expr {[font metrics uifont -linespace] + 2}]
2273 + set progresscanv .tf.bar.progress
2274 + canvas $progresscanv -relief sunken -height $h -borderwidth 2
2275 + set progressitem [$progresscanv create rect -1 0 0 $h -fill "#00ff00"]
2276 + set fprogitem [$progresscanv create rect -1 0 0 $h -fill yellow]
2277 + set rprogitem [$progresscanv create rect -1 0 0 $h -fill red]
2278 }
2279 pack $progresscanv -side right -expand 1 -fill x -padx {0 2}
2280 set progresscoords {0 0}
@@ -2288,26 +2288,26 @@ proc makewindow {} {
2288 ${NS}::label .tf.lbar.flabel -text "[mc "Find"] "
2289
2290 set bm_down_data {
2291 - #define down_width 16
2292 - #define down_height 16
2293 - static unsigned char down_bits[] = {
2294 - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
2295 - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
2296 - 0x87, 0xe1, 0x8e, 0x71, 0x9c, 0x39, 0xb8, 0x1d,
2297 - 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01};
2291 + #define down_width 16
2292 + #define down_height 16
2293 + static unsigned char down_bits[] = {
2294 + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
2295 + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
2296 + 0x87, 0xe1, 0x8e, 0x71, 0x9c, 0x39, 0xb8, 0x1d,
2297 + 0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01};
2298 }
2299 image create bitmap bm-down -data $bm_down_data -foreground $uifgcolor
2300 ${NS}::button .tf.lbar.fnext -width 26 -command {dofind 1 1}
2301 .tf.lbar.fnext configure -image bm-down
2302
2303 set bm_up_data {
2304 - #define up_width 16
2305 - #define up_height 16
2306 - static unsigned char up_bits[] = {
2307 - 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,
2308 - 0xb8, 0x1d, 0x9c, 0x39, 0x8e, 0x71, 0x87, 0xe1,
2309 - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
2310 - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01};
2304 + #define up_width 16
2305 + #define up_height 16
2306 + static unsigned char up_bits[] = {
2307 + 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,
2308 + 0xb8, 0x1d, 0x9c, 0x39, 0x8e, 0x71, 0x87, 0xe1,
2309 + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
2310 + 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01};
2311 }
2312 image create bitmap bm-up -data $bm_up_data -foreground $uifgcolor
2313 ${NS}::button .tf.lbar.fprev -width 26 -command {dofind -1 1}
@@ -2316,13 +2316,13 @@ proc makewindow {} {
2316 ${NS}::label .tf.lbar.flab2 -text " [mc "commit"] "
2317
2318 pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \
2319 - -side left -fill y
2319 + -side left -fill y
2320 set gdttype [mc "containing:"]
2321 set gm [makedroplist .tf.lbar.gdttype gdttype \
2322 - [mc "containing:"] \
2323 - [mc "touching paths:"] \
2324 - [mc "adding/removing string:"] \
2325 - [mc "changing lines matching:"]]
2322 + [mc "containing:"] \
2323 + [mc "touching paths:"] \
2324 + [mc "adding/removing string:"] \
2325 + [mc "changing lines matching:"]]
2326 trace add variable gdttype write gdttype_change
2327 pack .tf.lbar.gdttype -side left -fill y
2328
@@ -2333,11 +2333,11 @@ proc makewindow {} {
2333 trace add variable findstring write find_change
2334 set findtype [mc "Exact"]
2335 set findtypemenu [makedroplist .tf.lbar.findtype \
2336 - findtype [mc "Exact"] [mc "IgnCase"] [mc "Regexp"]]
2336 + findtype [mc "Exact"] [mc "IgnCase"] [mc "Regexp"]]
2337 trace add variable findtype write findcom_change
2338 set findloc [mc "All fields"]
2339 makedroplist .tf.lbar.findloc findloc [mc "All fields"] [mc "Headline"] \
2340 - [mc "Comments"] [mc "Author"] [mc "Committer"]
2340 + [mc "Comments"] [mc "Author"] [mc "Committer"]
2341 trace add variable findloc write find_change
2342 pack .tf.lbar.findloc -side right
2343 pack .tf.lbar.findtype -side right
@@ -2349,8 +2349,8 @@ proc makewindow {} {
2349 pack .tf.histframe -fill both -side top -expand 1
2350 .ctop add .tf
2351 if {!$use_ttk} {
2352 - .ctop paneconfigure .tf -height $geometry(topheight)
2353 - .ctop paneconfigure .tf -width $geometry(topwidth)
2352 + .ctop paneconfigure .tf -height $geometry(topheight)
2353 + .ctop paneconfigure .tf -width $geometry(topwidth)
2354 }
2355
2356 # now build up the bottom
@@ -2360,9 +2360,9 @@ proc makewindow {} {
2360 # if we know window height, then that will set the lower text height, otherwise
2361 # we set lower text height which will drive window height
2362 if {[info exists geometry(main)]} {
2363 - ${NS}::frame .bleft -width $geometry(botwidth)
2363 + ${NS}::frame .bleft -width $geometry(botwidth)
2364 } else {
2365 - ${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight)
2365 + ${NS}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight)
2366 }
2367 ${NS}::frame .bleft.top
2368 ${NS}::frame .bleft.mid
@@ -2380,41 +2380,41 @@ proc makewindow {} {
2380 trace add variable searchstring write incrsearch
2381 pack $sstring -side left -expand 1 -fill x
2382 ${NS}::radiobutton .bleft.mid.diff -text [mc "Diff"] \
2383 - -command changediffdisp -variable diffelide -value {0 0}
2383 + -command changediffdisp -variable diffelide -value {0 0}
2384 ${NS}::radiobutton .bleft.mid.old -text [mc "Old version"] \
2385 - -command changediffdisp -variable diffelide -value {0 1}
2385 + -command changediffdisp -variable diffelide -value {0 1}
2386 ${NS}::radiobutton .bleft.mid.new -text [mc "New version"] \
2387 - -command changediffdisp -variable diffelide -value {1 0}
2387 + -command changediffdisp -variable diffelide -value {1 0}
2388
2389 ${NS}::label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: "
2390 pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left -ipadx $wgap
2391 spinbox .bleft.mid.diffcontext -width 5 \
2392 - -from 0 -increment 1 -to 10000000 \
2393 - -validate all -validatecommand "diffcontextvalidate %P" \
2394 - -textvariable diffcontextstring
2392 + -from 0 -increment 1 -to 10000000 \
2393 + -validate all -validatecommand "diffcontextvalidate %P" \
2394 + -textvariable diffcontextstring
2395 .bleft.mid.diffcontext set $diffcontext
2396 trace add variable diffcontextstring write diffcontextchange
2397 lappend entries .bleft.mid.diffcontext
2398 pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left -ipadx $wgap
2399 ${NS}::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
2400 - -command changeignorespace -variable ignorespace
2400 + -command changeignorespace -variable ignorespace
2401 pack .bleft.mid.ignspace -side left -padx 5
2402
2403 set worddiff [mc "Line diff"]
2404 if {[package vcompare $git_version "1.7.2"] >= 0} {
2405 - makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \
2406 - [mc "Markup words"] [mc "Color words"]
2407 - trace add variable worddiff write changeworddiff
2408 - pack .bleft.mid.worddiff -side left -padx 5
2405 + makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \
2406 + [mc "Markup words"] [mc "Color words"]
2407 + trace add variable worddiff write changeworddiff
2408 + pack .bleft.mid.worddiff -side left -padx 5
2409 }
2410
2411 set ctext .bleft.bottom.ctext
2412 text $ctext -background $bgcolor -foreground $fgcolor \
2413 - -state disabled -undo 0 -font textfont \
2414 - -yscrollcommand scrolltext -wrap none \
2415 - -xscrollcommand ".bleft.bottom.sbhorizontal set"
2413 + -state disabled -undo 0 -font textfont \
2414 + -yscrollcommand scrolltext -wrap none \
2415 + -xscrollcommand ".bleft.bottom.sbhorizontal set"
2416 if {$have_tk85} {
2417 - $ctext conf -tabstyle wordprocessor
2417 + $ctext conf -tabstyle wordprocessor
2418 }
2419 ${NS}::scrollbar .bleft.bottom.sb -command "$ctext yview"
2420 ${NS}::scrollbar .bleft.bottom.sbhorizontal -command "$ctext xview" -orient h
@@ -2469,35 +2469,35 @@ proc makewindow {} {
2469
2470 .pwbottom add .bleft
2471 if {!$use_ttk} {
2472 - .pwbottom paneconfigure .bleft -width $geometry(botwidth)
2472 + .pwbottom paneconfigure .bleft -width $geometry(botwidth)
2473 }
2474
2475 # lower right
2476 ${NS}::frame .bright
2477 ${NS}::frame .bright.mode
2478 ${NS}::radiobutton .bright.mode.patch -text [mc "Patch"] \
2479 - -command reselectline -variable cmitmode -value "patch"
2479 + -command reselectline -variable cmitmode -value "patch"
2480 ${NS}::radiobutton .bright.mode.tree -text [mc "Tree"] \
2481 - -command reselectline -variable cmitmode -value "tree"
2481 + -command reselectline -variable cmitmode -value "tree"
2482 grid .bright.mode.patch .bright.mode.tree -sticky ew
2483 pack .bright.mode -side top -fill x
2484 set cflist .bright.cfiles
2485 set indent [font measure mainfont "nn"]
2486 text $cflist \
2487 - -selectbackground $selectbgcolor \
2488 - -background $bgcolor -foreground $fgcolor \
2489 - -font mainfont \
2490 - -tabs [list $indent [expr {2 * $indent}]] \
2491 - -yscrollcommand ".bright.sb set" \
2492 - -cursor [. cget -cursor] \
2493 - -spacing1 1 -spacing3 1
2487 + -selectbackground $selectbgcolor \
2488 + -background $bgcolor -foreground $fgcolor \
2489 + -font mainfont \
2490 + -tabs [list $indent [expr {2 * $indent}]] \
2491 + -yscrollcommand ".bright.sb set" \
2492 + -cursor [. cget -cursor] \
2493 + -spacing1 1 -spacing3 1
2494 lappend bglist $cflist
2495 lappend fglist $cflist
2496 ${NS}::scrollbar .bright.sb -command "$cflist yview"
2497 pack .bright.sb -side right -fill y
2498 pack $cflist -side left -fill both -expand 1
2499 $cflist tag configure highlight \
2500 - -background [$cflist cget -selectbackground]
2500 + -background [$cflist cget -selectbackground]
2501 $cflist tag configure bold -font mainfontbold
2502
2503 .pwbottom add .bright
@@ -2505,15 +2505,15 @@ proc makewindow {} {
2505
2506 # restore window width & height if known
2507 if {[info exists geometry(main)]} {
2508 - if {[scan $geometry(main) "%dx%d" w h] >= 2} {
2509 - if {$w > [winfo screenwidth .]} {
2510 - set w [winfo screenwidth .]
2511 - }
2512 - if {$h > [winfo screenheight .]} {
2513 - set h [winfo screenheight .]
2514 - }
2515 - wm geometry . "${w}x$h"
2516 - }
2508 + if {[scan $geometry(main) "%dx%d" w h] >= 2} {
2509 + if {$w > [winfo screenwidth .]} {
2510 + set w [winfo screenwidth .]
2511 + }
2512 + if {$h > [winfo screenheight .]} {
2513 + set h [winfo screenheight .]
2514 + }
2515 + wm geometry . "${w}x$h"
2516 + }
2517 }
2518
2519 if {[info exists geometry(state)] && $geometry(state) eq "zoomed"} {
@@ -2537,25 +2537,25 @@ proc makewindow {} {
2537 bind %W <Map> {}
2538 %W sashpos 0 $::geometry(botwidth)
2539 }
2540 - bind .pwbottom <Configure> {resizecdetpanes %W %w}
2540 + bind .pwbottom <Configure> {resizecdetpanes %W %w}
2541 }
2542
2543 pack .ctop -fill both -expand 1
2544 bindall <1> {selcanvline %W %x %y}
2545 #bindall <B1-Motion> {selcanvline %W %x %y}
2546 if {[tk windowingsystem] == "win32"} {
2547 - bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }
2548 - bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }
2547 + bind . <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D }
2548 + bind $ctext <MouseWheel> { windows_mousewheel_redirector %W %X %Y %D ; break }
2549 } else {
2550 - bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
2551 - bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
2552 - bind $ctext <Button> {
2553 - if {"%b" eq 6} {
2554 - $ctext xview scroll -5 units
2555 - } elseif {"%b" eq 7} {
2556 - $ctext xview scroll 5 units
2557 - }
2558 - }
2550 + bindall <ButtonRelease-4> "allcanvs yview scroll -5 units"
2551 + bindall <ButtonRelease-5> "allcanvs yview scroll 5 units"
2552 + bind $ctext <Button> {
2553 + if {"%b" eq 6} {
2554 + $ctext xview scroll -5 units
2555 + } elseif {"%b" eq 7} {
2556 + $ctext xview scroll 5 units
2557 + }
2558 + }
2559 if {[tk windowingsystem] eq "aqua"} {
2560 bindall <MouseWheel> {
2561 set delta [expr {- (%D)}]
@@ -2638,7 +2638,7 @@ proc makewindow {} {
2638 bind $ctext <Button-1> {focus %W}
2639 bind $ctext <<Selection>> rehighlight_search_results
2640 for {set i 1} {$i < 10} {incr i} {
2641 - bind . <$M1B-Key-$i> [list go_to_parent $i]
2641 + bind . <$M1B-Key-$i> [list go_to_parent $i]
2642 }
2643
2644 set maincursor [. cget -cursor]
@@ -2647,60 +2647,60 @@ proc makewindow {} {
2647
2648 set rowctxmenu .rowctxmenu
2649 makemenu $rowctxmenu {
2650 - {mc "Diff this -> selected" command {diffvssel 0}}
2651 - {mc "Diff selected -> this" command {diffvssel 1}}
2652 - {mc "Make patch" command mkpatch}
2653 - {mc "Create tag" command mktag}
2654 - {mc "Copy commit reference" command copyreference}
2655 - {mc "Write commit to file" command writecommit}
2656 - {mc "Create new branch" command mkbranch}
2657 - {mc "Cherry-pick this commit" command cherrypick}
2658 - {mc "Reset HEAD branch to here" command resethead}
2659 - {mc "Mark this commit" command markhere}
2660 - {mc "Return to mark" command gotomark}
2661 - {mc "Find descendant of this and mark" command find_common_desc}
2662 - {mc "Compare with marked commit" command compare_commits}
2663 - {mc "Diff this -> marked commit" command {diffvsmark 0}}
2664 - {mc "Diff marked commit -> this" command {diffvsmark 1}}
2665 - {mc "Revert this commit" command revert}
2650 + {mc "Diff this -> selected" command {diffvssel 0}}
2651 + {mc "Diff selected -> this" command {diffvssel 1}}
2652 + {mc "Make patch" command mkpatch}
2653 + {mc "Create tag" command mktag}
2654 + {mc "Copy commit reference" command copyreference}
2655 + {mc "Write commit to file" command writecommit}
2656 + {mc "Create new branch" command mkbranch}
2657 + {mc "Cherry-pick this commit" command cherrypick}
2658 + {mc "Reset HEAD branch to here" command resethead}
2659 + {mc "Mark this commit" command markhere}
2660 + {mc "Return to mark" command gotomark}
2661 + {mc "Find descendant of this and mark" command find_common_desc}
2662 + {mc "Compare with marked commit" command compare_commits}
2663 + {mc "Diff this -> marked commit" command {diffvsmark 0}}
2664 + {mc "Diff marked commit -> this" command {diffvsmark 1}}
2665 + {mc "Revert this commit" command revert}
2666 }
2667 $rowctxmenu configure -tearoff 0
2668
2669 set fakerowmenu .fakerowmenu
2670 makemenu $fakerowmenu {
2671 - {mc "Diff this -> selected" command {diffvssel 0}}
2672 - {mc "Diff selected -> this" command {diffvssel 1}}
2673 - {mc "Make patch" command mkpatch}
2674 - {mc "Diff this -> marked commit" command {diffvsmark 0}}
2675 - {mc "Diff marked commit -> this" command {diffvsmark 1}}
2671 + {mc "Diff this -> selected" command {diffvssel 0}}
2672 + {mc "Diff selected -> this" command {diffvssel 1}}
2673 + {mc "Make patch" command mkpatch}
2674 + {mc "Diff this -> marked commit" command {diffvsmark 0}}
2675 + {mc "Diff marked commit -> this" command {diffvsmark 1}}
2676 }
2677 $fakerowmenu configure -tearoff 0
2678
2679 set headctxmenu .headctxmenu
2680 makemenu $headctxmenu {
2681 - {mc "Check out this branch" command cobranch}
2682 - {mc "Rename this branch" command mvbranch}
2683 - {mc "Remove this branch" command rmbranch}
2684 - {mc "Copy branch name" command {clipboard clear; clipboard append $headmenuhead}}
2681 + {mc "Check out this branch" command cobranch}
2682 + {mc "Rename this branch" command mvbranch}
2683 + {mc "Remove this branch" command rmbranch}
2684 + {mc "Copy branch name" command {clipboard clear; clipboard append $headmenuhead}}
2685 }
2686 $headctxmenu configure -tearoff 0
2687
2688 global flist_menu
2689 set flist_menu .flistctxmenu
2690 makemenu $flist_menu {
2691 - {mc "Highlight this too" command {flist_hl 0}}
2692 - {mc "Highlight this only" command {flist_hl 1}}
2693 - {mc "External diff" command {external_diff}}
2694 - {mc "Blame parent commit" command {external_blame 1}}
2695 - {mc "Copy path" command {clipboard clear; clipboard append $flist_menu_file}}
2691 + {mc "Highlight this too" command {flist_hl 0}}
2692 + {mc "Highlight this only" command {flist_hl 1}}
2693 + {mc "External diff" command {external_diff}}
2694 + {mc "Blame parent commit" command {external_blame 1}}
2695 + {mc "Copy path" command {clipboard clear; clipboard append $flist_menu_file}}
2696 }
2697 $flist_menu configure -tearoff 0
2698
2699 global diff_menu
2700 set diff_menu .diffctxmenu
2701 makemenu $diff_menu {
2702 - {mc "Show origin of this line" command show_line_source}
2703 - {mc "Run git gui blame on this line" command {external_blame_diff}}
2702 + {mc "Show origin of this line" command show_line_source}
2703 + {mc "Run git gui blame on this line" command {external_blame_diff}}
2704 }
2705 $diff_menu configure -tearoff 0
2706 }
@@ -2712,14 +2712,14 @@ proc windows_mousewheel_redirector {W X Y D} {
2712 global canv canv2 canv3
2713 set w [winfo containing -displayof $W $X $Y]
2714 if {$w ne ""} {
2715 - set u [expr {$D < 0 ? 5 : -5}]
2716 - if {$w == $canv || $w == $canv2 || $w == $canv3} {
2717 - allcanvs yview scroll $u units
2718 - } else {
2719 - catch {
2720 - $w yview scroll $u units
2721 - }
2722 - }
2715 + set u [expr {$D < 0 ? 5 : -5}]
2716 + if {$w == $canv || $w == $canv2 || $w == $canv3} {
2717 + allcanvs yview scroll $u units
2718 + } else {
2719 + catch {
2720 + $w yview scroll $u units
2721 + }
2722 + }
2723 }
2724 }
2725
@@ -2728,9 +2728,9 @@ proc selectedline_change {n1 n2 op} {
2728 global selectedline rownumsel
2729
2730 if {$selectedline eq {}} {
2731 - set rownumsel {}
2731 + set rownumsel {}
2732 } else {
2733 - set rownumsel [expr {$selectedline + 1}]
2733 + set rownumsel [expr {$selectedline + 1}]
2734 }
2735 }
2736
@@ -2739,11 +2739,11 @@ proc selectedline_change {n1 n2 op} {
2739 proc canvscan {op w x y} {
2740 global canv canv2 canv3
2741 foreach c [list $canv $canv2 $canv3] {
2742 - if {$c == $w} {
2743 - $c scan $op $x $y
2744 - } else {
2745 - $c scan $op 0 $y
2746 - }
2742 + if {$c == $w} {
2743 + $c scan $op $x $y
2744 + } else {
2745 + $c scan $op 0 $y
2746 + }
2747 }
2748 }
2749
@@ -2761,10 +2761,10 @@ proc bindkey {ev script} {
2761 bind . $ev $script
2762 set escript [bind Entry $ev]
2763 if {$escript == {}} {
2764 - set escript [bind Entry <Key>]
2764 + set escript [bind Entry <Key>]
2765 }
2766 foreach e $entries {
2767 - bind $e $ev "$escript; break"
2767 + bind $e $ev "$escript; break"
2768 }
2769 }
2770
@@ -2778,7 +2778,7 @@ proc bindmodfunctionkey {mod n script} {
2778 proc click {w} {
2779 global ctext entries
2780 foreach e [concat $entries $ctext] {
2781 - if {$w == $e} return
2781 + if {$w == $e} return
2782 }
2783 focus .
2784 }
@@ -2790,8 +2790,8 @@ proc adjustprogress {} {
2790 global rprogitem rprogcoord use_ttk
2791
2792 if {$use_ttk} {
2793 - $progresscanv configure -value [expr {int($fprogcoord * 100)}]
2794 - return
2793 + $progresscanv configure -value [expr {int($fprogcoord * 100)}]
2794 + return
2795 }
2796
2797 set w [expr {[winfo width $progresscanv] - 4}]
@@ -2803,11 +2803,11 @@ proc adjustprogress {} {
2803 $progresscanv coords $rprogitem 0 0 [expr {$w * $rprogcoord}] $h
2804 set now [clock clicks -milliseconds]
2805 if {$now >= $lastprogupdate + 100} {
2806 - set progupdatepending 0
2807 - update
2806 + set progupdatepending 0
2807 + update
2808 } elseif {!$progupdatepending} {
2809 - set progupdatepending 1
2810 - after [expr {$lastprogupdate + 100 - $now}] doprogupdate
2809 + set progupdatepending 1
2810 + after [expr {$lastprogupdate + 100 - $now}] doprogupdate
2811 }
2812 }
2813
@@ -2815,9 +2815,9 @@ proc doprogupdate {} {
2815 global lastprogupdate progupdatepending
2816
2817 if {$progupdatepending} {
2818 - set progupdatepending 0
2819 - set lastprogupdate [clock clicks -milliseconds]
2820 - update
2818 + set progupdatepending 0
2819 + set lastprogupdate [clock clicks -milliseconds]
2820 + update
2821 }
2822 }
2823
@@ -2825,14 +2825,14 @@ proc config_check_tmp_exists {tries_left} {
2825 global config_file_tmp
2826
2827 if {[file exists $config_file_tmp]} {
2828 - incr tries_left -1
2829 - if {$tries_left > 0} {
2830 - after 100 [list config_check_tmp_exists $tries_left]
2831 - } else {
2832 - error_popup "There appears to be a stale $config_file_tmp\
2828 + incr tries_left -1
2829 + if {$tries_left > 0} {
2830 + after 100 [list config_check_tmp_exists $tries_left]
2831 + } else {
2832 + error_popup "There appears to be a stale $config_file_tmp\
2833 file, which will prevent gitk from saving its configuration on exit.\
2834 Please remove it if it is not being used by any existing gitk process."
2835 - }
2835 + }
2836 }
2837 }
2838
@@ -2849,9 +2849,9 @@ proc config_variable_change_cb {name name2 op} {
2849
2850 upvar #0 $name var
2851 if {$op eq "write" &&
2852 - (![info exists config_variable_original($name)] ||
2853 - $config_variable_original($name) ne $var)} {
2854 - set config_variable_changed($name) 1
2852 + (![info exists config_variable_original($name)] ||
2853 + $config_variable_original($name) ne $var)} {
2854 + set config_variable_changed($name) 1
2855 }
2856 }
2857
@@ -2873,81 +2873,81 @@ proc savestuff {w} {
2873 if {![winfo viewable .]} return
2874 set remove_tmp 0
2875 if {[catch {
2876 - set try_count 0
2877 - while {[catch {set f [open $config_file_tmp {WRONLY CREAT EXCL}]}]} {
2878 - if {[incr try_count] > 50} {
2879 - error "Unable to write config file: $config_file_tmp exists"
2880 - }
2881 - after 100
2882 - }
2883 - set remove_tmp 1
2884 - if {$::tcl_platform(platform) eq {windows}} {
2885 - file attributes $config_file_tmp -hidden true
2886 - }
2887 - if {[file exists $config_file]} {
2888 - source $config_file
2889 - }
2890 - foreach var_name $config_variables {
2891 - upvar #0 $var_name var
2892 - upvar 0 $var_name old_var
2893 - if {!$config_variable_changed($var_name) && [info exists old_var]} {
2894 - puts $f [list set $var_name $old_var]
2895 - } else {
2896 - puts $f [list set $var_name $var]
2897 - }
2898 - }
2899 -
2900 - puts $f "set geometry(main) [wm geometry .]"
2901 - puts $f "set geometry(state) [wm state .]"
2902 - puts $f "set geometry(topwidth) [winfo width .tf]"
2903 - puts $f "set geometry(topheight) [winfo height .tf]"
2904 - if {$current_use_ttk} {
2905 - puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sashpos 0] 1\""
2906 - puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\""
2907 - } else {
2908 - puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\""
2909 - puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\""
2910 - }
2911 - puts $f "set geometry(botwidth) [winfo width .bleft]"
2912 - puts $f "set geometry(botheight) [winfo height .bleft]"
2913 -
2914 - array set view_save {}
2915 - array set views {}
2916 - if {![info exists permviews]} { set permviews {} }
2917 - foreach view $permviews {
2918 - set view_save([lindex $view 0]) 1
2919 - set views([lindex $view 0]) $view
2920 - }
2921 - puts -nonewline $f "set permviews {"
2922 - for {set v 1} {$v < $current_nextviewnum} {incr v} {
2923 - if {$viewchanged($v)} {
2924 - if {$current_viewperm($v)} {
2925 - set views($current_viewname($v)) [list $current_viewname($v) $current_viewfiles($v) $current_viewargs($v) $current_viewargscmd($v)]
2926 - } else {
2927 - set view_save($current_viewname($v)) 0
2928 - }
2929 - }
2930 - }
2931 - # write old and updated view to their places and append remaining to the end
2932 - foreach view $permviews {
2933 - set view_name [lindex $view 0]
2934 - if {$view_save($view_name)} {
2935 - puts $f "{$views($view_name)}"
2936 - }
2937 - unset views($view_name)
2938 - }
2939 - foreach view_name [array names views] {
2940 - puts $f "{$views($view_name)}"
2941 - }
2942 - puts $f "}"
2943 - close $f
2944 - file rename -force $config_file_tmp $config_file
2945 - set remove_tmp 0
2876 + set try_count 0
2877 + while {[catch {set f [open $config_file_tmp {WRONLY CREAT EXCL}]}]} {
2878 + if {[incr try_count] > 50} {
2879 + error "Unable to write config file: $config_file_tmp exists"
2880 + }
2881 + after 100
2882 + }
2883 + set remove_tmp 1
2884 + if {$::tcl_platform(platform) eq {windows}} {
2885 + file attributes $config_file_tmp -hidden true
2886 + }
2887 + if {[file exists $config_file]} {
2888 + source $config_file
2889 + }
2890 + foreach var_name $config_variables {
2891 + upvar #0 $var_name var
2892 + upvar 0 $var_name old_var
2893 + if {!$config_variable_changed($var_name) && [info exists old_var]} {
2894 + puts $f [list set $var_name $old_var]
2895 + } else {
2896 + puts $f [list set $var_name $var]
2897 + }
2898 + }
2899 +
2900 + puts $f "set geometry(main) [wm geometry .]"
2901 + puts $f "set geometry(state) [wm state .]"
2902 + puts $f "set geometry(topwidth) [winfo width .tf]"
2903 + puts $f "set geometry(topheight) [winfo height .tf]"
2904 + if {$current_use_ttk} {
2905 + puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sashpos 0] 1\""
2906 + puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sashpos 1] 1\""
2907 + } else {
2908 + puts $f "set geometry(pwsash0) \"[.tf.histframe.pwclist sash coord 0]\""
2909 + puts $f "set geometry(pwsash1) \"[.tf.histframe.pwclist sash coord 1]\""
2910 + }
2911 + puts $f "set geometry(botwidth) [winfo width .bleft]"
2912 + puts $f "set geometry(botheight) [winfo height .bleft]"
2913 +
2914 + array set view_save {}
2915 + array set views {}
2916 + if {![info exists permviews]} { set permviews {} }
2917 + foreach view $permviews {
2918 + set view_save([lindex $view 0]) 1
2919 + set views([lindex $view 0]) $view
2920 + }
2921 + puts -nonewline $f "set permviews {"
2922 + for {set v 1} {$v < $current_nextviewnum} {incr v} {
2923 + if {$viewchanged($v)} {
2924 + if {$current_viewperm($v)} {
2925 + set views($current_viewname($v)) [list $current_viewname($v) $current_viewfiles($v) $current_viewargs($v) $current_viewargscmd($v)]
2926 + } else {
2927 + set view_save($current_viewname($v)) 0
2928 + }
2929 + }
2930 + }
2931 + # write old and updated view to their places and append remaining to the end
2932 + foreach view $permviews {
2933 + set view_name [lindex $view 0]
2934 + if {$view_save($view_name)} {
2935 + puts $f "{$views($view_name)}"
2936 + }
2937 + unset views($view_name)
2938 + }
2939 + foreach view_name [array names views] {
2940 + puts $f "{$views($view_name)}"
2941 + }
2942 + puts $f "}"
2943 + close $f
2944 + file rename -force $config_file_tmp $config_file
2945 + set remove_tmp 0
2946 } err]} {
2947 puts "Error saving config: $err"
2948 }
2949 if {$remove_tmp} {
2950 - file delete -force $config_file_tmp
2950 + file delete -force $config_file_tmp
2951 }
2952 set stuffsaved 1
2953 }
@@ -2955,40 +2955,40 @@ proc savestuff {w} {
2955 proc resizeclistpanes {win w} {
2956 global oldwidth use_ttk
2957 if {[info exists oldwidth($win)]} {
2958 - if {$use_ttk} {
2959 - set s0 [$win sashpos 0]
2960 - set s1 [$win sashpos 1]
2961 - } else {
2962 - set s0 [$win sash coord 0]
2963 - set s1 [$win sash coord 1]
2964 - }
2965 - if {$w < 60} {
2966 - set sash0 [expr {int($w/2 - 2)}]
2967 - set sash1 [expr {int($w*5/6 - 2)}]
2968 - } else {
2969 - set factor [expr {1.0 * $w / $oldwidth($win)}]
2970 - set sash0 [expr {int($factor * [lindex $s0 0])}]
2971 - set sash1 [expr {int($factor * [lindex $s1 0])}]
2972 - if {$sash0 < 30} {
2973 - set sash0 30
2974 - }
2975 - if {$sash1 < $sash0 + 20} {
2976 - set sash1 [expr {$sash0 + 20}]
2977 - }
2978 - if {$sash1 > $w - 10} {
2979 - set sash1 [expr {$w - 10}]
2980 - if {$sash0 > $sash1 - 20} {
2981 - set sash0 [expr {$sash1 - 20}]
2982 - }
2983 - }
2984 - }
2985 - if {$use_ttk} {
2986 - $win sashpos 0 $sash0
2987 - $win sashpos 1 $sash1
2988 - } else {
2989 - $win sash place 0 $sash0 [lindex $s0 1]
2990 - $win sash place 1 $sash1 [lindex $s1 1]
2991 - }
2958 + if {$use_ttk} {
2959 + set s0 [$win sashpos 0]
2960 + set s1 [$win sashpos 1]
2961 + } else {
2962 + set s0 [$win sash coord 0]
2963 + set s1 [$win sash coord 1]
2964 + }
2965 + if {$w < 60} {
2966 + set sash0 [expr {int($w/2 - 2)}]
2967 + set sash1 [expr {int($w*5/6 - 2)}]
2968 + } else {
2969 + set factor [expr {1.0 * $w / $oldwidth($win)}]
2970 + set sash0 [expr {int($factor * [lindex $s0 0])}]
2971 + set sash1 [expr {int($factor * [lindex $s1 0])}]
2972 + if {$sash0 < 30} {
2973 + set sash0 30
2974 + }
2975 + if {$sash1 < $sash0 + 20} {
2976 + set sash1 [expr {$sash0 + 20}]
2977 + }
2978 + if {$sash1 > $w - 10} {
2979 + set sash1 [expr {$w - 10}]
2980 + if {$sash0 > $sash1 - 20} {
2981 + set sash0 [expr {$sash1 - 20}]
2982 + }
2983 + }
2984 + }
2985 + if {$use_ttk} {
2986 + $win sashpos 0 $sash0
2987 + $win sashpos 1 $sash1
2988 + } else {
2989 + $win sash place 0 $sash0 [lindex $s0 1]
2990 + $win sash place 1 $sash1 [lindex $s1 1]
2991 + }
2992 }
2993 set oldwidth($win) $w
2994 }
@@ -2996,28 +2996,28 @@ proc resizeclistpanes {win w} {
2996 proc resizecdetpanes {win w} {
2997 global oldwidth use_ttk
2998 if {[info exists oldwidth($win)]} {
2999 - if {$use_ttk} {
3000 - set s0 [$win sashpos 0]
3001 - } else {
3002 - set s0 [$win sash coord 0]
3003 - }
3004 - if {$w < 60} {
3005 - set sash0 [expr {int($w*3/4 - 2)}]
3006 - } else {
3007 - set factor [expr {1.0 * $w / $oldwidth($win)}]
3008 - set sash0 [expr {int($factor * [lindex $s0 0])}]
3009 - if {$sash0 < 45} {
3010 - set sash0 45
3011 - }
3012 - if {$sash0 > $w - 15} {
3013 - set sash0 [expr {$w - 15}]
3014 - }
3015 - }
3016 - if {$use_ttk} {
3017 - $win sashpos 0 $sash0
3018 - } else {
3019 - $win sash place 0 $sash0 [lindex $s0 1]
3020 - }
2999 + if {$use_ttk} {
3000 + set s0 [$win sashpos 0]
3001 + } else {
3002 + set s0 [$win sash coord 0]
3003 + }
3004 + if {$w < 60} {
3005 + set sash0 [expr {int($w*3/4 - 2)}]
3006 + } else {
3007 + set factor [expr {1.0 * $w / $oldwidth($win)}]
3008 + set sash0 [expr {int($factor * [lindex $s0 0])}]
3009 + if {$sash0 < 45} {
3010 + set sash0 45
3011 + }
3012 + if {$sash0 > $w - 15} {
3013 + set sash0 [expr {$w - 15}]
3014 + }
3015 + }
3016 + if {$use_ttk} {
3017 + $win sashpos 0 $sash0
3018 + } else {
3019 + $win sash place 0 $sash0 [lindex $s0 1]
3020 + }
3021 }
3022 set oldwidth($win) $w
3023 }
@@ -3040,8 +3040,8 @@ proc about {} {
3040 global bgcolor NS
3041 set w .about
3042 if {[winfo exists $w]} {
3043 - raise $w
3044 - return
3043 + raise $w
3044 + return
3045 }
3046 ttk_toplevel $w
3047 wm title $w [mc "About gitk"]
@@ -3052,7 +3052,7 @@ Gitk - a commit viewer for git
3052 Copyright \u00a9 2005-2016 Paul Mackerras
3053
3054 Use and redistribute under the terms of the GNU General Public License"] \
3055 - -justify center -aspect 400 -border 2 -bg $bgcolor -relief groove
3055 + -justify center -aspect 400 -border 2 -bg $bgcolor -relief groove
3056 pack $w.m -side top -fill x -padx 2 -pady 2
3057 ${NS}::button $w.ok -text [mc "Close"] -command "destroy $w" -default active
3058 pack $w.ok -side bottom
@@ -3066,13 +3066,13 @@ proc keys {} {
3066 global bgcolor NS
3067 set w .keys
3068 if {[winfo exists $w]} {
3069 - raise $w
3070 - return
3069 + raise $w
3070 + return
3071 }
3072 if {[tk windowingsystem] eq {aqua}} {
3073 - set M1T Cmd
3073 + set M1T Cmd
3074 } else {
3075 - set M1T Ctrl
3075 + set M1T Ctrl
3076 }
3077 ttk_toplevel $w
3078 wm title $w [mc "Gitk key bindings"]
@@ -3119,7 +3119,7 @@ proc keys {} {
3119 [mc "<%s-minus> Decrease font size" $M1T]
3120 [mc "<F5> Update"]
3121 " \
3122 - -justify left -bg $bgcolor -border 2 -relief groove
3122 + -justify left -bg $bgcolor -border 2 -relief groove
3123 pack $w.m -side top -fill both -padx 2 -pady 2
3124 ${NS}::button $w.ok -text [mc "Close"] -command "destroy $w" -default active
3125 bind $w <Key-Escape> [list destroy $w]
@@ -3146,68 +3146,68 @@ proc treeview {w l openlevs} {
3146 set treecontents() {}
3147 $w conf -state normal
3148 foreach f $l {
3149 - while {[string range $f 0 $prefixend] ne $prefix} {
3150 - if {$lev <= $openlevs} {
3151 - $w mark set e:$treeindex($prefix) "end -1c"
3152 - $w mark gravity e:$treeindex($prefix) left
3153 - }
3154 - set treeheight($prefix) $ht
3155 - incr ht [lindex $htstack end]
3156 - set htstack [lreplace $htstack end end]
3157 - set prefixend [lindex $prefendstack end]
3158 - set prefendstack [lreplace $prefendstack end end]
3159 - set prefix [string range $prefix 0 $prefixend]
3160 - incr lev -1
3161 - }
3162 - set tail [string range $f [expr {$prefixend+1}] end]
3163 - while {[set slash [string first "/" $tail]] >= 0} {
3164 - lappend htstack $ht
3165 - set ht 0
3166 - lappend prefendstack $prefixend
3167 - incr prefixend [expr {$slash + 1}]
3168 - set d [string range $tail 0 $slash]
3169 - lappend treecontents($prefix) $d
3170 - set oldprefix $prefix
3171 - append prefix $d
3172 - set treecontents($prefix) {}
3173 - set treeindex($prefix) [incr ix]
3174 - set treeparent($prefix) $oldprefix
3175 - set tail [string range $tail [expr {$slash+1}] end]
3176 - if {$lev <= $openlevs} {
3177 - set ht 1
3178 - set treediropen($prefix) [expr {$lev < $openlevs}]
3179 - set bm [expr {$lev == $openlevs? "tri-rt": "tri-dn"}]
3180 - $w mark set d:$ix "end -1c"
3181 - $w mark gravity d:$ix left
3182 - set str "\n"
3183 - for {set i 0} {$i < $lev} {incr i} {append str "\t"}
3184 - $w insert end $str
3185 - $w image create end -align center -image $bm -padx 1 \
3186 - -name a:$ix
3187 - $w insert end $d [highlight_tag $prefix]
3188 - $w mark set s:$ix "end -1c"
3189 - $w mark gravity s:$ix left
3190 - }
3191 - incr lev
3192 - }
3193 - if {$tail ne {}} {
3194 - if {$lev <= $openlevs} {
3195 - incr ht
3196 - set str "\n"
3197 - for {set i 0} {$i < $lev} {incr i} {append str "\t"}
3198 - $w insert end $str
3199 - $w insert end $tail [highlight_tag $f]
3200 - }
3201 - lappend treecontents($prefix) $tail
3202 - }
3149 + while {[string range $f 0 $prefixend] ne $prefix} {
3150 + if {$lev <= $openlevs} {
3151 + $w mark set e:$treeindex($prefix) "end -1c"
3152 + $w mark gravity e:$treeindex($prefix) left
3153 + }
3154 + set treeheight($prefix) $ht
3155 + incr ht [lindex $htstack end]
3156 + set htstack [lreplace $htstack end end]
3157 + set prefixend [lindex $prefendstack end]
3158 + set prefendstack [lreplace $prefendstack end end]
3159 + set prefix [string range $prefix 0 $prefixend]
3160 + incr lev -1
3161 + }
3162 + set tail [string range $f [expr {$prefixend+1}] end]
3163 + while {[set slash [string first "/" $tail]] >= 0} {
3164 + lappend htstack $ht
3165 + set ht 0
3166 + lappend prefendstack $prefixend
3167 + incr prefixend [expr {$slash + 1}]
3168 + set d [string range $tail 0 $slash]
3169 + lappend treecontents($prefix) $d
3170 + set oldprefix $prefix
3171 + append prefix $d
3172 + set treecontents($prefix) {}
3173 + set treeindex($prefix) [incr ix]
3174 + set treeparent($prefix) $oldprefix
3175 + set tail [string range $tail [expr {$slash+1}] end]
3176 + if {$lev <= $openlevs} {
3177 + set ht 1
3178 + set treediropen($prefix) [expr {$lev < $openlevs}]
3179 + set bm [expr {$lev == $openlevs? "tri-rt": "tri-dn"}]
3180 + $w mark set d:$ix "end -1c"
3181 + $w mark gravity d:$ix left
3182 + set str "\n"
3183 + for {set i 0} {$i < $lev} {incr i} {append str "\t"}
3184 + $w insert end $str
3185 + $w image create end -align center -image $bm -padx 1 \
3186 + -name a:$ix
3187 + $w insert end $d [highlight_tag $prefix]
3188 + $w mark set s:$ix "end -1c"
3189 + $w mark gravity s:$ix left
3190 + }
3191 + incr lev
3192 + }
3193 + if {$tail ne {}} {
3194 + if {$lev <= $openlevs} {
3195 + incr ht
3196 + set str "\n"
3197 + for {set i 0} {$i < $lev} {incr i} {append str "\t"}
3198 + $w insert end $str
3199 + $w insert end $tail [highlight_tag $f]
3200 + }
3201 + lappend treecontents($prefix) $tail
3202 + }
3203 }
3204 while {$htstack ne {}} {
3205 - set treeheight($prefix) $ht
3206 - incr ht [lindex $htstack end]
3207 - set htstack [lreplace $htstack end end]
3208 - set prefixend [lindex $prefendstack end]
3209 - set prefendstack [lreplace $prefendstack end end]
3210 - set prefix [string range $prefix 0 $prefixend]
3205 + set treeheight($prefix) $ht
3206 + incr ht [lindex $htstack end]
3207 + set htstack [lreplace $htstack end end]
3208 + set prefixend [lindex $prefendstack end]
3209 + set prefendstack [lreplace $prefendstack end end]
3210 + set prefix [string range $prefix 0 $prefixend]
3211 }
3212 $w conf -state disabled
3213 }
@@ -3218,21 +3218,21 @@ proc linetoelt {l} {
3218 set y 2
3219 set prefix {}
3220 while {1} {
3221 - foreach e $treecontents($prefix) {
3222 - if {$y == $l} {
3223 - return "$prefix$e"
3224 - }
3225 - set n 1
3226 - if {[string index $e end] eq "/"} {
3227 - set n $treeheight($prefix$e)
3228 - if {$y + $n > $l} {
3229 - append prefix $e
3230 - incr y
3231 - break
3232 - }
3233 - }
3234 - incr y $n
3235 - }
3221 + foreach e $treecontents($prefix) {
3222 + if {$y == $l} {
3223 + return "$prefix$e"
3224 + }
3225 + set n 1
3226 + if {[string index $e end] eq "/"} {
3227 + set n $treeheight($prefix$e)
3228 + if {$y + $n > $l} {
3229 + append prefix $e
3230 + incr y
3231 + break
3232 + }
3233 + }
3234 + incr y $n
3235 + }
3236 }
3237 }
3238
@@ -3240,14 +3240,14 @@ proc highlight_tree {y prefix} {
3240 global treeheight treecontents cflist
3241
3242 foreach e $treecontents($prefix) {
3243 - set path $prefix$e
3244 - if {[highlight_tag $path] ne {}} {
3245 - $cflist tag add bold $y.0 "$y.0 lineend"
3246 - }
3247 - incr y
3248 - if {[string index $e end] eq "/" && $treeheight($path) > 1} {
3249 - set y [highlight_tree $y $path]
3250 - }
3243 + set path $prefix$e
3244 + if {[highlight_tag $path] ne {}} {
3245 + $cflist tag add bold $y.0 "$y.0 lineend"
3246 + }
3247 + incr y
3248 + if {[string index $e end] eq "/" && $treeheight($path) > 1} {
3249 + set y [highlight_tree $y $path]
3250 + }
3251 }
3252 return $y
3253 }
@@ -3263,8 +3263,8 @@ proc treeclosedir {w dir} {
3263 $w conf -state disabled
3264 set n [expr {1 - $treeheight($dir)}]
3265 while {$dir ne {}} {
3266 - incr treeheight($dir) $n
3267 - set dir $treeparent($dir)
3266 + incr treeheight($dir) $n
3267 + set dir $treeparent($dir)
3268 }
3269 }
3270
@@ -3280,28 +3280,28 @@ proc treeopendir {w dir} {
3280 set str "\n"
3281 set n [llength $treecontents($dir)]
3282 for {set x $dir} {$x ne {}} {set x $treeparent($x)} {
3283 - incr lev
3284 - append str "\t"
3285 - incr treeheight($x) $n
3283 + incr lev
3284 + append str "\t"
3285 + incr treeheight($x) $n
3286 }
3287 foreach e $treecontents($dir) {
3288 - set de $dir$e
3289 - if {[string index $e end] eq "/"} {
3290 - set iy $treeindex($de)
3291 - $w mark set d:$iy e:$ix
3292 - $w mark gravity d:$iy left
3293 - $w insert e:$ix $str
3294 - set treediropen($de) 0
3295 - $w image create e:$ix -align center -image tri-rt -padx 1 \
3296 - -name a:$iy
3297 - $w insert e:$ix $e [highlight_tag $de]
3298 - $w mark set s:$iy e:$ix
3299 - $w mark gravity s:$iy left
3300 - set treeheight($de) 1
3301 - } else {
3302 - $w insert e:$ix $str
3303 - $w insert e:$ix $e [highlight_tag $de]
3304 - }
3288 + set de $dir$e
3289 + if {[string index $e end] eq "/"} {
3290 + set iy $treeindex($de)
3291 + $w mark set d:$iy e:$ix
3292 + $w mark gravity d:$iy left
3293 + $w insert e:$ix $str
3294 + set treediropen($de) 0
3295 + $w image create e:$ix -align center -image tri-rt -padx 1 \
3296 + -name a:$iy
3297 + $w insert e:$ix $e [highlight_tag $de]
3298 + $w mark set s:$iy e:$ix
3299 + $w mark gravity s:$iy left
3300 + set treeheight($de) 1
3301 + } else {
3302 + $w insert e:$ix $str
3303 + $w insert e:$ix $e [highlight_tag $de]
3304 + }
3305 }
3306 $w mark gravity e:$ix right
3307 $w conf -state disabled
@@ -3310,13 +3310,13 @@ proc treeopendir {w dir} {
3310 set ht [$w cget -height]
3311 set l [lindex [split [$w index s:$ix] .] 0]
3312 if {$l < $top} {
3313 - $w yview $l.0
3313 + $w yview $l.0
3314 } elseif {$l + $n + 1 > $top + $ht} {
3315 - set top [expr {$l + $n + 2 - $ht}]
3316 - if {$l < $top} {
3317 - set top $l
3318 - }
3319 - $w yview $top.0
3315 + set top [expr {$l + $n + 2 - $ht}]
3316 + if {$l < $top} {
3317 + set top $l
3318 + }
3319 + $w yview $top.0
3320 }
3321 }
3322
@@ -3330,16 +3330,16 @@ proc treeclick {w x y} {
3330 $cflist tag add highlight $l.0 "$l.0 lineend"
3331 set cflist_top $l
3332 if {$l == 1} {
3333 - $ctext yview 1.0
3334 - return
3333 + $ctext yview 1.0
3334 + return
3335 }
3336 set e [linetoelt $l]
3337 if {[string index $e end] ne "/"} {
3338 - showfile $e
3338 + showfile $e
3339 } elseif {$treediropen($e)} {
3340 - treeclosedir $w $e
3340 + treeclosedir $w $e
3341 } else {
3342 - treeopendir $w $e
3342 + treeopendir $w $e
3343 }
3344 }
3345
@@ -3348,10 +3348,10 @@ proc setfilelist {id} {
3348
3349 treeview $cflist $treefilelist($id) 0
3350 if {$jump_to_here ne {}} {
3351 - set f [lindex $jump_to_here 0]
3352 - if {[lsearch -exact $treefilelist($id) $f] >= 0} {
3353 - showfile $f
3354 - }
3351 + set f [lindex $jump_to_here 0]
3352 + if {[lsearch -exact $treefilelist($id) $f] >= 0} {
3353 + showfile $f
3354 + }
3355 }
3356 }
3357
@@ -3426,11 +3426,11 @@ proc init_flist {first} {
3426 $cflist conf -state normal
3427 $cflist delete 0.0 end
3428 if {$first ne {}} {
3429 - $cflist insert end $first
3430 - set cflist_top 1
3431 - $cflist tag add highlight 1.0 "1.0 lineend"
3429 + $cflist insert end $first
3430 + set cflist_top 1
3431 + $cflist tag add highlight 1.0 "1.0 lineend"
3432 } else {
3433 - unset -nocomplain cflist_top
3433 + unset -nocomplain cflist_top
3434 }
3435 $cflist conf -state disabled
3436 set difffilestart {}
@@ -3440,9 +3440,9 @@ proc highlight_tag {f} {
3440 global highlight_paths
3441
3442 foreach p $highlight_paths {
3443 - if {[string match $p $f]} {
3444 - return "bold"
3445 - }
3443 + if {[string match $p $f]} {
3444 + return "bold"
3445 + }
3446 }
3447 return {}
3448 }
@@ -3452,15 +3452,15 @@ proc highlight_filelist {} {
3452
3453 $cflist conf -state normal
3454 if {$cmitmode ne "tree"} {
3455 - set end [lindex [split [$cflist index end] .] 0]
3456 - for {set l 2} {$l < $end} {incr l} {
3457 - set line [$cflist get $l.0 "$l.0 lineend"]
3458 - if {[highlight_tag $line] ne {}} {
3459 - $cflist tag add bold $l.0 "$l.0 lineend"
3460 - }
3461 - }
3455 + set end [lindex [split [$cflist index end] .] 0]
3456 + for {set l 2} {$l < $end} {incr l} {
3457 + set line [$cflist get $l.0 "$l.0 lineend"]
3458 + if {[highlight_tag $line] ne {}} {
3459 + $cflist tag add bold $l.0 "$l.0 lineend"
3460 + }
3461 + }
3462 } else {
3463 - highlight_tree 2 {}
3463 + highlight_tree 2 {}
3464 }
3465 $cflist conf -state disabled
3466 }
@@ -3478,8 +3478,8 @@ proc add_flist {fl} {
3478
3479 $cflist conf -state normal
3480 foreach f $fl {
3481 - $cflist insert end "\n"
3482 - $cflist insert end $f [highlight_tag $f]
3481 + $cflist insert end "\n"
3482 + $cflist insert end $f [highlight_tag $f]
3483 }
3484 $cflist conf -state disabled
3485 }
@@ -3494,9 +3494,9 @@ proc sel_flist {w x y} {
3494 $cflist tag add highlight $l.0 "$l.0 lineend"
3495 set cflist_top $l
3496 if {$l == 1} {
3497 - $ctext yview 1.0
3497 + $ctext yview 1.0
3498 } else {
3499 - catch {$ctext yview [lindex $difffilestart [expr {$l - 2}]]}
3499 + catch {$ctext yview [lindex $difffilestart [expr {$l - 2}]]}
3500 }
3501 suppress_highlighting_file_for_current_scrollpos
3502 }
@@ -3509,15 +3509,15 @@ proc pop_flist_menu {w X Y x y} {
3509 set l [lindex [split [$w index "@$x,$y"] "."] 0]
3510 if {$l <= 1} return
3511 if {$cmitmode eq "tree"} {
3512 - set e [linetoelt $l]
3513 - if {[string index $e end] eq "/"} return
3512 + set e [linetoelt $l]
3513 + if {[string index $e end] eq "/"} return
3514 } else {
3515 - set e [lindex $treediffs($diffids) [expr {$l-2}]]
3515 + set e [lindex $treediffs($diffids) [expr {$l-2}]]
3516 }
3517 set flist_menu_file $e
3518 set xdiffstate "normal"
3519 if {$cmitmode eq "tree"} {
3520 - set xdiffstate "disabled"
3520 + set xdiffstate "disabled"
3521 }
3522 # Disable "External diff" item in tree mode
3523 $flist_menu entryconf 2 -state $xdiffstate
@@ -3546,7 +3546,7 @@ proc pop_diff_menu {w X Y x y} {
3546 set diff_menu_line [lindex $diff_menu_txtpos 0]
3547 # don't pop up the menu on hunk-separator or file-separator lines
3548 if {[lsearch -glob [$ctext tag names $diff_menu_line.0] "*sep"] >= 0} {
3549 - return
3549 + return
3550 }
3551 stopfinding
3552 set f [find_ctext_fileinfo $diff_menu_line]
@@ -3561,9 +3561,9 @@ proc flist_hl {only} {
3561
3562 set x [shellquote $flist_menu_file]
3563 if {$only || $findstring eq {} || $gdttype ne [mc "touching paths:"]} {
3564 - set findstring $x
3564 + set findstring $x
3565 } else {
3566 - append findstring " " $x
3566 + append findstring " " $x
3567 }
3568 set gdttype [mc "touching paths:"]
3569 }
@@ -3572,29 +3572,29 @@ proc gitknewtmpdir {} {
3572 global diffnum gitktmpdir gitdir env
3573
3574 if {![info exists gitktmpdir]} {
3575 - if {[info exists env(GITK_TMPDIR)]} {
3576 - set tmpdir $env(GITK_TMPDIR)
3577 - } elseif {[info exists env(TMPDIR)]} {
3578 - set tmpdir $env(TMPDIR)
3579 - } else {
3580 - set tmpdir $gitdir
3581 - }
3582 - set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
3583 - if {[catch {set gitktmpdir [exec mktemp -d $gitktmpformat]}]} {
3584 - set gitktmpdir [file join $gitdir [format ".gitk-tmp.%s" [pid]]]
3585 - }
3586 - if {[catch {file mkdir $gitktmpdir} err]} {
3587 - error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
3588 - unset gitktmpdir
3589 - return {}
3590 - }
3591 - set diffnum 0
3575 + if {[info exists env(GITK_TMPDIR)]} {
3576 + set tmpdir $env(GITK_TMPDIR)
3577 + } elseif {[info exists env(TMPDIR)]} {
3578 + set tmpdir $env(TMPDIR)
3579 + } else {
3580 + set tmpdir $gitdir
3581 + }
3582 + set gitktmpformat [file join $tmpdir ".gitk-tmp.XXXXXX"]
3583 + if {[catch {set gitktmpdir [exec mktemp -d $gitktmpformat]}]} {
3584 + set gitktmpdir [file join $gitdir [format ".gitk-tmp.%s" [pid]]]
3585 + }
3586 + if {[catch {file mkdir $gitktmpdir} err]} {
3587 + error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
3588 + unset gitktmpdir
3589 + return {}
3590 + }
3591 + set diffnum 0
3592 }
3593 incr diffnum
3594 set diffdir [file join $gitktmpdir $diffnum]
3595 if {[catch {file mkdir $diffdir} err]} {
3596 - error_popup "[mc "Error creating temporary directory %s:" $diffdir] $err"
3597 - return {}
3596 + error_popup "[mc "Error creating temporary directory %s:" $diffdir] $err"
3597 + return {}
3598 }
3599 return $diffdir
3600 }
@@ -3603,11 +3603,11 @@ proc save_file_from_commit {filename output what} {
3603 global nullfile
3604
3605 if {[catch {exec git show $filename -- > $output} err]} {
3606 - if {[string match "fatal: bad revision *" $err]} {
3607 - return $nullfile
3608 - }
3609 - error_popup "[mc "Error getting \"%s\" from %s:" $filename $what] $err"
3610 - return {}
3606 + if {[string match "fatal: bad revision *" $err]} {
3607 + return $nullfile
3608 + }
3609 + error_popup "[mc "Error getting \"%s\" from %s:" $filename $what] $err"
3610 + return {}
3611 }
3612 return $output
3613 }
@@ -3618,10 +3618,10 @@ proc external_diff_get_one_file {diffid filename diffdir} {
3618
3619 if {$diffid == $nullid} {
3620 set difffile [file join $worktree $filename]
3621 - if {[file exists $difffile]} {
3622 - return $difffile
3623 - }
3624 - return $nullfile
3621 + if {[file exists $difffile]} {
3622 + return $difffile
3623 + }
3624 + return $nullfile
3625 }
3626 if {$diffid == $nullid2} {
3627 set difffile [file join $diffdir "\[index\] [file tail $filename]"]
@@ -3629,7 +3629,7 @@ proc external_diff_get_one_file {diffid filename diffdir} {
3629 }
3630 set difffile [file join $diffdir "\[$diffid\] [file tail $filename]"]
3631 return [save_file_from_commit $diffid:$filename $difffile \
3632 - "revision $diffid"]
3632 + "revision $diffid"]
3633 }
3634
3635 proc external_diff {} {
@@ -3686,18 +3686,18 @@ proc find_hunk_blamespec {base line} {
3686
3687 set s_line [$ctext get $s_lix "$s_lix + 1 lines"]
3688 if {![regexp {^@@@*(( -\d+(,\d+)?)+) \+(\d+)(,\d+)? @@} $s_line \
3689 - s_line old_specs osz osz1 new_line nsz]} {
3690 - return
3689 + s_line old_specs osz osz1 new_line nsz]} {
3690 + return
3691 }
3692
3693 # base lines for the parents
3694 set base_lines [list $new_line]
3695 foreach old_spec [lrange [split $old_specs " "] 1 end] {
3696 - if {![regexp -- {-(\d+)(,\d+)?} $old_spec \
3697 - old_spec old_line osz]} {
3698 - return
3699 - }
3700 - lappend base_lines $old_line
3696 + if {![regexp -- {-(\d+)(,\d+)?} $old_spec \
3697 + old_spec old_line osz]} {
3698 + return
3699 + }
3700 + lappend base_lines $old_line
3701 }
3702
3703 # Now scan the lines to determine offset within the hunk
@@ -3708,38 +3708,38 @@ proc find_hunk_blamespec {base line} {
3708 # Determine if the line is removed
3709 set chunk [$ctext get $line.0 "$line.1 + $max_parent chars"]
3710 if {[string match {[-+ ]*} $chunk]} {
3711 - set removed_idx [string first "-" $chunk]
3712 - # Choose a parent index
3713 - if {$removed_idx >= 0} {
3714 - set parent $removed_idx
3715 - } else {
3716 - set unchanged_idx [string first " " $chunk]
3717 - if {$unchanged_idx >= 0} {
3718 - set parent $unchanged_idx
3719 - } else {
3720 - # blame the current commit
3721 - set parent -1
3722 - }
3723 - }
3724 - # then count other lines that belong to it
3725 - for {set i $line} {[incr i -1] > $s_lno} {} {
3726 - set chunk [$ctext get $i.0 "$i.1 + $max_parent chars"]
3727 - # Determine if the line is removed
3728 - set removed_idx [string first "-" $chunk]
3729 - if {$parent >= 0} {
3730 - set code [string index $chunk $parent]
3731 - if {$code eq "-" || ($removed_idx < 0 && $code ne "+")} {
3732 - incr dline
3733 - }
3734 - } else {
3735 - if {$removed_idx < 0} {
3736 - incr dline
3737 - }
3738 - }
3739 - }
3740 - incr parent
3711 + set removed_idx [string first "-" $chunk]
3712 + # Choose a parent index
3713 + if {$removed_idx >= 0} {
3714 + set parent $removed_idx
3715 + } else {
3716 + set unchanged_idx [string first " " $chunk]
3717 + if {$unchanged_idx >= 0} {
3718 + set parent $unchanged_idx
3719 + } else {
3720 + # blame the current commit
3721 + set parent -1
3722 + }
3723 + }
3724 + # then count other lines that belong to it
3725 + for {set i $line} {[incr i -1] > $s_lno} {} {
3726 + set chunk [$ctext get $i.0 "$i.1 + $max_parent chars"]
3727 + # Determine if the line is removed
3728 + set removed_idx [string first "-" $chunk]
3729 + if {$parent >= 0} {
3730 + set code [string index $chunk $parent]
3731 + if {$code eq "-" || ($removed_idx < 0 && $code ne "+")} {
3732 + incr dline
3733 + }
3734 + } else {
3735 + if {$removed_idx < 0} {
3736 + incr dline
3737 + }
3738 + }
3739 + }
3740 + incr parent
3741 } else {
3742 - set parent 0
3742 + set parent 0
3743 }
3744
3745 incr dline [lindex $base_lines $parent]
@@ -3752,17 +3752,17 @@ proc external_blame_diff {} {
3752 global diff_menu_filebase flist_menu_file
3753
3754 if {$cmitmode eq "tree"} {
3755 - set parent_idx 0
3756 - set line [expr {$diff_menu_line - $diff_menu_filebase}]
3755 + set parent_idx 0
3756 + set line [expr {$diff_menu_line - $diff_menu_filebase}]
3757 } else {
3758 - set hinfo [find_hunk_blamespec $diff_menu_filebase $diff_menu_line]
3759 - if {$hinfo ne {}} {
3760 - set parent_idx [lindex $hinfo 0]
3761 - set line [lindex $hinfo 1]
3762 - } else {
3763 - set parent_idx 0
3764 - set line 0
3765 - }
3758 + set hinfo [find_hunk_blamespec $diff_menu_filebase $diff_menu_line]
3759 + if {$hinfo ne {}} {
3760 + set parent_idx [lindex $hinfo 0]
3761 + set line [lindex $hinfo 1]
3762 + } else {
3763 + set parent_idx 0
3764 + set line 0
3765 + }
3766 }
3767
3768 external_blame $parent_idx $line
@@ -3773,12 +3773,12 @@ proc external_blame_diff {} {
3773 proc index_sha1 {fname} {
3774 set f [open [list | git ls-files -s $fname] r]
3775 while {[gets $f line] >= 0} {
3776 - set info [lindex [split $line "\t"] 0]
3777 - set stage [lindex $info 2]
3778 - if {$stage eq "0" || $stage eq "2"} {
3779 - close $f
3780 - return [lindex $info 1]
3781 - }
3776 + set info [lindex [split $line "\t"] 0]
3777 + set stage [lindex $info 2]
3778 + if {$stage eq "0" || $stage eq "2"} {
3779 + close $f
3780 + return [lindex $info 1]
3781 + }
3782 }
3783 close $f
3784 return {}
@@ -3787,7 +3787,7 @@ proc index_sha1 {fname} {
3787 # Turn an absolute path into one relative to the current directory
3788 proc make_relative {f} {
3789 if {[file pathtype $f] eq "relative"} {
3790 - return $f
3790 + return $f
3791 }
3792 set elts [file split $f]
3793 set here [file split [pwd]]
@@ -3795,12 +3795,12 @@ proc make_relative {f} {
3795 set hi 0
3796 set res {}
3797 foreach d $here {
3798 - if {$ei < $hi || $ei >= [llength $elts] || [lindex $elts $ei] ne $d} {
3799 - lappend res ".."
3800 - } else {
3801 - incr ei
3802 - }
3803 - incr hi
3798 + if {$ei < $hi || $ei >= [llength $elts] || [lindex $elts $ei] ne $d} {
3799 + lappend res ".."
3800 + } else {
3801 + incr ei
3802 + }
3803 + incr hi
3804 }
3805 set elts [concat $res [lrange $elts $ei end]]
3806 return [eval file join $elts]
@@ -3812,19 +3812,19 @@ proc external_blame {parent_idx {line {}}} {
3812 global parentlist selectedline currentid
3813
3814 if {$parent_idx > 0} {
3815 - set base_commit [lindex $parentlist $selectedline [expr {$parent_idx-1}]]
3815 + set base_commit [lindex $parentlist $selectedline [expr {$parent_idx-1}]]
3816 } else {
3817 - set base_commit $currentid
3817 + set base_commit $currentid
3818 }
3819
3820 if {$base_commit eq {} || $base_commit eq $nullid || $base_commit eq $nullid2} {
3821 - error_popup [mc "No such commit"]
3822 - return
3821 + error_popup [mc "No such commit"]
3822 + return
3823 }
3824
3825 set cmdline [list git gui blame]
3826 if {$line ne {} && $line > 1} {
3827 - lappend cmdline "--line=$line"
3827 + lappend cmdline "--line=$line"
3828 }
3829 set f [file join $cdup $flist_menu_file]
3830 # Unfortunately it seems git gui blame doesn't like
@@ -3832,7 +3832,7 @@ proc external_blame {parent_idx {line {}}} {
3832 set f [make_relative $f]
3833 lappend cmdline $base_commit $f
3834 if {[catch {eval exec $cmdline &} err]} {
3835 - error_popup "[mc "git gui blame: command failed:"] $err"
3835 + error_popup "[mc "git gui blame: command failed:"] $err"
3836 }
3837 }
3838
@@ -3843,61 +3843,61 @@ proc show_line_source {} {
3843
3844 set from_index {}
3845 if {$cmitmode eq "tree"} {
3846 - set id $currentid
3847 - set line [expr {$diff_menu_line - $diff_menu_filebase}]
3846 + set id $currentid
3847 + set line [expr {$diff_menu_line - $diff_menu_filebase}]
3848 } else {
3849 - set h [find_hunk_blamespec $diff_menu_filebase $diff_menu_line]
3850 - if {$h eq {}} return
3851 - set pi [lindex $h 0]
3852 - if {$pi == 0} {
3853 - mark_ctext_line $diff_menu_line
3854 - return
3855 - }
3856 - incr pi -1
3857 - if {$currentid eq $nullid} {
3858 - if {$pi > 0} {
3859 - # must be a merge in progress...
3860 - if {[catch {
3861 - # get the last line from .git/MERGE_HEAD
3862 - set f [open [file join $gitdir MERGE_HEAD] r]
3863 - set id [lindex [split [read $f] "\n"] end-1]
3864 - close $f
3865 - } err]} {
3866 - error_popup [mc "Couldn't read merge head: %s" $err]
3867 - return
3868 - }
3869 - } elseif {$parents($curview,$currentid) eq $nullid2} {
3870 - # need to do the blame from the index
3871 - if {[catch {
3872 - set from_index [index_sha1 $flist_menu_file]
3873 - } err]} {
3874 - error_popup [mc "Error reading index: %s" $err]
3875 - return
3876 - }
3877 - } else {
3878 - set id $parents($curview,$currentid)
3879 - }
3880 - } else {
3881 - set id [lindex $parents($curview,$currentid) $pi]
3882 - }
3883 - set line [lindex $h 1]
3884 - }
3885 - set blameargs {}
3849 + set h [find_hunk_blamespec $diff_menu_filebase $diff_menu_line]
3850 + if {$h eq {}} return
3851 + set pi [lindex $h 0]
3852 + if {$pi == 0} {
3853 + mark_ctext_line $diff_menu_line
3854 + return
3855 + }
3856 + incr pi -1
3857 + if {$currentid eq $nullid} {
3858 + if {$pi > 0} {
3859 + # must be a merge in progress...
3860 + if {[catch {
3861 + # get the last line from .git/MERGE_HEAD
3862 + set f [open [file join $gitdir MERGE_HEAD] r]
3863 + set id [lindex [split [read $f] "\n"] end-1]
3864 + close $f
3865 + } err]} {
3866 + error_popup [mc "Couldn't read merge head: %s" $err]
3867 + return
3868 + }
3869 + } elseif {$parents($curview,$currentid) eq $nullid2} {
3870 + # need to do the blame from the index
3871 + if {[catch {
3872 + set from_index [index_sha1 $flist_menu_file]
3873 + } err]} {
3874 + error_popup [mc "Error reading index: %s" $err]
3875 + return
3876 + }
3877 + } else {
3878 + set id $parents($curview,$currentid)
3879 + }
3880 + } else {
3881 + set id [lindex $parents($curview,$currentid) $pi]
3882 + }
3883 + set line [lindex $h 1]
3884 + }
3885 + set blameargs {}
3886 if {$from_index ne {}} {
3887 - lappend blameargs | git cat-file blob $from_index
3887 + lappend blameargs | git cat-file blob $from_index
3888 }
3889 lappend blameargs | git blame -p -L$line,+1
3890 if {$from_index ne {}} {
3891 - lappend blameargs --contents -
3891 + lappend blameargs --contents -
3892 } else {
3893 - lappend blameargs $id
3893 + lappend blameargs $id
3894 }
3895 lappend blameargs -- [file join $cdup $flist_menu_file]
3896 if {[catch {
3897 - set f [open $blameargs r]
3897 + set f [open $blameargs r]
3898 } err]} {
3899 - error_popup [mc "Couldn't start git blame: %s" $err]
3900 - return
3899 + error_popup [mc "Couldn't start git blame: %s" $err]
3900 + return
3901 }
3902 nowbusy blaming [mc "Searching"]
3903 fconfigure $f -blocking 0
@@ -3911,9 +3911,9 @@ proc stopblaming {} {
3911 global blameinst
3912
3913 if {[info exists blameinst]} {
3914 - stop_instance $blameinst
3915 - unset blameinst
3916 - notbusy blaming
3914 + stop_instance $blameinst
3915 + unset blameinst
3916 + notbusy blaming
3917 }
3918 }
3919
@@ -3921,18 +3921,18 @@ proc read_line_source {fd inst} {
3921 global blamestuff curview commfd blameinst nullid nullid2
3922
3923 while {[gets $fd line] >= 0} {
3924 - lappend blamestuff($inst) $line
3924 + lappend blamestuff($inst) $line
3925 }
3926 if {![eof $fd]} {
3927 - return 1
3927 + return 1
3928 }
3929 unset commfd($inst)
3930 unset blameinst
3931 notbusy blaming
3932 fconfigure $fd -blocking 1
3933 if {[catch {close $fd} err]} {
3934 - error_popup [mc "Error running git blame: %s" $err]
3935 - return 0
3934 + error_popup [mc "Error running git blame: %s" $err]
3935 + return 0
3936 }
3937
3938 set fname {}
@@ -3940,30 +3940,30 @@ proc read_line_source {fd inst} {
3940 set id [lindex $line 0]
3941 set lnum [lindex $line 1]
3942 if {[string length $id] == 40 && [string is xdigit $id] &&
3943 - [string is digit -strict $lnum]} {
3944 - # look for "filename" line
3945 - foreach l $blamestuff($inst) {
3946 - if {[string match "filename *" $l]} {
3947 - set fname [string range $l 9 end]
3948 - break
3949 - }
3950 - }
3943 + [string is digit -strict $lnum]} {
3944 + # look for "filename" line
3945 + foreach l $blamestuff($inst) {
3946 + if {[string match "filename *" $l]} {
3947 + set fname [string range $l 9 end]
3948 + break
3949 + }
3950 + }
3951 }
3952 if {$fname ne {}} {
3953 - # all looks good, select it
3954 - if {$id eq $nullid} {
3955 - # blame uses all-zeroes to mean not committed,
3956 - # which would mean a change in the index
3957 - set id $nullid2
3958 - }
3959 - if {[commitinview $id $curview]} {
3960 - selectline [rowofcommit $id] 1 [list $fname $lnum] 1
3961 - } else {
3962 - error_popup [mc "That line comes from commit %s, \
3963 - which is not in this view" [shortids $id]]
3964 - }
3953 + # all looks good, select it
3954 + if {$id eq $nullid} {
3955 + # blame uses all-zeroes to mean not committed,
3956 + # which would mean a change in the index
3957 + set id $nullid2
3958 + }
3959 + if {[commitinview $id $curview]} {
3960 + selectline [rowofcommit $id] 1 [list $fname $lnum] 1
3961 + } else {
3962 + error_popup [mc "That line comes from commit %s, \
3963 + which is not in this view" [shortids $id]]
3964 + }
3965 } else {
3966 - puts "oops couldn't parse git blame output"
3966 + puts "oops couldn't parse git blame output"
3967 }
3968 return 0
3969 }
@@ -3972,11 +3972,11 @@ proc read_line_source {fd inst} {
3972 proc delete_at_eof {f dir} {
3973 while {[gets $f line] >= 0} {}
3974 if {[eof $f]} {
3975 - if {[catch {close $f} err]} {
3976 - error_popup "[mc "External diff viewer failed:"] $err"
3977 - }
3978 - file delete -force $dir
3979 - return 0
3975 + if {[catch {close $f} err]} {
3976 + error_popup "[mc "External diff viewer failed:"] $err"
3977 + }
3978 + file delete -force $dir
3979 + return 0
3980 }
3981 return 1
3982 }
@@ -3985,13 +3985,13 @@ proc delete_at_eof {f dir} {
3985
3986 proc shellquote {str} {
3987 if {![string match "*\['\"\\ \t]*" $str]} {
3988 - return $str
3988 + return $str
3989 }
3990 if {![string match "*\['\"\\]*" $str]} {
3991 - return "\"$str\""
3991 + return "\"$str\""
3992 }
3993 if {![string match "*'*" $str]} {
3994 - return "'$str'"
3994 + return "'$str'"
3995 }
3996 return "\"[string map {\" \\\" \\ \\\\} $str]\""
3997 }
@@ -3999,10 +3999,10 @@ proc shellquote {str} {
3999 proc shellarglist {l} {
4000 set str {}
4001 foreach a $l {
4002 - if {$str ne {}} {
4003 - append str " "
4004 - }
4005 - append str [shellquote $a]
4002 + if {$str ne {}} {
4003 + append str " "
4004 + }
4005 + append str [shellquote $a]
4006 }
4007 return $str
4008 }
@@ -4011,52 +4011,52 @@ proc shelldequote {str} {
4011 set ret {}
4012 set used -1
4013 while {1} {
4014 - incr used
4015 - if {![regexp -start $used -indices "\['\"\\\\ \t]" $str first]} {
4016 - append ret [string range $str $used end]
4017 - set used [string length $str]
4018 - break
4019 - }
4020 - set first [lindex $first 0]
4021 - set ch [string index $str $first]
4022 - if {$first > $used} {
4023 - append ret [string range $str $used [expr {$first - 1}]]
4024 - set used $first
4025 - }
4026 - if {$ch eq " " || $ch eq "\t"} break
4027 - incr used
4028 - if {$ch eq "'"} {
4029 - set first [string first "'" $str $used]
4030 - if {$first < 0} {
4031 - error "unmatched single-quote"
4032 - }
4033 - append ret [string range $str $used [expr {$first - 1}]]
4034 - set used $first
4035 - continue
4036 - }
4037 - if {$ch eq "\\"} {
4038 - if {$used >= [string length $str]} {
4039 - error "trailing backslash"
4040 - }
4041 - append ret [string index $str $used]
4042 - continue
4043 - }
4044 - # here ch == "\""
4045 - while {1} {
4046 - if {![regexp -start $used -indices "\[\"\\\\]" $str first]} {
4047 - error "unmatched double-quote"
4048 - }
4049 - set first [lindex $first 0]
4050 - set ch [string index $str $first]
4051 - if {$first > $used} {
4052 - append ret [string range $str $used [expr {$first - 1}]]
4053 - set used $first
4054 - }
4055 - if {$ch eq "\""} break
4056 - incr used
4057 - append ret [string index $str $used]
4058 - incr used
4059 - }
4014 + incr used
4015 + if {![regexp -start $used -indices "\['\"\\\\ \t]" $str first]} {
4016 + append ret [string range $str $used end]
4017 + set used [string length $str]
4018 + break
4019 + }
4020 + set first [lindex $first 0]
4021 + set ch [string index $str $first]
4022 + if {$first > $used} {
4023 + append ret [string range $str $used [expr {$first - 1}]]
4024 + set used $first
4025 + }
4026 + if {$ch eq " " || $ch eq "\t"} break
4027 + incr used
4028 + if {$ch eq "'"} {
4029 + set first [string first "'" $str $used]
4030 + if {$first < 0} {
4031 + error "unmatched single-quote"
4032 + }
4033 + append ret [string range $str $used [expr {$first - 1}]]
4034 + set used $first
4035 + continue
4036 + }
4037 + if {$ch eq "\\"} {
4038 + if {$used >= [string length $str]} {
4039 + error "trailing backslash"
4040 + }
4041 + append ret [string index $str $used]
4042 + continue
4043 + }
4044 + # here ch == "\""
4045 + while {1} {
4046 + if {![regexp -start $used -indices "\[\"\\\\]" $str first]} {
4047 + error "unmatched double-quote"
4048 + }
4049 + set first [lindex $first 0]
4050 + set ch [string index $str $first]
4051 + if {$first > $used} {
4052 + append ret [string range $str $used [expr {$first - 1}]]
4053 + set used $first
4054 + }
4055 + if {$ch eq "\""} break
4056 + incr used
4057 + append ret [string index $str $used]
4058 + incr used
4059 + }
4060 }
4061 return [list $used $ret]
4062 }
@@ -4064,13 +4064,13 @@ proc shelldequote {str} {
4064 proc shellsplit {str} {
4065 set l {}
4066 while {1} {
4067 - set str [string trimleft $str]
4068 - if {$str eq {}} break
4069 - set dq [shelldequote $str]
4070 - set n [lindex $dq 0]
4071 - set word [lindex $dq 1]
4072 - set str [string range $str $n end]
4073 - lappend l $word
4067 + set str [string trimleft $str]
4068 + if {$str eq {}} break
4069 + set dq [shelldequote $str]
4070 + set n [lindex $dq 0]
4071 + set word [lindex $dq 1]
4072 + set str [string range $str $n end]
4073 + lappend l $word
4074 }
4075 return $l
4076 }
@@ -4079,11 +4079,11 @@ proc set_window_title {} {
4079 global appname curview viewname vrevs
4080 set rev [mc "All files"]
4081 if {$curview ne 0} {
4082 - if {$viewname($curview) eq [mc "Command line"]} {
4083 - set rev [string map {"--gitk-symmetric-diff-marker" "--merge"} $vrevs($curview)]
4084 - } else {
4085 - set rev $viewname($curview)
4086 - }
4082 + if {$viewname($curview) eq [mc "Command line"]} {
4083 + set rev [string map {"--gitk-symmetric-diff-marker" "--merge"} $vrevs($curview)]
4084 + } else {
4085 + set rev $viewname($curview)
4086 + }
4087 }
4088 wm title . "[reponame]: $rev - $appname"
4089 }
@@ -4097,8 +4097,8 @@ proc newview {ishighlight} {
4097 set newishighlight $ishighlight
4098 set top .gitkview
4099 if {[winfo exists $top]} {
4100 - raise $top
4101 - return
4100 + raise $top
4101 + return
4102 }
4103 decode_view_opts $nextviewnum $revtreeargs
4104 set newviewname($nextviewnum) "[mc "View"] $nextviewnum"
@@ -4147,29 +4147,29 @@ proc encode_view_opts {n} {
4147
4148 set rargs [list]
4149 foreach opt $known_view_options {
4150 - set patterns [lindex $opt 3]
4151 - if {$patterns eq {}} continue
4152 - set pattern [lindex $patterns 0]
4153 -
4154 - if {[lindex $opt 1] eq "b"} {
4155 - set val $newviewopts($n,[lindex $opt 0])
4156 - if {$val} {
4157 - lappend rargs $pattern
4158 - }
4159 - } elseif {[regexp {^r(\d+)$} [lindex $opt 1] type value]} {
4160 - regexp {^(.*_)} [lindex $opt 0] uselessvar button_id
4161 - set val $newviewopts($n,$button_id)
4162 - if {$val eq $value} {
4163 - lappend rargs $pattern
4164 - }
4165 - } else {
4166 - set val $newviewopts($n,[lindex $opt 0])
4167 - set val [string trim $val]
4168 - if {$val ne {}} {
4169 - set pfix [string range $pattern 0 end-1]
4170 - lappend rargs $pfix$val
4171 - }
4172 - }
4150 + set patterns [lindex $opt 3]
4151 + if {$patterns eq {}} continue
4152 + set pattern [lindex $patterns 0]
4153 +
4154 + if {[lindex $opt 1] eq "b"} {
4155 + set val $newviewopts($n,[lindex $opt 0])
4156 + if {$val} {
4157 + lappend rargs $pattern
4158 + }
4159 + } elseif {[regexp {^r(\d+)$} [lindex $opt 1] type value]} {
4160 + regexp {^(.*_)} [lindex $opt 0] uselessvar button_id
4161 + set val $newviewopts($n,$button_id)
4162 + if {$val eq $value} {
4163 + lappend rargs $pattern
4164 + }
4165 + } else {
4166 + set val $newviewopts($n,[lindex $opt 0])
4167 + set val [string trim $val]
4168 + if {$val ne {}} {
4169 + set pfix [string range $pattern 0 end-1]
4170 + lappend rargs $pfix$val
4171 + }
4172 + }
4173 }
4174 set rargs [concat $rargs [shellsplit $newviewopts($n,refs)]]
4175 return [concat $rargs [shellsplit $newviewopts($n,args)]]
@@ -4180,59 +4180,59 @@ proc decode_view_opts {n view_args} {
4180 global known_view_options newviewopts
4181
4182 foreach opt $known_view_options {
4183 - set id [lindex $opt 0]
4184 - if {[lindex $opt 1] eq "b"} {
4185 - # Checkboxes
4186 - set val 0
4183 + set id [lindex $opt 0]
4184 + if {[lindex $opt 1] eq "b"} {
4185 + # Checkboxes
4186 + set val 0
4187 } elseif {[regexp {^r(\d+)$} [lindex $opt 1]]} {
4188 - # Radiobuttons
4189 - regexp {^(.*_)} $id uselessvar id
4190 - set val 0
4191 - } else {
4192 - # Text fields
4193 - set val {}
4194 - }
4195 - set newviewopts($n,$id) $val
4188 + # Radiobuttons
4189 + regexp {^(.*_)} $id uselessvar id
4190 + set val 0
4191 + } else {
4192 + # Text fields
4193 + set val {}
4194 + }
4195 + set newviewopts($n,$id) $val
4196 }
4197 set oargs [list]
4198 set refargs [list]
4199 foreach arg $view_args {
4200 - if {[regexp -- {^-([0-9]+)$} $arg arg cnt]
4201 - && ![info exists found(limit)]} {
4202 - set newviewopts($n,limit) $cnt
4203 - set found(limit) 1
4204 - continue
4205 - }
4206 - catch { unset val }
4207 - foreach opt $known_view_options {
4208 - set id [lindex $opt 0]
4209 - if {[info exists found($id)]} continue
4210 - foreach pattern [lindex $opt 3] {
4211 - if {![string match $pattern $arg]} continue
4212 - if {[lindex $opt 1] eq "b"} {
4213 - # Check buttons
4214 - set val 1
4215 - } elseif {[regexp {^r(\d+)$} [lindex $opt 1] match num]} {
4216 - # Radio buttons
4217 - regexp {^(.*_)} $id uselessvar id
4218 - set val $num
4219 - } else {
4220 - # Text input fields
4221 - set size [string length $pattern]
4222 - set val [string range $arg [expr {$size-1}] end]
4223 - }
4224 - set newviewopts($n,$id) $val
4225 - set found($id) 1
4226 - break
4227 - }
4228 - if {[info exists val]} break
4229 - }
4230 - if {[info exists val]} continue
4231 - if {[regexp {^-} $arg]} {
4232 - lappend oargs $arg
4233 - } else {
4234 - lappend refargs $arg
4235 - }
4200 + if {[regexp -- {^-([0-9]+)$} $arg arg cnt]
4201 + && ![info exists found(limit)]} {
4202 + set newviewopts($n,limit) $cnt
4203 + set found(limit) 1
4204 + continue
4205 + }
4206 + catch { unset val }
4207 + foreach opt $known_view_options {
4208 + set id [lindex $opt 0]
4209 + if {[info exists found($id)]} continue
4210 + foreach pattern [lindex $opt 3] {
4211 + if {![string match $pattern $arg]} continue
4212 + if {[lindex $opt 1] eq "b"} {
4213 + # Check buttons
4214 + set val 1
4215 + } elseif {[regexp {^r(\d+)$} [lindex $opt 1] match num]} {
4216 + # Radio buttons
4217 + regexp {^(.*_)} $id uselessvar id
4218 + set val $num
4219 + } else {
4220 + # Text input fields
4221 + set size [string length $pattern]
4222 + set val [string range $arg [expr {$size-1}] end]
4223 + }
4224 + set newviewopts($n,$id) $val
4225 + set found($id) 1
4226 + break
4227 + }
4228 + if {[info exists val]} break
4229 + }
4230 + if {[info exists val]} continue
4231 + if {[regexp {^-} $arg]} {
4232 + lappend oargs $arg
4233 + } else {
4234 + lappend refargs $arg
4235 + }
4236 }
4237 set newviewopts($n,refs) [shellarglist $refargs]
4238 set newviewopts($n,args) [shellarglist $oargs]
@@ -4242,9 +4242,9 @@ proc edit_or_newview {} {
4242 global curview
4243
4244 if {$curview > 0} {
4245 - editview
4245 + editview
4246 } else {
4247 - newview 0
4247 + newview 0
4248 }
4249 }
4250
@@ -4255,8 +4255,8 @@ proc editview {} {
4255
4256 set top .gitkvedit-$curview
4257 if {[winfo exists $top]} {
4258 - raise $top
4259 - return
4258 + raise $top
4259 + return
4260 }
4261 decode_view_opts $curview $viewargs($curview)
4262 set newviewname($curview) $viewname($curview)
@@ -4286,66 +4286,66 @@ proc vieweditor {top n title} {
4286 set cexpand 0
4287 set cnt 0
4288 foreach opt $known_view_options {
4289 - set id [lindex $opt 0]
4290 - set type [lindex $opt 1]
4291 - set flags [lindex $opt 2]
4292 - set title [eval [lindex $opt 4]]
4293 - set lxpad 0
4294 -

This file is too large to show in full.