Mercurial > hg
comparison mercurial/context.py @ 23401:fd1bab28a8cc stable
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 "<old-a>a", then the value of c would be
updated as "<old-b>a'. With the current dictionary sharing this ends up with:
'<new-c>' == '<old-a>aa'
This value is double-wrong as we should use '<old-b>' 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.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 26 Nov 2014 14:54:16 -0800 |
parents | 692bde7f486d |
children | 2963d5c9d90b |
comparison
equal
deleted
inserted
replaced
23400:3bd577a3283e | 23401:fd1bab28a8cc |
---|---|
1061 | 1061 |
1062 @propertycache | 1062 @propertycache |
1063 def _manifest(self): | 1063 def _manifest(self): |
1064 """generate a manifest corresponding to the values in self._status""" | 1064 """generate a manifest corresponding to the values in self._status""" |
1065 | 1065 |
1066 man = self._parents[0].manifest().copy() | 1066 man1 = self._parents[0].manifest() |
1067 man = man1.copy() | |
1067 if len(self._parents) > 1: | 1068 if len(self._parents) > 1: |
1068 man2 = self.p2().manifest() | 1069 man2 = self.p2().manifest() |
1069 def getman(f): | 1070 def getman(f): |
1070 if f in man: | 1071 if f in man1: |
1071 return man | 1072 return man1 |
1072 return man2 | 1073 return man2 |
1073 else: | 1074 else: |
1074 getman = lambda f: man | 1075 getman = lambda f: man1 |
1075 | 1076 |
1076 copied = self._repo.dirstate.copies() | 1077 copied = self._repo.dirstate.copies() |
1077 ff = self._flagfunc | 1078 ff = self._flagfunc |
1078 for i, l in (("a", self._status.added), ("m", self._status.modified)): | 1079 for i, l in (("a", self._status.added), ("m", self._status.modified)): |
1079 for f in l: | 1080 for f in l: |