Patchwork D6675: copies: fix crash on in changeset-centric tracing from commit to itself

login
register
mail settings
Submitter phabricator
Date July 24, 2019, 9:27 a.m.
Message ID <91bda1b4e813269789e6c541b1d22141@localhost.localdomain>
Download mbox | patch
Permalink /patch/41031/
State Not Applicable
Headers show

Comments

phabricator - July 24, 2019, 9:27 a.m.
Closed by commit rHG8c5a36805d5d: copies: fix crash on in changeset-centric tracing from commit to itself (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6675?vs=16007&id=16027

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6675/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6675

AFFECTED FILES
  mercurial/copies.py
  tests/test-copies.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

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()