comparison mercurial/localrepo.py @ 18739:5b7175377bab stable 2.5.2

setparents: drop copies from dropped p2 (issue3843)
author Matt Mackall <mpm@selenic.com>
date Thu, 28 Feb 2013 21:29:31 -0600
parents 751135cca13c
children 70e2a22fd66e 1c8e0d6ac3b0
comparison
equal deleted inserted replaced
18730:a5d33446e46c 18739:5b7175377bab
703 '''get list of changectxs for parents of changeid''' 703 '''get list of changectxs for parents of changeid'''
704 return self[changeid].parents() 704 return self[changeid].parents()
705 705
706 def setparents(self, p1, p2=nullid): 706 def setparents(self, p1, p2=nullid):
707 copies = self.dirstate.setparents(p1, p2) 707 copies = self.dirstate.setparents(p1, p2)
708 pctx = self[p1]
708 if copies: 709 if copies:
709 # Adjust copy records, the dirstate cannot do it, it 710 # Adjust copy records, the dirstate cannot do it, it
710 # requires access to parents manifests. Preserve them 711 # requires access to parents manifests. Preserve them
711 # only for entries added to first parent. 712 # only for entries added to first parent.
712 pctx = self[p1]
713 for f in copies: 713 for f in copies:
714 if f not in pctx and copies[f] in pctx: 714 if f not in pctx and copies[f] in pctx:
715 self.dirstate.copy(copies[f], f) 715 self.dirstate.copy(copies[f], f)
716 if p2 == nullid:
717 for f, s in sorted(self.dirstate.copies().items()):
718 if f not in pctx and s not in pctx:
719 self.dirstate.copy(None, f)
716 720
717 def filectx(self, path, changeid=None, fileid=None): 721 def filectx(self, path, changeid=None, fileid=None):
718 """changeid can be a changeset revision, node, or tag. 722 """changeid can be a changeset revision, node, or tag.
719 fileid can be a file revision or node.""" 723 fileid can be a file revision or node."""
720 return context.filectx(self, path, changeid, fileid) 724 return context.filectx(self, path, changeid, fileid)