diff mercurial/mdiff.py @ 396:8f8bb77d560e

Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli. Changes from the original patch: - - Use 'diff -r ...' instead of 'hg diff -r ...' to support filetype detection by at least file(1) and vim. - - Adjusted tests for this change. - - Some cleanups. manifest hash: 5f37d1ef75ea7f4e48b53f02371053ba54fb70f8 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCsyZzW7P1GVgWeRoRAqczAJ479lR9Z289sP+VH5L+N7pQRU14SACfUueq 88ABloIR3VyRIa4qbujnZio= =Vva9 -----END PGP SIGNATURE-----
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 17 Jun 2005 20:37:23 +0100
parents 88268aa2b8d2
children 3b9e3d3d2810
line wrap: on
line diff
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -8,7 +8,8 @@
 import difflib, struct
 from mercurial.mpatch import *
 
-def unidiff(a, ad, b, bd, fn):
+def unidiff(a, ad, b, bd, fn, r=None):
+
     if not a and not b: return ""
 
     if a == None:
@@ -36,6 +37,10 @@ def unidiff(a, ad, b, bd, fn):
         if l[ln][-1] != '\n':
             l[ln] += "\n\ No newline at end of file\n"
 
+    if r:
+        l.insert(0, "diff %s %s\n" %
+                    (' '.join(["-r %s" % rev for rev in r]), fn))
+
     return "".join(l)
 
 def textdiff(a, b):