[PATCH inline-doc V2] manifest: document the extra letter in working copy manifest node
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu Nov 27 01:20:04 UTC 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1417045021 28800
# Wed Nov 26 15:37:01 2014 -0800
# Node ID 02ad837bfdf82dffdcab978872ba1e3f20b866d0
# Parent 9da5a7413eb8bc3e708eee62bc38342c8ff7f917
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.
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1033,11 +1033,17 @@ class committablectx(basectx):
def _flagfunc(self):
return self._repo.dirstate.flagfunc(self._buildflagfunc)
@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.
+ """
man = self._parents[0].manifest().copy()
if len(self._parents) > 1:
man2 = self.p2().manifest()
def getman(f):
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -455,11 +455,14 @@ def manifestmerge(repo, wctx, p2, pa, br
if n1 != ma[f]:
if acceptremote:
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"))
elif n2 and f in movewithdir:
f2 = movewithdir[f]
More information about the Mercurial-devel
mailing list