Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dirstate.py @ 16551:ebf6d38c9063 stable
localrepo: add setparents() to adjust dirstate copies (issue3407)
The fix introduced in eab9119c5dee was only partially successful. It is correct
to turn dirstate 'm' merge records into normal/dirty ones but copy records are
lost in the process. To adjust them as well, we need to look in the first
parent manifest to know which files were added and preserve only related
records. But the dirstate does not have access to changesets, the logic has to
moved at another level, in localrepo.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sun, 29 Apr 2012 22:25:55 +0200 |
parents | e596a631210e |
children | 525fdb738975 |
line wrap: on
line diff
--- a/mercurial/dirstate.py Sun Apr 29 16:18:46 2012 +0200 +++ b/mercurial/dirstate.py Sun Apr 29 22:25:55 2012 +0200 @@ -237,14 +237,26 @@ return encoding.tolocal(self._branch) def setparents(self, p1, p2=nullid): + """Set dirstate parents to p1 and p2. + + When moving from two parents to one, 'm' merged entries a + adjusted to normal and previous copy records discarded and + returned by the call. + + See localrepo.setparents() + """ self._dirty = self._dirtypl = True oldp2 = self._pl[1] self._pl = p1, p2 + copies = {} if oldp2 != nullid and p2 == nullid: # Discard 'm' markers when moving away from a merge state for f, s in self._map.iteritems(): if s[0] == 'm': + if f in self._copymap: + copies[f] = self._copymap[f] self.normallookup(f) + return copies def setbranch(self, branch): if branch in ['tip', '.', 'null']: