diff -r a07be8953733 -r 70e2a22fd66e mercurial/localrepo.py --- a/mercurial/localrepo.py Thu Feb 28 21:58:37 2013 -0600 +++ b/mercurial/localrepo.py Fri Mar 01 10:05:37 2013 -0600 @@ -705,14 +705,18 @@ def setparents(self, p1, p2=nullid): copies = self.dirstate.setparents(p1, p2) + pctx = self[p1] if copies: # Adjust copy records, the dirstate cannot do it, it # requires access to parents manifests. Preserve them # only for entries added to first parent. - pctx = self[p1] for f in copies: if f not in pctx and copies[f] in pctx: self.dirstate.copy(copies[f], f) + if p2 == nullid: + for f, s in sorted(self.dirstate.copies().items()): + if f not in pctx and s not in pctx: + self.dirstate.copy(None, f) def filectx(self, path, changeid=None, fileid=None): """changeid can be a changeset revision, node, or tag.