File tkdiff-4.1.4-git.patch of Package tkdiff
--- tkdiff.orig 2007-11-15 00:52:48.000000000 -0600
+++ tkdiff 2011-07-21 10:14:03.222156059 -0500
@@ -738,6 +738,7 @@ proc get-file-rev {f index {r ""}} {
set acopt ""
set cvsopt ""
set svnopt ""
+ set gitopt ""
set rcsopt ""
set sccsopt ""
set bkopt ""
@@ -749,6 +750,7 @@ proc get-file-rev {f index {r ""}} {
set acopt "-v \"$r\""
set cvsopt "-r $r"
set svnopt "-r $r"
+ set gitopt "$r:"
set rcsopt "$r"
set sccsopt "-r$r"
set bkopt "-r$r"
@@ -765,6 +767,10 @@ proc get-file-rev {f index {r ""}} {
regsub -all {\$} $f {\$} f
set dirname [file dirname $f]
set tailname [file tail $f]
+ set cmdext ""
+ if {$::tcl_platform(platform) == "windows"} {
+ set cmdext ".exe"
+ }
debug-info " $f"
# For CVS, if it isn't checked out there is neither a CVS nor RCS
@@ -795,6 +801,19 @@ proc get-file-rev {f index {r ""}} {
debug-info " Setting lbl $finfo(lbl,$index)"
die-unless "exec $cmd cat $svnopt \"$f\"" $finfo(pth,$index)
}
+ } elseif {"[exec git$cmdext rev-parse --is-inside-work-tree]" == "true"} {
+ set cmd "git$cmdext"
+ set prefix [exec git rev-parse --show-prefix]
+ if {"$r" == "" || "$rev" == "rBASE"} {
+ set finfo(lbl,$index) "$f (SVN BASE)"
+ debug-info " Setting lbl $finfo(lbl,$index)"
+ die-unless "exec $cmd show \":$prefix$f\"" \
+ $finfo(pth,$index)
+ } else {
+ set finfo(lbl,$index) "$f (SVN $rev)"
+ debug-info " Setting lbl $finfo(lbl,$index)"
+ die-unless "exec $cmd show \"$gitopt$prefix$f\"" $finfo(pth,$index)
+ }
} elseif {[regexp {://} $f]} {
# Subversion command can have the form
# svn diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]
@@ -6105,8 +6124,8 @@ proc do-usage {mode} {
Plain file with conflict markers:
tkdiff -conflict FILE
- Source control (AccuRev, BitKeeper, CVS, Subversion, Perforce, PVCS,
- RCS, SCCS, ClearCase)
+ Source control (AccuRev, BitKeeper, CVS, Subversion, Git, Perforce,
+ PVCS, RCS, SCCS, ClearCase)
tkdiff FILE
tkdiff -rREV FILE
tkdiff -rREV1 -rREV2 FILE
@@ -6125,7 +6144,9 @@ $g(name) detects and supports RCS, CVS,
directory with the same name. It detects and supports PVCS by looking \
for a vcs.cfg file. It detects and supports AccuRev, Perforce and \
ClearCase by looking for the environment variables named ACCUREV_BIN, \
- P4CLIENT, and CLEARCASE_ROOT respectively.
+ P4CLIENT, and CLEARCASE_ROOT respectively. It detects Git by using \
+ "git rev-parse --is-inside-work-tree" and will only work if the current \
+ directory is in a git work tree.
In the first form, tkdiff will present a dialog to allow you to choose the \
files to diff interactively. At present this dialog only supports a \
@@ -6139,17 +6160,26 @@ In the second form, at least one of the
In the remaining forms, <cmp>REV</cmp> (or <cmp>REV1</cmp> and \
<cmp>REV2</cmp>) must be a valid revision number for <cmp>FILE</cmp>. \
- Where AccuRev, RCS, CVS, Subversion, SCCS, PVCS or Perforce is implied \
+ Where AccuRev, RCS, CVS, Subversion, Git, SCCS, PVCS or Perforce is implied \
but no revision number is specified, <cmp>FILE</cmp> is compared with \
the the revision most recently checked in.
+Git <cmp>REV</cmp> (see man git-rev-parse):
+ -r <cmp>FILE</cmp> [compare with <cmp>HEAD</cmp>]
+ -r <cmp>HEAD</cmp> <cmp>FILE</cmp> [compare with <cmp>HEAD</cmp>]
+ -r <cmp>HEAD^</cmp> <cmp>FILE</cmp> [compare with parent of <cmp>HEAD</cmp>]
+ -r <cmp>HEAD~5</cmp> <cmp>FILE</cmp> [compare with 5th parent of <cmp>HEAD</cmp>]
+ -r <cmp>HEAD~20</cmp> -r <cmp>HEAD^</cmp> <cmp>FILE</cmp> [compare 20th parent and parent of <cmp>HEAD</cmp>]
+ -r 29329e <cmp>FILE</cmp> [compare with commit 29329e (full/partial SHA1)]
+ -r v1.2.3 <cmp>FILE</cmp> [compare with tag (UNTESTED)]
+
To merge a file with conflict markers generated by "<cmp>merge</cmp>", \
"<cmp>cvs</cmp>", or "<cmp>vmrg</cmp>", use \
"<cmp>tkdiff -conflict FILE</cmp>". The file is split into two temporary \
files which you can merge as usual (see below).
For "<cmp>tkdiff FILE</cmp>" The CVS version has priority, followed by the \
- Subversion version, followed by the SCCS version -- i.e. if a CVS \
+ Subversion version, followed by the Git version, followed by the SCCS version -- i.e. if a CVS \
directory is present, CVS; if not and a Subversion directory is \
present, Subversion; if not and an SCCS directory is present, SCCS is \
assumed; otherwise, if a CVS.CFG file is found, PVCS is assumed; \