changeset 42645:8c5a36805d5d stable

copies: fix crash on in changeset-centric tracing from commit to itself 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. Differential Revision: https://phab.mercurial-scm.org/D6675
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 22 Jul 2019 17:44:19 -0700
parents 0795bbe8ed19
children 92a99822e731
files mercurial/copies.py tests/test-copies.t
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Tue Jul 23 12:03:24 2019 +0530
+++ b/mercurial/copies.py	Mon Jul 22 17:44:19 2019 -0700
@@ -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()
--- a/tests/test-copies.t	Tue Jul 23 12:03:24 2019 +0530
+++ b/tests/test-copies.t	Mon Jul 22 17:44:19 2019 -0700
@@ -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