[PATCH 7 of 7] trydiff: transpose 'if opts.git or losedatafn' with 'if f[12]'

Martin von Zweigbergk martinvonz at google.com
Fri Feb 6 19:13:36 CST 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1423267783 28800
#      Fri Feb 06 16:09:43 2015 -0800
# Node ID f2115c93df5a61d84cc71028fdb9abfa5b72b2ef
# Parent  889cc5e8b38f2d4390e64acc488403081fa261a9
trydiff: transpose 'if opts.git or losedatafn' with 'if f[12]'

Perhaps it's more readable this way...

diff -r 889cc5e8b38f -r f2115c93df5a 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
+        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()
-        flag1 = None
-        flag2 = None
+            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:


More information about the Mercurial-devel mailing list