trydiff: transpose 'if opts.git or losedatafn' with 'if f[12]'
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 06 Feb 2015 16:09:43 -0800
changeset 24107 32e8d94b9473
parent 24106 9cf9432a505b
child 24111 11d72683f3de
trydiff: transpose 'if opts.git or losedatafn' with 'if f[12]' Perhaps it's more readable this way...
mercurial/patch.py
--- a/mercurial/patch.py	Thu Jan 22 23:29:00 2015 -0800
+++ b/mercurial/patch.py	Fri Feb 06 16:09:43 2015 -0800
@@ -1804,18 +1804,18 @@
             ctx1, modified, added, removed, copy, opts):
         content1 = None
         content2 = None
-        if f1:
-            content1 = getfilectx(f1, ctx1).data()
-        if f2:
-            content2 = getfilectx(f2, ctx2).data()
         flag1 = None
         flag2 = None
+        if f1:
+            content1 = getfilectx(f1, ctx1).data()
+            if opts.git or losedatafn:
+                flag1 = ctx1.flags(f1)
+        if f2:
+            content2 = getfilectx(f2, ctx2).data()
+            if opts.git or losedatafn:
+                flag2 = ctx2.flags(f2)
         binary = False
         if opts.git or losedatafn:
-            if f1:
-                flag1 = ctx1.flags(f1)
-            if f2:
-                flag2 = ctx2.flags(f2)
             binary = util.binary(content1) or util.binary(content2)
 
         if losedatafn and not opts.git: