From patchwork Tue Jul 23 04:15:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D6675: copies: fix crash on in changeset-centric tracing from commit to itself From: phabricator X-Patchwork-Id: 41012 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 23 Jul 2019 04:15:58 +0000 martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY When we trace copies from a changeset to itself, the "work" queue ends up empty and we hit the "assert False" after it. It was only the last of the three added tests that failed before this patch. That is because the other two cases have fast paths, so _committedforwardcopies() is never reached. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6675 AFFECTED FILES mercurial/copies.py tests/test-copies.t CHANGE DETAILS To: martinvonz, #hg-reviewers Cc: mercurial-devel diff --git a/tests/test-copies.t b/tests/test-copies.t --- a/tests/test-copies.t +++ b/tests/test-copies.t @@ -58,6 +58,17 @@ x -> y $ hg debugpathcopies 1 0 y +Copies not including commit changes + $ newrepo + $ echo x > x + $ hg ci -Aqm 'add x' + $ hg mv x y + $ hg debugpathcopies . . + $ hg debugpathcopies . 'wdir()' + x -> y + $ hg debugpathcopies 'wdir()' . + y -> x + Copy a file onto another file $ newrepo $ echo x > x diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -246,7 +246,7 @@ return cm def _changesetforwardcopies(a, b, match): - if a.rev() == node.nullrev: + if a.rev() in (node.nullrev, b.rev()): return {} repo = a.repo()