spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  When we're recreating the commit that we'll be committing, we don't want to
  filter our copy information based on just the *new* [versions of the] files
  we're amending. The test has an example of this case, but for clarity, the
  situation is:
  
    $ hg cp src dst && hg commit
    <do some work>
    $ hg amend some_unrelated_file.txt
    $ hg status --copies
    A dst
    A some_unrelated_file.txt
  
  What *should* happen is that `dst` should remain marked as a copy of `src`, 
but
  this did not previously happen. `matcher` here only includes the files that 
were
  specified on the commandline, so it only gets the copy information (if any, in
  this example there's not) for `some_unrelated_file.txt`. When it goes to apply
  the memctx to actually create the commit, the file copy information is
  incomplete and loses the information for the files that shouldn't have been
  affected at all by the amend.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-amend.t

CHANGE DETAILS

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -625,4 +625,4 @@
   $ hg status --change . --copies
   A new_file_amend_me
   A r0_copied
-    r0 (missing-correct-output !)
+    r0
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2914,9 +2914,9 @@
         # filectxs from the old commit.
         if changes or changeset_copies:
             # Recompute copies (avoid recording a -> b -> a)
-            copied = copies.pathcopies(base, wctx, matcher)
-            if old.p2:
-                copied.update(copies.pathcopies(old.p2(), wctx, matcher))
+            copied = copies.pathcopies(base, wctx)
+            if old.p2():
+                copied.update(copies.pathcopies(old.p2(), wctx))
 
             # Prune files which were reverted by the updates: if old
             # introduced file X and the file was renamed in the working



To: spectral, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to