sapling/tests/test-commit-amend-reuse-rawfctx.t
Jun Wu e1e3cc79e7 filecommit: add a fast path to reuse raw revision data
Summary:
This is a resend of https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-May/097693.html,
with Yuya's comments addressed and some additional comments.

The original commit message is:

> The high-level idea is similar to metadataonlyctx.
> If filelog parents and metadata match, then raw revision data (rawtext,
> rawflags, hash) could be reused. This saves time calculating hash or going
> through flag processors.

Note in the original patch, the amend operation is not using the fast path.
But it uses the fast path today. That's because singhsrb's D636 change
(cmdutil: remove the redundant commit during amend):

```
                    # If the file being considered is not amongst the files
                    # to be amended, we should return the file context from the
                    # old changeset. This avoids issues when only some files in
                    # the working copy are being amended but there are also
                    # changes to other files from the old changeset.
                    if path not in filestoamend:
                        return old.filectx(path)
```

Reviewed By: DurhamG

Differential Revision: D8986780

fbshipit-source-id: 7d18957a713f90eafb786446972020f7939c3671
2018-07-27 20:06:07 -07:00

41 lines
988 B
Perl

$ enable obsstore
File node could be reused during commit --amend
$ newrepo
$ echo 1 > a
$ echo 2 > b
$ hg commit -m 12 -A a b
$ echo 3 >> a
$ hg commit -m 3
$ hg commit --debug --amend -m 'without content change'
amending changeset 0bd823dca296
copying changeset 0bd823dca296 to dd3d87f356df
committing files:
a
reusing a filelog node (exact match)
committing manifest
committing changelog
updating the branch cache
invalid branchheads cache (served): tip differs
committed changeset 2:92bc7a9d76f010337ece134e095054c094d44760
#if execbit
File node is reused for mode-only change
$ chmod +x b
$ hg ci --debug --amend -m 'without content change'
amending changeset 92bc7a9d76f0
committing files:
a
reusing a filelog node (exact match)
b
committing manifest
committing changelog
updating the branch cache
invalid branchheads cache (served): tip differs
committed changeset 3:ba954a28eb454eb63e7348349f8e87e7b1be3601
#endif