|
|
|
@ -34,10 +34,10 @@ proc start_rev_list {view} {
@@ -34,10 +34,10 @@ proc start_rev_list {view} {
|
|
|
|
|
set order "--date-order" |
|
|
|
|
} |
|
|
|
|
if {[catch { |
|
|
|
|
set fd [open [concat | git-rev-list --header $order \ |
|
|
|
|
set fd [open [concat | git rev-list --header $order \ |
|
|
|
|
--parents --boundary --default HEAD $args] r] |
|
|
|
|
} err]} { |
|
|
|
|
puts stderr "Error executing git-rev-list: $err" |
|
|
|
|
puts stderr "Error executing git rev-list: $err" |
|
|
|
|
exit 1 |
|
|
|
|
} |
|
|
|
|
set commfd($view) $fd |
|
|
|
@ -94,10 +94,10 @@ proc getcommitlines {fd view} {
@@ -94,10 +94,10 @@ proc getcommitlines {fd view} {
|
|
|
|
|
} |
|
|
|
|
if {[string range $err 0 4] == "usage"} { |
|
|
|
|
set err "Gitk: error reading commits$fv:\ |
|
|
|
|
bad arguments to git-rev-list." |
|
|
|
|
bad arguments to git rev-list." |
|
|
|
|
if {$viewname($view) eq "Command line"} { |
|
|
|
|
append err \ |
|
|
|
|
" (Note: arguments to gitk are passed to git-rev-list\ |
|
|
|
|
" (Note: arguments to gitk are passed to git rev-list\ |
|
|
|
|
to allow selection of commits to be displayed.)" |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -148,7 +148,7 @@ proc getcommitlines {fd view} {
@@ -148,7 +148,7 @@ proc getcommitlines {fd view} {
|
|
|
|
|
if {[string length $shortcmit] > 80} { |
|
|
|
|
set shortcmit "[string range $shortcmit 0 80]..." |
|
|
|
|
} |
|
|
|
|
error_popup "Can't parse git-rev-list output: {$shortcmit}" |
|
|
|
|
error_popup "Can't parse git rev-list output: {$shortcmit}" |
|
|
|
|
exit 1 |
|
|
|
|
} |
|
|
|
|
set id [lindex $ids 0] |
|
|
|
@ -217,7 +217,7 @@ proc doupdate {} {
@@ -217,7 +217,7 @@ proc doupdate {} {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc readcommit {id} { |
|
|
|
|
if {[catch {set contents [exec git-cat-file commit $id]}]} return |
|
|
|
|
if {[catch {set contents [exec git cat-file commit $id]}]} return |
|
|
|
|
parsecommit $id $contents 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -276,8 +276,8 @@ proc parsecommit {id contents listed} {
@@ -276,8 +276,8 @@ proc parsecommit {id contents listed} {
|
|
|
|
|
set headline $comment |
|
|
|
|
} |
|
|
|
|
if {!$listed} { |
|
|
|
|
# git-rev-list indents the comment by 4 spaces; |
|
|
|
|
# if we got this via git-cat-file, add the indentation |
|
|
|
|
# git rev-list indents the comment by 4 spaces; |
|
|
|
|
# if we got this via git cat-file, add the indentation |
|
|
|
|
set newcomment {} |
|
|
|
|
foreach line [split $comment "\n"] { |
|
|
|
|
append newcomment " " |
|
|
|
@ -337,14 +337,14 @@ proc readrefs {} {
@@ -337,14 +337,14 @@ proc readrefs {} {
|
|
|
|
|
set type {} |
|
|
|
|
set tag {} |
|
|
|
|
catch { |
|
|
|
|
set commit [exec git-rev-parse "$id^0"] |
|
|
|
|
set commit [exec git rev-parse "$id^0"] |
|
|
|
|
if {"$commit" != "$id"} { |
|
|
|
|
set tagids($name) $commit |
|
|
|
|
lappend idtags($commit) $name |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch { |
|
|
|
|
set tagcontents($name) [exec git-cat-file tag "$id"] |
|
|
|
|
set tagcontents($name) [exec git cat-file tag "$id"] |
|
|
|
|
} |
|
|
|
|
} elseif { $type == "heads" } { |
|
|
|
|
set headids($name) $id |
|
|
|
@ -357,21 +357,21 @@ proc readrefs {} {
@@ -357,21 +357,21 @@ proc readrefs {} {
|
|
|
|
|
close $refd |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc show_error {w msg} { |
|
|
|
|
proc show_error {w top msg} { |
|
|
|
|
message $w.m -text $msg -justify center -aspect 400 |
|
|
|
|
pack $w.m -side top -fill x -padx 20 -pady 20 |
|
|
|
|
button $w.ok -text OK -command "destroy $w" |
|
|
|
|
button $w.ok -text OK -command "destroy $top" |
|
|
|
|
pack $w.ok -side bottom -fill x |
|
|
|
|
bind $w <Visibility> "grab $w; focus $w" |
|
|
|
|
bind $w <Key-Return> "destroy $w" |
|
|
|
|
tkwait window $w |
|
|
|
|
bind $top <Visibility> "grab $top; focus $top" |
|
|
|
|
bind $top <Key-Return> "destroy $top" |
|
|
|
|
tkwait window $top |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc error_popup msg { |
|
|
|
|
set w .error |
|
|
|
|
toplevel $w |
|
|
|
|
wm transient $w . |
|
|
|
|
show_error $w $msg |
|
|
|
|
show_error $w $w $msg |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc makewindow {} { |
|
|
|
@ -380,7 +380,7 @@ proc makewindow {} {
@@ -380,7 +380,7 @@ proc makewindow {} {
|
|
|
|
|
global findtype findtypemenu findloc findstring fstring geometry |
|
|
|
|
global entries sha1entry sha1string sha1but |
|
|
|
|
global maincursor textcursor curtextcursor |
|
|
|
|
global rowctxmenu mergemax |
|
|
|
|
global rowctxmenu mergemax wrapcomment |
|
|
|
|
|
|
|
|
|
menu .bar |
|
|
|
|
.bar add cascade -label "File" -menu .bar.file |
|
|
|
@ -527,6 +527,7 @@ proc makewindow {} {
@@ -527,6 +527,7 @@ proc makewindow {} {
|
|
|
|
|
pack $ctext -side left -fill both -expand 1 |
|
|
|
|
.ctop.cdet add .ctop.cdet.left |
|
|
|
|
|
|
|
|
|
$ctext tag conf comment -wrap $wrapcomment |
|
|
|
|
$ctext tag conf filesep -font [concat $textfont bold] -back "#aaaaaa" |
|
|
|
|
$ctext tag conf hunksep -fore blue |
|
|
|
|
$ctext tag conf d0 -fore red |
|
|
|
@ -696,7 +697,7 @@ proc savestuff {w} {
@@ -696,7 +697,7 @@ proc savestuff {w} {
|
|
|
|
|
global stuffsaved findmergefiles maxgraphpct |
|
|
|
|
global maxwidth |
|
|
|
|
global viewname viewfiles viewargs viewperm nextviewnum |
|
|
|
|
global cmitmode |
|
|
|
|
global cmitmode wrapcomment |
|
|
|
|
|
|
|
|
|
if {$stuffsaved} return |
|
|
|
|
if {![winfo viewable .]} return |
|
|
|
@ -709,6 +710,7 @@ proc savestuff {w} {
@@ -709,6 +710,7 @@ proc savestuff {w} {
|
|
|
|
|
puts $f [list set maxgraphpct $maxgraphpct] |
|
|
|
|
puts $f [list set maxwidth $maxwidth] |
|
|
|
|
puts $f [list set cmitmode $cmitmode] |
|
|
|
|
puts $f [list set wrapcomment $wrapcomment] |
|
|
|
|
puts $f "set geometry(width) [winfo width .ctop]" |
|
|
|
|
puts $f "set geometry(height) [winfo height .ctop]" |
|
|
|
|
puts $f "set geometry(canv1) [expr {[winfo width $canv]-2}]" |
|
|
|
@ -1285,7 +1287,7 @@ proc vieweditor {top n title} {
@@ -1285,7 +1287,7 @@ proc vieweditor {top n title} {
|
|
|
|
|
checkbutton $top.perm -text "Remember this view" -variable newviewperm($n) |
|
|
|
|
grid $top.perm - -pady 5 -sticky w |
|
|
|
|
message $top.al -aspect 1000 -font $uifont \ |
|
|
|
|
-text "Commits to include (arguments to git-rev-list):" |
|
|
|
|
-text "Commits to include (arguments to git rev-list):" |
|
|
|
|
grid $top.al - -sticky w -pady 5 |
|
|
|
|
entry $top.args -width 50 -textvariable newviewargs($n) \ |
|
|
|
|
-background white |
|
|
|
@ -2939,7 +2941,7 @@ proc findpatches {} {
@@ -2939,7 +2941,7 @@ proc findpatches {} {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if {[catch { |
|
|
|
|
set f [open [list | git-diff-tree --stdin -s -r -S$findstring \ |
|
|
|
|
set f [open [list | git diff-tree --stdin -s -r -S$findstring \ |
|
|
|
|
<< $inputids] r] |
|
|
|
|
} err]} { |
|
|
|
|
error_popup "Error starting search process: $err" |
|
|
|
@ -2971,7 +2973,7 @@ proc readfindproc {} {
@@ -2971,7 +2973,7 @@ proc readfindproc {} {
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if {![regexp {^[0-9a-f]{40}} $line id]} { |
|
|
|
|
error_popup "Can't parse git-diff-tree output: $line" |
|
|
|
|
error_popup "Can't parse git diff-tree output: $line" |
|
|
|
|
stopfindproc |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -3036,10 +3038,10 @@ proc findfiles {} {
@@ -3036,10 +3038,10 @@ proc findfiles {} {
|
|
|
|
|
if {$l == $findstartline} break |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# start off a git-diff-tree process if needed |
|
|
|
|
# start off a git diff-tree process if needed |
|
|
|
|
if {$diffsneeded ne {}} { |
|
|
|
|
if {[catch { |
|
|
|
|
set df [open [list | git-diff-tree -r --stdin << $diffsneeded] r] |
|
|
|
|
set df [open [list | git diff-tree -r --stdin << $diffsneeded] r] |
|
|
|
|
} err ]} { |
|
|
|
|
error_popup "Error starting search process: $err" |
|
|
|
|
return |
|
|
|
@ -3069,7 +3071,7 @@ proc readfilediffs {df} {
@@ -3069,7 +3071,7 @@ proc readfilediffs {df} {
|
|
|
|
|
if {[catch {close $df} err]} { |
|
|
|
|
stopfindproc |
|
|
|
|
bell |
|
|
|
|
error_popup "Error in git-diff-tree: $err" |
|
|
|
|
error_popup "Error in git diff-tree: $err" |
|
|
|
|
} elseif {[info exists findid]} { |
|
|
|
|
set id $findid |
|
|
|
|
stopfindproc |
|
|
|
@ -3096,7 +3098,7 @@ proc donefilediff {} {
@@ -3096,7 +3098,7 @@ proc donefilediff {} {
|
|
|
|
|
if {[info exists fdiffid]} { |
|
|
|
|
while {[lindex $fdiffsneeded $fdiffpos] ne $fdiffid |
|
|
|
|
&& $fdiffpos < [llength $fdiffsneeded]} { |
|
|
|
|
# git-diff-tree doesn't output anything for a commit |
|
|
|
|
# git diff-tree doesn't output anything for a commit |
|
|
|
|
# which doesn't change anything |
|
|
|
|
set nullid [lindex $fdiffsneeded $fdiffpos] |
|
|
|
|
set treediffs($nullid) {} |
|
|
|
@ -3213,8 +3215,11 @@ proc selcanvline {w x y} {
@@ -3213,8 +3215,11 @@ proc selcanvline {w x y} {
|
|
|
|
|
|
|
|
|
|
proc commit_descriptor {p} { |
|
|
|
|
global commitinfo |
|
|
|
|
if {![info exists commitinfo($p)]} { |
|
|
|
|
getcommit $p |
|
|
|
|
} |
|
|
|
|
set l "..." |
|
|
|
|
if {[info exists commitinfo($p)]} { |
|
|
|
|
if {[llength $commitinfo($p)] > 1} { |
|
|
|
|
set l [lindex $commitinfo($p) 0] |
|
|
|
|
} |
|
|
|
|
return "$p ($l)" |
|
|
|
@ -3222,11 +3227,11 @@ proc commit_descriptor {p} {
@@ -3222,11 +3227,11 @@ proc commit_descriptor {p} {
|
|
|
|
|
|
|
|
|
|
# append some text to the ctext widget, and make any SHA1 ID |
|
|
|
|
# that we know about be a clickable link. |
|
|
|
|
proc appendwithlinks {text} { |
|
|
|
|
proc appendwithlinks {text tags} { |
|
|
|
|
global ctext commitrow linknum curview |
|
|
|
|
|
|
|
|
|
set start [$ctext index "end - 1c"] |
|
|
|
|
$ctext insert end $text |
|
|
|
|
$ctext insert end $text $tags |
|
|
|
|
$ctext insert end "\n" |
|
|
|
|
set links [regexp -indices -all -inline {[0-9a-f]{40}} $text] |
|
|
|
|
foreach l $links { |
|
|
|
@ -3354,7 +3359,7 @@ proc selectline {l isnew} {
@@ -3354,7 +3359,7 @@ proc selectline {l isnew} {
|
|
|
|
|
$ctext insert end "\n" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
set comment {} |
|
|
|
|
set headers {} |
|
|
|
|
set olds [lindex $parentlist $l] |
|
|
|
|
if {[llength $olds] > 1} { |
|
|
|
|
set np 0 |
|
|
|
@ -3365,23 +3370,22 @@ proc selectline {l isnew} {
@@ -3365,23 +3370,22 @@ proc selectline {l isnew} {
|
|
|
|
|
set tag m$np |
|
|
|
|
} |
|
|
|
|
$ctext insert end "Parent: " $tag |
|
|
|
|
appendwithlinks [commit_descriptor $p] |
|
|
|
|
appendwithlinks [commit_descriptor $p] {} |
|
|
|
|
incr np |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
foreach p $olds { |
|
|
|
|
append comment "Parent: [commit_descriptor $p]\n" |
|
|
|
|
append headers "Parent: [commit_descriptor $p]\n" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach c [lindex $childlist $l] { |
|
|
|
|
append comment "Child: [commit_descriptor $c]\n" |
|
|
|
|
append headers "Child: [commit_descriptor $c]\n" |
|
|
|
|
} |
|
|
|
|
append comment "\n" |
|
|
|
|
append comment [lindex $info 5] |
|
|
|
|
|
|
|
|
|
# make anything that looks like a SHA1 ID be a clickable link |
|
|
|
|
appendwithlinks $comment |
|
|
|
|
appendwithlinks $headers {} |
|
|
|
|
appendwithlinks [lindex $info 5] {comment} |
|
|
|
|
|
|
|
|
|
$ctext tag delete Comments |
|
|
|
|
$ctext tag remove found 1.0 end |
|
|
|
@ -3426,6 +3430,7 @@ proc selnextpage {dir} {
@@ -3426,6 +3430,7 @@ proc selnextpage {dir} {
|
|
|
|
|
set lpp 1 |
|
|
|
|
} |
|
|
|
|
allcanvs yview scroll [expr {$dir * $lpp}] units |
|
|
|
|
drawvisible |
|
|
|
|
if {![info exists selectedline]} return |
|
|
|
|
set l [expr {$selectedline + $dir * $lpp}] |
|
|
|
|
if {$l < 0} { |
|
|
|
@ -3521,7 +3526,7 @@ proc gettree {id} {
@@ -3521,7 +3526,7 @@ proc gettree {id} {
|
|
|
|
|
catch {unset diffmergeid} |
|
|
|
|
if {![info exists treefilelist($id)]} { |
|
|
|
|
if {![info exists treepending]} { |
|
|
|
|
if {[catch {set gtf [open [concat | git-ls-tree -r $id] r]}]} { |
|
|
|
|
if {[catch {set gtf [open [concat | git ls-tree -r $id] r]}]} { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
set treepending $id |
|
|
|
@ -3569,7 +3574,7 @@ proc showfile {f} {
@@ -3569,7 +3574,7 @@ proc showfile {f} {
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
set blob [lindex $treeidlist($diffids) $i] |
|
|
|
|
if {[catch {set bf [open [concat | git-cat-file blob $blob] r]} err]} { |
|
|
|
|
if {[catch {set bf [open [concat | git cat-file blob $blob] r]} err]} { |
|
|
|
|
puts "oops, error reading blob $blob: $err" |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -3611,7 +3616,7 @@ proc mergediff {id l} {
@@ -3611,7 +3616,7 @@ proc mergediff {id l} {
|
|
|
|
|
set diffids $id |
|
|
|
|
# this doesn't seem to actually affect anything... |
|
|
|
|
set env(GIT_DIFF_OPTS) $diffopts |
|
|
|
|
set cmd [concat | git-diff-tree --no-commit-id --cc $id] |
|
|
|
|
set cmd [concat | git diff-tree --no-commit-id --cc $id] |
|
|
|
|
if {[catch {set mdf [open $cmd r]} err]} { |
|
|
|
|
error_popup "Error getting merge diffs: $err" |
|
|
|
|
return |
|
|
|
@ -3723,7 +3728,7 @@ proc gettreediffs {ids} {
@@ -3723,7 +3728,7 @@ proc gettreediffs {ids} {
|
|
|
|
|
set treepending $ids |
|
|
|
|
set treediff {} |
|
|
|
|
if {[catch \ |
|
|
|
|
{set gdtf [open [concat | git-diff-tree --no-commit-id -r $ids] r]} \ |
|
|
|
|
{set gdtf [open [concat | git diff-tree --no-commit-id -r $ids] r]} \ |
|
|
|
|
]} return |
|
|
|
|
fconfigure $gdtf -blocking 0 |
|
|
|
|
fileevent $gdtf readable [list gettreediffline $gdtf $ids] |
|
|
|
@ -3759,7 +3764,7 @@ proc getblobdiffs {ids} {
@@ -3759,7 +3764,7 @@ proc getblobdiffs {ids} {
|
|
|
|
|
global nextupdate diffinhdr treediffs |
|
|
|
|
|
|
|
|
|
set env(GIT_DIFF_OPTS) $diffopts |
|
|
|
|
set cmd [concat | git-diff-tree --no-commit-id -r -p -C $ids] |
|
|
|
|
set cmd [concat | git diff-tree --no-commit-id -r -p -C $ids] |
|
|
|
|
if {[catch {set bdf [open $cmd r]} err]} { |
|
|
|
|
puts "error getting diffs: $err" |
|
|
|
|
return |
|
|
|
@ -4296,7 +4301,7 @@ proc mkpatchgo {} {
@@ -4296,7 +4301,7 @@ proc mkpatchgo {} {
|
|
|
|
|
set oldid [$patchtop.fromsha1 get] |
|
|
|
|
set newid [$patchtop.tosha1 get] |
|
|
|
|
set fname [$patchtop.fname get] |
|
|
|
|
if {[catch {exec git-diff-tree -p $oldid $newid >$fname &} err]} { |
|
|
|
|
if {[catch {exec git diff-tree -p $oldid $newid >$fname &} err]} { |
|
|
|
|
error_popup "Error creating patch: $err" |
|
|
|
|
} |
|
|
|
|
catch {destroy $patchtop} |
|
|
|
@ -4504,7 +4509,7 @@ proc showtag {tag isnew} {
@@ -4504,7 +4509,7 @@ proc showtag {tag isnew} {
|
|
|
|
|
} else { |
|
|
|
|
set text "Tag: $tag\nId: $tagids($tag)" |
|
|
|
|
} |
|
|
|
|
appendwithlinks $text |
|
|
|
|
appendwithlinks $text {} |
|
|
|
|
$ctext conf -state disabled |
|
|
|
|
init_flist {} |
|
|
|
|
} |
|
|
|
@ -4863,11 +4868,11 @@ proc tcl_encoding {enc} {
@@ -4863,11 +4868,11 @@ proc tcl_encoding {enc} {
|
|
|
|
|
# defaults... |
|
|
|
|
set datemode 0 |
|
|
|
|
set diffopts "-U 5 -p" |
|
|
|
|
set wrcomcmd "git-diff-tree --stdin -p --pretty" |
|
|
|
|
set wrcomcmd "git diff-tree --stdin -p --pretty" |
|
|
|
|
|
|
|
|
|
set gitencoding {} |
|
|
|
|
catch { |
|
|
|
|
set gitencoding [exec git-repo-config --get i18n.commitencoding] |
|
|
|
|
set gitencoding [exec git repo-config --get i18n.commitencoding] |
|
|
|
|
} |
|
|
|
|
if {$gitencoding == ""} { |
|
|
|
|
set gitencoding "utf-8" |
|
|
|
@ -4890,6 +4895,7 @@ set downarrowlen 7
@@ -4890,6 +4895,7 @@ set downarrowlen 7
|
|
|
|
|
set mingaplen 30 |
|
|
|
|
set flistmode "flat" |
|
|
|
|
set cmitmode "patch" |
|
|
|
|
set wrapcomment "none" |
|
|
|
|
|
|
|
|
|
set colors {green red blue magenta darkgrey brown orange} |
|
|
|
|
|
|
|
|
@ -4911,7 +4917,7 @@ foreach arg $argv {
@@ -4911,7 +4917,7 @@ foreach arg $argv {
|
|
|
|
|
# check that we can find a .git directory somewhere... |
|
|
|
|
set gitdir [gitdir] |
|
|
|
|
if {![file isdirectory $gitdir]} { |
|
|
|
|
show_error . "Cannot find the git directory \"$gitdir\"." |
|
|
|
|
show_error {} . "Cannot find the git directory \"$gitdir\"." |
|
|
|
|
exit 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -4922,7 +4928,7 @@ if {$i >= 0} {
@@ -4922,7 +4928,7 @@ if {$i >= 0} {
|
|
|
|
|
set revtreeargs [lrange $revtreeargs 0 [expr {$i - 1}]] |
|
|
|
|
} elseif {$revtreeargs ne {}} { |
|
|
|
|
if {[catch { |
|
|
|
|
set f [eval exec git-rev-parse --no-revs --no-flags $revtreeargs] |
|
|
|
|
set f [eval exec git rev-parse --no-revs --no-flags $revtreeargs] |
|
|
|
|
set cmdline_files [split $f "\n"] |
|
|
|
|
set n [llength $cmdline_files] |
|
|
|
|
set revtreeargs [lrange $revtreeargs 0 end-$n] |
|
|
|
@ -4931,9 +4937,9 @@ if {$i >= 0} {
@@ -4931,9 +4937,9 @@ if {$i >= 0} {
|
|
|
|
|
# so look for "fatal:". |
|
|
|
|
set i [string first "fatal:" $err] |
|
|
|
|
if {$i > 0} { |
|
|
|
|
set err [string range [expr {$i + 6}] end] |
|
|
|
|
set err [string range $err [expr {$i + 6}] end] |
|
|
|
|
} |
|
|
|
|
show_error . "Bad arguments to gitk:\n$err" |
|
|
|
|
show_error {} . "Bad arguments to gitk:\n$err" |
|
|
|
|
exit 1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|