6489
}
6490
}
6491
6492
+proc appendshortlink {id {pre {}} {post {}}} {
6493
+ global ctext linknum
6494
+
6495
+ $ctext insert end $pre
6496
+ $ctext tag delete link$linknum
6497
+ $ctext insert end [string range $id 0 7] link$linknum
6498
+ $ctext insert end $post
6499
+ setlink $id link$linknum
6500
+ incr linknum
6501
+}
6502
+
6503
proc makelink {id} {
6504
global pendinglinks
6505
8138
global patchids
8139
8140
if {![info exists patchids($id)]} {
8130
- set x [exec git diff-tree -p --root $id | git patch-id]
8131
- set patchids($id) [lindex $x 0]
8141
+ set cmd [diffcmd [list $id] {-p --root}]
8142
+ # trim off the initial "|"
8143
+ set cmd [lrange $cmd 1 end]
8144
+ if {[catch {
8145
+ set x [eval exec $cmd | git patch-id]
8146
+ set patchids($id) [lindex $x 0]
8147
+ }]} {
8148
+ set patchids($id) "error"
8149
+ }
8150
}
8151
return $patchids($id)
8152
}
8158
clear_ctext
8159
init_flist {}
8160
for {set i 0} {$i < 100} {incr i} {
8143
- set shorta [string range $a 0 7]
8144
- set shortb [string range $b 0 7]
8161
set skipa 0
8162
set skipb 0
8163
if {[llength $parents($curview,$a)] > 1} {
8148
- appendwithlinks [mc "Skipping merge commit %s\n" $shorta] {}
8164
+ appendshortlink $a [mc "Skipping merge commit "] "\n"
8165
set skipa 1
8166
} else {
8167
set patcha [getpatchid $a]
8168
}
8169
if {[llength $parents($curview,$b)] > 1} {
8154
- appendwithlinks [mc "Skipping merge commit %s\n" $shortb] {}
8170
+ appendshortlink $b [mc "Skipping merge commit "] "\n"
8171
set skipb 1
8172
} else {
8173
set patchb [getpatchid $b]
8175
if {!$skipa && !$skipb} {
8176
set heada [lindex $commitinfo($a) 0]
8177
set headb [lindex $commitinfo($b) 0]
8178
+ if {$patcha eq "error"} {
8179
+ appendshortlink $a [mc "Error getting patch ID for "] \
8180
+ [mc " - stopping\n"]
8181
+ break
8182
+ }
8183
+ if {$patchb eq "error"} {
8184
+ appendshortlink $b [mc "Error getting patch ID for "] \
8185
+ [mc " - stopping\n"]
8186
+ break
8187
+ }
8188
if {$patcha eq $patchb} {
8189
if {$heada eq $headb} {
8164
- appendwithlinks [mc "Commit %s == %s %s\n" \
8165
- $shorta $shortb $heada] {}
8190
+ appendshortlink $a [mc "Commit "]
8191
+ appendshortlink $b " == " " $heada\n"
8192
} else {
8167
- appendwithlinks [mc "Commit %s %s\n" $shorta $heada] {}
8168
- appendwithlinks [mc " is the same patch as\n"] {}
8169
- appendwithlinks [mc " %s %s\n" $shortb $headb] {}
8193
+ appendshortlink $a [mc "Commit "] " $heada\n"
8194
+ appendshortlink $b [mc " is the same patch as\n "] \
8195
+ " $headb\n"
8196
}
8197
set skipa 1
8198
set skipb 1
8199
} else {
8200
$ctext insert end "\n"
8175
- appendwithlinks [mc "Commit %s %s\n" $shorta $heada] {}
8176
- appendwithlinks [mc " differs from\n"] {}
8177
- appendwithlinks [mc " %s %s\n" $shortb $headb] {}
8178
- appendwithlinks [mc "- stopping\n"]
8201
+ appendshortlink $a [mc "Commit "] " $heada\n"
8202
+ appendshortlink $b [mc " differs from\n "] \
8203
+ " $headb\n"
8204
+ $ctext insert end [mc "- stopping\n"]
8205
break
8206
}
8207
}
8208
if {$skipa} {
8209
if {[llength $children($curview,$a)] != 1} {
8210
$ctext insert end "\n"
8185
- appendwithlinks [mc "Commit %s has %s children - stopping\n" \
8186
- $shorta [llength $children($curview,$a)]] {}
8211
+ appendshortlink $a [mc "Commit "] \
8212
+ [mc " has %s children - stopping\n" \
8213
+ [llength $children($curview,$a)]]
8214
break
8215
}
8216
set a [lindex $children($curview,$a) 0]
8217
}
8218
if {$skipb} {
8219
if {[llength $children($curview,$b)] != 1} {
8193
- appendwithlinks [mc "Commit %s has %s children - stopping\n" \
8194
- $shortb [llength $children($curview,$b)]] {}
8220
+ appendshortlink $b [mc "Commit "] \
8221
+ [mc " has %s children - stopping\n" \
8222
+ [llength $children($curview,$b)]]
8223
break
8224
}
8225
set b [lindex $children($curview,$b) 0]