manifest: document the extra letter in working copy manifest node
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 26 Nov 2014 15:37:01 -0800
changeset 23410 cd9e5e57064d
parent 23408 36dcd3db70ab
child 23411 2d86f4e38c08
manifest: document the extra letter in working copy manifest node As the second developer to get confused by this in November, I'm adding some documentation for the next poor soul.
mercurial/context.py
mercurial/merge.py
--- a/mercurial/context.py	Sun Nov 30 20:06:53 2014 +0100
+++ b/mercurial/context.py	Wed Nov 26 15:37:01 2014 -0800
@@ -1035,7 +1035,13 @@
 
     @propertycache
     def _manifest(self):
-        """generate a manifest corresponding to the values in self._status"""
+        """generate a manifest corresponding to the values in self._status
+
+        This reuse the file nodeid from parent, but we append an extra letter
+        when modified.  Modified files get an extra 'm' while added files get
+        appened an extra 'a'. This is used by manifests merge to see that files
+        are different and by update logic to avoid deleting newly added files.
+        """
 
         man1 = self._parents[0].manifest()
         man = man1.copy()
--- a/mercurial/merge.py	Sun Nov 30 20:06:53 2014 +0100
+++ b/mercurial/merge.py	Wed Nov 26 15:37:01 2014 -0800
@@ -457,7 +457,10 @@
                     actions['r'].append((f, None, "remote delete"))
                 else:
                     actions['cd'].append((f, None, "prompt changed/deleted"))
-            elif n1[20:] == 'a': # added, no remote
+            elif n1[20:] == 'a':
+                # This extra 'a' is added by working copy manifest to mark the
+                # file as locally added. We should forget it instead of
+                # deleting it.
                 actions['f'].append((f, None, "remote deleted"))
             else:
                 actions['r'].append((f, None, "other deleted"))