comparison mercurial/localrepo.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 63c817ea4a70
children 3f85cef66dcc 2950d186a927
comparison
equal deleted inserted replaced
16550:0d494a38c586 16551:ebf6d38c9063
630 return self[changeid] 630 return self[changeid]
631 631
632 def parents(self, changeid=None): 632 def parents(self, changeid=None):
633 '''get list of changectxs for parents of changeid''' 633 '''get list of changectxs for parents of changeid'''
634 return self[changeid].parents() 634 return self[changeid].parents()
635
636 def setparents(self, p1, p2=nullid):
637 copies = self.dirstate.setparents(p1, p2)
638 if copies:
639 # Adjust copy records, the dirstate cannot do it, it
640 # requires access to parents manifests. Preserve them
641 # only for entries added to first parent.
642 pctx = self[p1]
643 for f in copies:
644 if f not in pctx and copies[f] in pctx:
645 self.dirstate.copy(copies[f], f)
635 646
636 def filectx(self, path, changeid=None, fileid=None): 647 def filectx(self, path, changeid=None, fileid=None):
637 """changeid can be a changeset revision, node, or tag. 648 """changeid can be a changeset revision, node, or tag.
638 fileid can be a file revision or node.""" 649 fileid can be a file revision or node."""
639 return context.filectx(self, path, changeid, fileid) 650 return context.filectx(self, path, changeid, fileid)