Merge updated git-gui and gitk that call each other

Merge git://repo.or.cz/git-gui and git://git.kernel.org/pub/scm/gitk/gitk

    * git://repo.or.cz/git-gui:
      git-gui: Show special diffs for complex conflict cases.
      git-gui: Make F5 reselect a diff, if an untracked file is selected.
      git-gui: Reimplement and enhance auto-selection of diffs.
      git-gui: Support conflict states _U & UT.
      git-gui: Support more merge tools.
      git-gui: Don't allow staging files with conflicts.
      git-gui: Support calling merge tools.
      git-gui: Support resolving conflicts via the diff context menu.
      git-gui: Mark forgotten strings for translation.
      git-gui: Allow specifying an initial line for git gui blame.
      git-gui: Better positioning in Blame Parent Commit
      git-gui: Support passing blame to a parent commit.
      git-gui: Support starting gitk from Gui Blame
      git-gui: Teach git gui about file type changes

    * git://git.kernel.org/pub/scm/gitk/gitk:
      gitk: Add menu item for calling git gui blame
      gitk: Add option to specify the default commit on command line
This commit is contained in:
Junio C Hamano
2008-09-06 18:06:39 -07:00
9 changed files with 942 additions and 119 deletions

View File

@ -418,10 +418,12 @@ proc stop_rev_list {view} {
}
proc reset_pending_select {selid} {
global pending_select mainheadid
global pending_select mainheadid selectheadid
if {$selid ne {}} {
set pending_select $selid
} elseif {$selectheadid ne {}} {
set pending_select $selectheadid
} else {
set pending_select $mainheadid
}
@ -1609,6 +1611,7 @@ proc getcommit {id} {
proc readrefs {} {
global tagids idtags headids idheads tagobjid
global otherrefids idotherrefs mainhead mainheadid
global selecthead selectheadid
foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
catch {unset $v}
@ -1655,6 +1658,12 @@ proc readrefs {} {
set mainhead [string range $thehead 11 end]
}
}
set selectheadid {}
if {$selecthead ne {}} {
catch {
set selectheadid [exec git rev-parse --verify $selecthead]
}
}
}
# skip over fake commits
@ -2205,6 +2214,8 @@ proc makewindow {} {
-command {flist_hl 1}
$flist_menu add command -label [mc "External diff"] \
-command {external_diff}
$flist_menu add command -label [mc "Blame parent commit"] \
-command {external_blame 1}
}
# Windows sends all mouse wheel events to the current focused window, not
@ -3012,6 +3023,27 @@ proc external_diff {} {
}
}
proc external_blame {parent_idx} {
global flist_menu_file
global nullid nullid2
global parentlist selectedline currentid
if {$parent_idx > 0} {
set base_commit [lindex $parentlist $selectedline [expr {$parent_idx-1}]]
} else {
set base_commit $currentid
}
if {$base_commit eq {} || $base_commit eq $nullid || $base_commit eq $nullid2} {
error_popup [mc "No such commit"]
return
}
if {[catch {exec git gui blame $base_commit $flist_menu_file &} err]} {
error_popup [mc "git gui blame: command failed: $err"]
}
}
# delete $dir when we see eof on $f (presumably because the child has exited)
proc delete_at_eof {f dir} {
while {[gets $f line] >= 0} {}
@ -9865,6 +9897,9 @@ if {![file isdirectory $gitdir]} {
exit 1
}
set selecthead {}
set selectheadid {}
set revtreeargs {}
set cmdline_files {}
set i 0
@ -9876,6 +9911,9 @@ foreach arg $argv {
set cmdline_files [lrange $argv [expr {$i + 1}] end]
break
}
"--select-commit=*" {
set selecthead [string range $arg 16 end]
}
"--argscmd=*" {
set revtreeargscmd [string range $arg 10 end]
}
@ -9886,6 +9924,10 @@ foreach arg $argv {
incr i
}
if {$selecthead eq "HEAD"} {
set selecthead {}
}
if {$i >= [llength $argv] && $revtreeargs ne {}} {
# no -- on command line, but some arguments (other than --argscmd)
if {[catch {