# HG changeset patch # User Matt Mackall # Date 1362108571 21600 # Node ID 5b7175377babacce80a6c1e12366d8032a6d4340 # Parent a5d33446e46c11737c59106ba91fba88deabf3c3 setparents: drop copies from dropped p2 (issue3843) diff -r a5d33446e46c -r 5b7175377bab mercurial/localrepo.py --- 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. diff -r a5d33446e46c -r 5b7175377bab tests/test-issue1175.t --- a/tests/test-issue1175.t Thu Feb 28 13:55:00 2013 +0100 +++ b/tests/test-issue1175.t Thu Feb 28 21:29:31 2013 -0600 @@ -31,7 +31,7 @@ b b: searching for copy revision for a b: copy a:b80de5d138758541c5f05265ad144ab9fa86d1db - committed changeset 5:89e8e4be0de296fa3d6dd7825ccc44d7dc0f1f3b + committed changeset 5:732aafbecb501a198b3cc9323ad3899ff04ccf95 $ hg verify checking changesets @@ -44,8 +44,8 @@ # HG changeset patch # User test # Date 0 0 - # Node ID 89e8e4be0de296fa3d6dd7825ccc44d7dc0f1f3b - # Parent 7fc86ba705e717a721dbc361bf8c9bc05a18ca2f + # Node ID 732aafbecb501a198b3cc9323ad3899ff04ccf95 + # Parent 1d1625283f71954f21d14c3d44d0ad3c019c597f 5 diff --git a/b b/b diff -r a5d33446e46c -r 5b7175377bab tests/test-rebase-rename.t --- a/tests/test-rebase-rename.t Thu Feb 28 13:55:00 2013 +0100 +++ b/tests/test-rebase-rename.t Thu Feb 28 21:29:31 2013 -0600 @@ -12,20 +12,24 @@ $ hg init a $ cd a + $ mkdir d $ echo a > a $ hg ci -Am A adding a - $ echo b > b + $ echo b > d/b $ hg ci -Am B - adding b + adding d/b - $ hg mv b b-renamed + $ hg mv d d-renamed + moving d/b to d-renamed/b $ hg ci -m 'rename B' $ hg up -q -C 1 $ hg mv a a-renamed + $ echo x > d/x + $ hg add d/x $ hg ci -m 'rename A' created new head @@ -47,6 +51,12 @@ diff --git a/a b/a-renamed rename from a rename to a-renamed + diff --git a/d/x b/d/x + new file mode 100644 + --- /dev/null + +++ b/d/x + @@ -0,0 +1,1 @@ + +x Rebase the revision containing the rename: @@ -70,23 +80,29 @@ diff --git a/a b/a-renamed rename from a rename to a-renamed + diff --git a/d-renamed/x b/d-renamed/x + new file mode 100644 + --- /dev/null + +++ b/d-renamed/x + @@ -0,0 +1,1 @@ + +x Rebased revision does not contain information about b (issue3739) $ hg log -r 3 --debug - changeset: 3:3b905b1064f14ace3ad02353b79dd42d32981655 + changeset: 3:032a9b75e83bff1dcfb6cbfa4ef50a704bf1b569 tag: tip phase: draft - parent: 2:920a371a5635af23a26a011ca346cecd1cfcb942 + parent: 2:220d0626d185f372d9d8f69d9c73b0811d7725f7 parent: -1:0000000000000000000000000000000000000000 - manifest: 3:c4a62b2b64593c8fe0523d4c1ba2e243a8bd4dce + manifest: 3:035d66b27a1b06b2d12b46d41a39adb7a200c370 user: test date: Thu Jan 01 00:00:00 1970 +0000 - files+: a-renamed + files+: a-renamed d-renamed/x files-: a extra: branch=default - extra: rebase_source=89af05cb38a281f891c6f5581dd027092da29166 + extra: rebase_source=73a3ee40125d6f0f347082e5831ceccb3f005f8a description: rename A