# HG changeset patch # User Kyle Lippincott # Date 1652316989 25200 # Node ID df68d64b0d506966635f55757ae5b395931a2a83 # Parent dc342071297f63e4d6710d992e68a265edd3f08a amend: stop specifying matcher, get all copies in wctx 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 $ 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. Differential Revision: https://phab.mercurial-scm.org/D12625 diff -r dc342071297f -r df68d64b0d50 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Wed May 11 17:56:10 2022 -0700 +++ b/mercurial/cmdutil.py Wed May 11 17:56:29 2022 -0700 @@ -2915,9 +2915,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 diff -r dc342071297f -r df68d64b0d50 tests/test-amend.t --- a/tests/test-amend.t Wed May 11 17:56:10 2022 -0700 +++ b/tests/test-amend.t Wed May 11 17:56:29 2022 -0700 @@ -625,4 +625,4 @@ $ hg status --change . --copies A new_file_amend_me A r0_copied - r0 (missing-correct-output !) + r0