fbamend: make inhibit hook fire after rebase
Summary:
Recently @rmcelroy discovered that attempting to rebase a single commit in the middle of a stack results in the rest of the stack being marked as unstable. See https://fb.facebook.com/groups/sourcecontrol/permalink/1207767375939547/ for full example.
It turns out that the inhibit extension's post-transaction hook that would ordinarily inhibit the rebased (and thus obsolete) commit, and thereby hide the instability, was not firing in this case. This was similar to a previous problem with `hg next --rebase` wherein `--continue`'ing a rebase with conflicts would result in visible instability for the same reason. In both cases, the problem appears to be that `rebase` doesn't actually create a transaction, so of course the post-transaction hook doesn't fire.
The solution for `hg next --rebase` was to add a (nearly) empty transaction after the rebase call to trigger the hook. This diff just makes this the default behavior for `hg rebase` so that the hook is always called.
Test Plan:
See new test file. Basically, create a situation like:
```
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| o 220949 debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Perform `hg rebase -r 1 -d 3`, which rebases commit "r1" onto "r3", which would ordinarily make "r2" unstable. Instead, the result should be as below, with no visible instability because "r1" is inhibited.
```
o 738e8e debugbuilddag
| r1
|
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| x 220949 (Rebased as 738e8e) debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Reviewers: rmcelroy, #mercurial, durham
Reviewed By: durham
Subscribers: mjpieters, rmcelroy
Differential Revision: https://phabricator.intern.facebook.com/D4491870
Tasks: 15697758
Signature: t1:4491870:1486033128:45b8e9a72af1e88ab78484ddef47a788d1aca7b5
2017-02-02 22:49:44 +03:00
|
|
|
Set up test environment.
|
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [extensions]
|
2018-01-09 14:06:09 +03:00
|
|
|
> fbamend=
|
fbamend: make inhibit hook fire after rebase
Summary:
Recently @rmcelroy discovered that attempting to rebase a single commit in the middle of a stack results in the rest of the stack being marked as unstable. See https://fb.facebook.com/groups/sourcecontrol/permalink/1207767375939547/ for full example.
It turns out that the inhibit extension's post-transaction hook that would ordinarily inhibit the rebased (and thus obsolete) commit, and thereby hide the instability, was not firing in this case. This was similar to a previous problem with `hg next --rebase` wherein `--continue`'ing a rebase with conflicts would result in visible instability for the same reason. In both cases, the problem appears to be that `rebase` doesn't actually create a transaction, so of course the post-transaction hook doesn't fire.
The solution for `hg next --rebase` was to add a (nearly) empty transaction after the rebase call to trigger the hook. This diff just makes this the default behavior for `hg rebase` so that the hook is always called.
Test Plan:
See new test file. Basically, create a situation like:
```
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| o 220949 debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Perform `hg rebase -r 1 -d 3`, which rebases commit "r1" onto "r3", which would ordinarily make "r2" unstable. Instead, the result should be as below, with no visible instability because "r1" is inhibited.
```
o 738e8e debugbuilddag
| r1
|
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| x 220949 (Rebased as 738e8e) debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Reviewers: rmcelroy, #mercurial, durham
Reviewed By: durham
Subscribers: mjpieters, rmcelroy
Differential Revision: https://phabricator.intern.facebook.com/D4491870
Tasks: 15697758
Signature: t1:4491870:1486033128:45b8e9a72af1e88ab78484ddef47a788d1aca7b5
2017-02-02 22:49:44 +03:00
|
|
|
> rebase=
|
|
|
|
> [experimental]
|
2017-06-17 01:54:15 +03:00
|
|
|
> evolution = createmarkers, allowunstable
|
fbamend: make inhibit hook fire after rebase
Summary:
Recently @rmcelroy discovered that attempting to rebase a single commit in the middle of a stack results in the rest of the stack being marked as unstable. See https://fb.facebook.com/groups/sourcecontrol/permalink/1207767375939547/ for full example.
It turns out that the inhibit extension's post-transaction hook that would ordinarily inhibit the rebased (and thus obsolete) commit, and thereby hide the instability, was not firing in this case. This was similar to a previous problem with `hg next --rebase` wherein `--continue`'ing a rebase with conflicts would result in visible instability for the same reason. In both cases, the problem appears to be that `rebase` doesn't actually create a transaction, so of course the post-transaction hook doesn't fire.
The solution for `hg next --rebase` was to add a (nearly) empty transaction after the rebase call to trigger the hook. This diff just makes this the default behavior for `hg rebase` so that the hook is always called.
Test Plan:
See new test file. Basically, create a situation like:
```
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| o 220949 debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Perform `hg rebase -r 1 -d 3`, which rebases commit "r1" onto "r3", which would ordinarily make "r2" unstable. Instead, the result should be as below, with no visible instability because "r1" is inhibited.
```
o 738e8e debugbuilddag
| r1
|
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| x 220949 (Rebased as 738e8e) debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Reviewers: rmcelroy, #mercurial, durham
Reviewed By: durham
Subscribers: mjpieters, rmcelroy
Differential Revision: https://phabricator.intern.facebook.com/D4491870
Tasks: 15697758
Signature: t1:4491870:1486033128:45b8e9a72af1e88ab78484ddef47a788d1aca7b5
2017-02-02 22:49:44 +03:00
|
|
|
> EOF
|
|
|
|
$ showgraph() {
|
|
|
|
> hg log --graph -T "{rev} {desc|firstline}" | sed \$d
|
|
|
|
> }
|
|
|
|
|
|
|
|
Test that rebased commits that would cause instability are inhibited.
|
|
|
|
$ hg init repo && cd repo
|
|
|
|
$ hg debugbuilddag -m '+3 *3'
|
|
|
|
$ showgraph
|
|
|
|
o 3 r3
|
|
|
|
|
|
|
|
|
| o 2 r2
|
|
|
|
| |
|
|
|
|
| o 1 r1
|
|
|
|
|/
|
|
|
|
o 0 r0
|
2017-07-11 01:45:31 +03:00
|
|
|
$ hg rebase -r 1 -d 3
|
fbamend: make inhibit hook fire after rebase
Summary:
Recently @rmcelroy discovered that attempting to rebase a single commit in the middle of a stack results in the rest of the stack being marked as unstable. See https://fb.facebook.com/groups/sourcecontrol/permalink/1207767375939547/ for full example.
It turns out that the inhibit extension's post-transaction hook that would ordinarily inhibit the rebased (and thus obsolete) commit, and thereby hide the instability, was not firing in this case. This was similar to a previous problem with `hg next --rebase` wherein `--continue`'ing a rebase with conflicts would result in visible instability for the same reason. In both cases, the problem appears to be that `rebase` doesn't actually create a transaction, so of course the post-transaction hook doesn't fire.
The solution for `hg next --rebase` was to add a (nearly) empty transaction after the rebase call to trigger the hook. This diff just makes this the default behavior for `hg rebase` so that the hook is always called.
Test Plan:
See new test file. Basically, create a situation like:
```
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| o 220949 debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Perform `hg rebase -r 1 -d 3`, which rebases commit "r1" onto "r3", which would ordinarily make "r2" unstable. Instead, the result should be as below, with no visible instability because "r1" is inhibited.
```
o 738e8e debugbuilddag
| r1
|
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| x 220949 (Rebased as 738e8e) debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Reviewers: rmcelroy, #mercurial, durham
Reviewed By: durham
Subscribers: mjpieters, rmcelroy
Differential Revision: https://phabricator.intern.facebook.com/D4491870
Tasks: 15697758
Signature: t1:4491870:1486033128:45b8e9a72af1e88ab78484ddef47a788d1aca7b5
2017-02-02 22:49:44 +03:00
|
|
|
rebasing 1:* "r1" (glob)
|
|
|
|
merging mf
|
|
|
|
$ showgraph
|
|
|
|
o 4 r1
|
|
|
|
|
|
|
|
|
o 3 r3
|
|
|
|
|
|
|
|
|
| o 2 r2
|
|
|
|
| |
|
2017-07-11 01:45:31 +03:00
|
|
|
| x 1 r1
|
fbamend: make inhibit hook fire after rebase
Summary:
Recently @rmcelroy discovered that attempting to rebase a single commit in the middle of a stack results in the rest of the stack being marked as unstable. See https://fb.facebook.com/groups/sourcecontrol/permalink/1207767375939547/ for full example.
It turns out that the inhibit extension's post-transaction hook that would ordinarily inhibit the rebased (and thus obsolete) commit, and thereby hide the instability, was not firing in this case. This was similar to a previous problem with `hg next --rebase` wherein `--continue`'ing a rebase with conflicts would result in visible instability for the same reason. In both cases, the problem appears to be that `rebase` doesn't actually create a transaction, so of course the post-transaction hook doesn't fire.
The solution for `hg next --rebase` was to add a (nearly) empty transaction after the rebase call to trigger the hook. This diff just makes this the default behavior for `hg rebase` so that the hook is always called.
Test Plan:
See new test file. Basically, create a situation like:
```
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| o 220949 debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Perform `hg rebase -r 1 -d 3`, which rebases commit "r1" onto "r3", which would ordinarily make "r2" unstable. Instead, the result should be as below, with no visible instability because "r1" is inhibited.
```
o 738e8e debugbuilddag
| r1
|
o e5d56d debugbuilddag
| r3
|
| o c175ba debugbuilddag
| | r2
| |
| x 220949 (Rebased as 738e8e) debugbuilddag
|/ r1
|
o 1ad88b debugbuilddag
r0
```
Reviewers: rmcelroy, #mercurial, durham
Reviewed By: durham
Subscribers: mjpieters, rmcelroy
Differential Revision: https://phabricator.intern.facebook.com/D4491870
Tasks: 15697758
Signature: t1:4491870:1486033128:45b8e9a72af1e88ab78484ddef47a788d1aca7b5
2017-02-02 22:49:44 +03:00
|
|
|
|/
|
|
|
|
o 0 r0
|