# HG changeset patch # User Pierre-Yves David # Date 1417042456 28800 # Node ID fd1bab28a8cc0b5e235cceb1fa0c8e6d0e47e853 # Parent 3bd577a3283ee09cc0bfcedbec4e5ca241c837f7 manifest: fix a bug where working copy file 'add' mark was buggy Because the same dictionary was used to (1) get node from parent and (2) store annotated version, we could end up with buggy values. For example with a chain of renames: $ hg mv b c $ hg mv a b The value from 'b' would be updated as "a", then the value of c would be updated as "a'. With the current dictionary sharing this ends up with: '' == 'aa' This value is double-wrong as we should use '' and a single 'a'. We now use a read-only value for lookup. The 'test-rename.t' test is impacted because such a chained added file is suddenly detected as such. diff -r 3bd577a3283e -r fd1bab28a8cc mercurial/context.py --- a/mercurial/context.py Wed Nov 26 17:22:09 2014 +0300 +++ b/mercurial/context.py Wed Nov 26 14:54:16 2014 -0800 @@ -1063,15 +1063,16 @@ def _manifest(self): """generate a manifest corresponding to the values in self._status""" - man = self._parents[0].manifest().copy() + man1 = self._parents[0].manifest() + man = man1.copy() if len(self._parents) > 1: man2 = self.p2().manifest() def getman(f): - if f in man: - return man + if f in man1: + return man1 return man2 else: - getman = lambda f: man + getman = lambda f: man1 copied = self._repo.dirstate.copies() ff = self._flagfunc diff -r 3bd577a3283e -r fd1bab28a8cc tests/test-rename.t --- a/tests/test-rename.t Wed Nov 26 17:22:09 2014 +0300 +++ b/tests/test-rename.t Wed Nov 26 14:54:16 2014 -0800 @@ -584,7 +584,8 @@ copy from d1/a copy to d1/c $ hg update -C - 2 files updated, 0 files merged, 1 files removed, 0 files unresolved + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ rm d1/c # The file was marked as added, so 'hg update' action was 'forget' check illegal path components