Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 48864:df68d64b0d50 stable
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
<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.
Differential Revision: https://phab.mercurial-scm.org/D12625
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Wed, 11 May 2022 17:56:29 -0700 |
parents | 770e1352e9f9 |
children | c577d394ed6b |
comparison
equal
deleted
inserted
replaced
48863:dc342071297f | 48864:df68d64b0d50 |
---|---|
2913 # If there are changes to amend or if copy information needs to be read | 2913 # If there are changes to amend or if copy information needs to be read |
2914 # from the changeset extras, we cannot take the fast path of using | 2914 # from the changeset extras, we cannot take the fast path of using |
2915 # filectxs from the old commit. | 2915 # filectxs from the old commit. |
2916 if changes or changeset_copies: | 2916 if changes or changeset_copies: |
2917 # Recompute copies (avoid recording a -> b -> a) | 2917 # Recompute copies (avoid recording a -> b -> a) |
2918 copied = copies.pathcopies(base, wctx, matcher) | 2918 copied = copies.pathcopies(base, wctx) |
2919 if old.p2: | 2919 if old.p2(): |
2920 copied.update(copies.pathcopies(old.p2(), wctx, matcher)) | 2920 copied.update(copies.pathcopies(old.p2(), wctx)) |
2921 | 2921 |
2922 # Prune files which were reverted by the updates: if old | 2922 # Prune files which were reverted by the updates: if old |
2923 # introduced file X and the file was renamed in the working | 2923 # introduced file X and the file was renamed in the working |
2924 # copy, then those two files are the same and | 2924 # copy, then those two files are the same and |
2925 # we can discard X from our list of files. Likewise if X | 2925 # we can discard X from our list of files. Likewise if X |