[PATCH] patch: introduce nobinary diff option

Steve Borho steve at borho.org
Sat May 23 19:06:12 CDT 2009


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1243123549 18000
# Node ID 8b3f9cc17b8249fd01600a1b2997f031c89c8c21
# Parent  5726bb290bfe882f996e8b79cd32fe62e3d14339
patch: introduce nobinary diff option

specifying diff options (git=True, nobinary=True) allows a user to query the
detailed header info of git diffs (copies, renames, permissions) but avoid the
overhead of generating and storing large base85 diffs.  Mostly intended for
GUI tools

diff -r 5726bb290bfe -r 8b3f9cc17b82 mercurial/mdiff.py
--- a/mercurial/mdiff.py	Sat May 23 11:53:23 2009 -0500
+++ b/mercurial/mdiff.py	Sat May 23 19:05:49 2009 -0500
@@ -34,6 +34,7 @@
         'text': False,
         'showfunc': False,
         'git': False,
+        'nobinary': False,
         'nodates': False,
         'ignorews': False,
         'ignorewsamount': False,
diff -r 5726bb290bfe -r 8b3f9cc17b82 mercurial/patch.py
--- a/mercurial/patch.py	Sat May 23 11:53:23 2009 -0500
+++ b/mercurial/patch.py	Sat May 23 19:05:49 2009 -0500
@@ -1021,6 +1021,7 @@
     return mdiff.diffopts(
         text=opts.get('text'),
         git=get('git'),
+        nobinary=get('nobinary'),
         nodates=get('nodates'),
         showfunc=get('show_function', 'showfunc'),
         ignorews=get('ignore_all_space', 'ignorews'),
@@ -1287,7 +1288,7 @@
             r = None
             header.insert(0, mdiff.diffline(r, a, b, opts))
         if dodiff:
-            if dodiff == 'binary':
+            if dodiff == 'binary' and not opts.nobinary:
                 text = b85diff(to, tn)
             else:
                 text = mdiff.unidiff(to, date1,


More information about the Mercurial-devel mailing list