mercurial/localrepo.py
branchstable
changeset 18739 5b7175377bab
parent 18520 751135cca13c
child 18743 70e2a22fd66e
child 18757 1c8e0d6ac3b0
--- a/mercurial/localrepo.py	Thu Feb 28 13:55:00 2013 +0100
+++ b/mercurial/localrepo.py	Thu Feb 28 21:29:31 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.