changeset 24058:d1fcff9400c9

trydiff: call util.binary in only one place It's practically free to call util.binary on empty or None content. By relying on that, we can replace the current four call sites by one.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Jan 2015 22:22:09 -0800
parents 696d0fd77d94
children 8d295ce6e488
files mercurial/patch.py
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Jan 22 21:35:57 2015 -0800
+++ b/mercurial/patch.py	Thu Jan 22 22:22:09 2015 -0800
@@ -1796,7 +1796,6 @@
                         else:
                             copyop = 'copy'
                         content1 = getfilectx(f1, ctx1).data()
-                binary = util.binary(content1) or util.binary(content2)
             elif f in removedset:
                 if opts.git:
                     # have we already reported a copy above?
@@ -1805,13 +1804,11 @@
                         continue
                     else:
                         flag1 = ctx1.flags(f)
-                        binary = util.binary(content1)
-                else:
-                    binary = util.binary(content1)
             else:
                 flag1 = ctx1.flags(f)
                 flag2 = ctx2.flags(f)
-                binary = util.binary(content1) or util.binary(content2)
+
+            binary = util.binary(content1) or util.binary(content2)
 
         if losedatafn and not opts.git:
             if (binary or