Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk: gitk: Work around leftover temporary save file gitk: Show diff of commits at end of compare-commits output gitk: Update Swedish translation (280t0f0u)
This commit is contained in:
commit
0984e3a772
@ -2526,6 +2526,7 @@ proc savestuff {w} {
|
|||||||
if {$stuffsaved} return
|
if {$stuffsaved} return
|
||||||
if {![winfo viewable .]} return
|
if {![winfo viewable .]} return
|
||||||
catch {
|
catch {
|
||||||
|
if {[file exists ~/.gitk-new]} {file delete -force ~/.gitk-new}
|
||||||
set f [open "~/.gitk-new" w]
|
set f [open "~/.gitk-new" w]
|
||||||
if {$::tcl_platform(platform) eq {windows}} {
|
if {$::tcl_platform(platform) eq {windows}} {
|
||||||
file attributes "~/.gitk-new" -hidden true
|
file attributes "~/.gitk-new" -hidden true
|
||||||
@ -3167,6 +3168,28 @@ proc flist_hl {only} {
|
|||||||
set gdttype [mc "touching paths:"]
|
set gdttype [mc "touching paths:"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc gitknewtmpdir {} {
|
||||||
|
global diffnum gitktmpdir gitdir
|
||||||
|
|
||||||
|
if {![info exists gitktmpdir]} {
|
||||||
|
set gitktmpdir [file join [file dirname $gitdir] \
|
||||||
|
[format ".gitk-tmp.%s" [pid]]]
|
||||||
|
if {[catch {file mkdir $gitktmpdir} err]} {
|
||||||
|
error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
|
||||||
|
unset gitktmpdir
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
set diffnum 0
|
||||||
|
}
|
||||||
|
incr diffnum
|
||||||
|
set diffdir [file join $gitktmpdir $diffnum]
|
||||||
|
if {[catch {file mkdir $diffdir} err]} {
|
||||||
|
error_popup "[mc "Error creating temporary directory %s:" $diffdir] $err"
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
return $diffdir
|
||||||
|
}
|
||||||
|
|
||||||
proc save_file_from_commit {filename output what} {
|
proc save_file_from_commit {filename output what} {
|
||||||
global nullfile
|
global nullfile
|
||||||
|
|
||||||
@ -3201,11 +3224,10 @@ proc external_diff_get_one_file {diffid filename diffdir} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc external_diff {} {
|
proc external_diff {} {
|
||||||
global gitktmpdir nullid nullid2
|
global nullid nullid2
|
||||||
global flist_menu_file
|
global flist_menu_file
|
||||||
global diffids
|
global diffids
|
||||||
global diffnum
|
global extdifftool
|
||||||
global gitdir extdifftool
|
|
||||||
|
|
||||||
if {[llength $diffids] == 1} {
|
if {[llength $diffids] == 1} {
|
||||||
# no reference commit given
|
# no reference commit given
|
||||||
@ -3227,22 +3249,8 @@ proc external_diff {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# make sure that several diffs wont collide
|
# make sure that several diffs wont collide
|
||||||
if {![info exists gitktmpdir]} {
|
set diffdir [gitknewtmpdir]
|
||||||
set gitktmpdir [file join [file dirname $gitdir] \
|
if {$diffdir eq {}} return
|
||||||
[format ".gitk-tmp.%s" [pid]]]
|
|
||||||
if {[catch {file mkdir $gitktmpdir} err]} {
|
|
||||||
error_popup "[mc "Error creating temporary directory %s:" $gitktmpdir] $err"
|
|
||||||
unset gitktmpdir
|
|
||||||
return
|
|
||||||
}
|
|
||||||
set diffnum 0
|
|
||||||
}
|
|
||||||
incr diffnum
|
|
||||||
set diffdir [file join $gitktmpdir $diffnum]
|
|
||||||
if {[catch {file mkdir $diffdir} err]} {
|
|
||||||
error_popup "[mc "Error creating temporary directory %s:" $diffdir] $err"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# gather files to diff
|
# gather files to diff
|
||||||
set difffromfile [external_diff_get_one_file $diffidfrom $flist_menu_file $diffdir]
|
set difffromfile [external_diff_get_one_file $diffidfrom $flist_menu_file $diffdir]
|
||||||
@ -7400,7 +7408,7 @@ proc getblobdiffline {bdf ids} {
|
|||||||
$ctext conf -state normal
|
$ctext conf -state normal
|
||||||
while {[incr nr] <= 1000 && [gets $bdf line] >= 0} {
|
while {[incr nr] <= 1000 && [gets $bdf line] >= 0} {
|
||||||
if {$ids != $diffids || $bdf != $blobdifffd($ids)} {
|
if {$ids != $diffids || $bdf != $blobdifffd($ids)} {
|
||||||
close $bdf
|
catch {close $bdf}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if {![string compare -length 5 "diff " $line]} {
|
if {![string compare -length 5 "diff " $line]} {
|
||||||
@ -7552,7 +7560,7 @@ proc getblobdiffline {bdf ids} {
|
|||||||
}
|
}
|
||||||
$ctext conf -state disabled
|
$ctext conf -state disabled
|
||||||
if {[eof $bdf]} {
|
if {[eof $bdf]} {
|
||||||
close $bdf
|
catch {close $bdf}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return [expr {$nr >= 1000? 2: 1}]
|
return [expr {$nr >= 1000? 2: 1}]
|
||||||
@ -8273,8 +8281,11 @@ proc do_cmp_commits {a b} {
|
|||||||
appendshortlink $a [mc "Commit "] " $heada\n"
|
appendshortlink $a [mc "Commit "] " $heada\n"
|
||||||
appendshortlink $b [mc " differs from\n "] \
|
appendshortlink $b [mc " differs from\n "] \
|
||||||
" $headb\n"
|
" $headb\n"
|
||||||
$ctext insert end [mc "- stopping\n"]
|
$ctext insert end [mc "Diff of commits:\n\n"]
|
||||||
break
|
$ctext conf -state disabled
|
||||||
|
update
|
||||||
|
diffcommits $a $b
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if {$skipa} {
|
if {$skipa} {
|
||||||
@ -8300,6 +8311,31 @@ proc do_cmp_commits {a b} {
|
|||||||
$ctext conf -state disabled
|
$ctext conf -state disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc diffcommits {a b} {
|
||||||
|
global diffcontext diffids blobdifffd diffinhdr
|
||||||
|
|
||||||
|
set tmpdir [gitknewtmpdir]
|
||||||
|
set fna [file join $tmpdir "commit-[string range $a 0 7]"]
|
||||||
|
set fnb [file join $tmpdir "commit-[string range $b 0 7]"]
|
||||||
|
if {[catch {
|
||||||
|
exec git diff-tree -p --pretty $a >$fna
|
||||||
|
exec git diff-tree -p --pretty $b >$fnb
|
||||||
|
} err]} {
|
||||||
|
error_popup [mc "Error writing commit to file: %s" $err]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if {[catch {
|
||||||
|
set fd [open "| diff -U$diffcontext $fna $fnb" r]
|
||||||
|
} err]} {
|
||||||
|
error_popup [mc "Error diffing commits: %s" $err]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
set diffids [list commits $a $b]
|
||||||
|
set blobdifffd($diffids) $fd
|
||||||
|
set diffinhdr 0
|
||||||
|
filerun $fd [list getblobdiffline $fd $diffids]
|
||||||
|
}
|
||||||
|
|
||||||
proc diffvssel {dirn} {
|
proc diffvssel {dirn} {
|
||||||
global rowmenuid selectedline
|
global rowmenuid selectedline
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user