Commit Graph

4 Commits

Author SHA1 Message Date
Ryan McElroy
9e51fdef40 context: fix sanity check in metadataonlyctx
Summary:
Previously, this check was subtly wrong, causing it to fail for empty
commits (which have the same manifest as their parents). Update the check to
ensure the actual thing we want to ensure -- that the caller isn't creating
incorrect commits.

The failure would happen in this case:

```
  B  empty commit (manifest Am)
  |
  A  draft commit (manifest Am)
 /
M  master (manifest Mm)
```

When metaediting `A`, `metaedit` would then "rebase" `B` onto `A'` to create
`B'`, with both `A'` and `B'` reusing `Am` as their manifest. The old check
would fail here because the parent of `Am` is `Mm`, but the manifest of `A'`
(the parent of `B'`) is `Am`, so when checking the manifest of the parent
against the parent of the manifest, we would find that `Am != Mm` and fail.

The actual check we wanted was that the manifest of the parent of `B'` is the
same as the manifest of the parent of `B` -- which the old check approximated
as long as no manifests were reused in the stack. As this is not sufficient
with empty commits, we instead want to check that the manifest of the old
parent matches the manifest of the new parent, which we now do.

By avoid reading `manifest.parents`, this would also avoid some lazy tree
fetches, therefore speed up metaedit in certain cases.

Reviewed By: quark-zju

Differential Revision: D9013995

fbshipit-source-id: 4d0b05fc9bb81d115cd87ba2bf98aa253ae6f88b
2018-07-27 02:49:19 -07:00
Ryan McElroy
2b7e9e5e8b context: show how metaedit can crash with empty rebased commits
Reviewed By: quark-zju

Differential Revision: D9013996

fbshipit-source-id: f5d1cfc687981e07e51ef58f07fac17602c6233d
2018-07-27 02:49:19 -07:00
Jun Wu
ada59ccd75 check-code: forbid "\S" in egrep regular expression
BSD `egrep` does not like it. So let's forbid it.

Differential Revision: https://phab.mercurial-scm.org/D610
2017-09-01 16:44:30 -07:00
Jun Wu
3f18e3a17c metadataonlyctx: don't crash when reusing the manifest with deletions
This was originally fixed by Mateusz Kwapich for the `metaedit` command in
fb-hgext with a test for the `metaedit` command. It didn't get upstreamed
because `metaedit` was not in core.

This patch fixes the crash and adds a test about `metadataonlyctx` to
avoid future regressions.

Differential Revision: https://phab.mercurial-scm.org/D550
2017-08-28 16:58:59 -07:00