[PATCH 3 of 4] manifest: transpose pair of pairs from diff()

Martin von Zweigbergk martinvonz at gmail.com
Wed Oct 15 02:02:48 CDT 2014


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at gmail.com>
# Date 1413353887 25200
#      Tue Oct 14 23:18:07 2014 -0700
# Node ID d57d01770688805015bbf991c43b9faf37396d61
# Parent  ddddc4ac16f6eedd5ecfab736f81e413e7163c70
manifest: transpose pair of pairs from diff()

It makes more sense for the file nodeids and returned from diff() to
be ((n1,fl1),(n2,fl2)) than ((n1,n2),(fl1,fl2)), so change it to the
former.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -41,7 +41,7 @@
     def diff(self, m2):
         '''Finds changes between the current manifest and m2. The result is
         returned as a dict with filename as key and values of the form
-        ((n1,n2),(fl1,fl2)), where n1/n2 is the nodeid in the current/other
+        ((n1,fl1),(n2,fl2)), where n1/n2 is the nodeid in the current/other
         manifest and fl1/fl2 is the flag in the current/other manifest. Where
         the file does not exist, the nodeid will be None and the flags will be
         the empty string.'''
@@ -54,12 +54,12 @@
             if n2 is None:
                 fl2 = ''
             if n1 != n2 or fl1 != fl2:
-                diff[fn] = ((n1, n2), (fl1, fl2))
+                diff[fn] = ((n1, fl1), (n2, fl2))
 
         for fn, n2 in m2.iteritems():
             if fn not in self:
                 fl2 = m2._flags.get(fn, '')
-                diff[fn] = ((None, n2), ('', fl2))
+                diff[fn] = ((None, ''), (n2, fl2))
 
         return diff
 
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -424,7 +424,7 @@
     # Compare manifests
     diff = m1.diff(m2)
 
-    for f, ((n1, n2), (fl1, fl2)) in diff.iteritems():
+    for f, ((n1, fl1), (n2, fl2)) in diff.iteritems():
         if partial and not partial(f):
             continue
         if n1 and n2:


More information about the Mercurial-devel mailing list