2019-12-10 02:24:31 +03:00
|
|
|
#chg-compatible
|
|
|
|
|
2017-12-11 09:39:46 +03:00
|
|
|
#require symlink execbit
|
2018-06-19 22:15:18 +03:00
|
|
|
|
2020-01-22 07:45:48 +03:00
|
|
|
$ enable amend morestatus rebase
|
2018-06-19 22:15:18 +03:00
|
|
|
$ setconfig morestatus.show=True
|
|
|
|
$ setconfig diff.git=True
|
2018-06-20 01:31:17 +03:00
|
|
|
$ setconfig rebase.singletransaction=True
|
2018-06-19 22:15:18 +03:00
|
|
|
$ setconfig rebase.experimental.inmemory=True
|
|
|
|
|
2017-12-11 09:39:46 +03:00
|
|
|
Rebase a simple DAG:
|
|
|
|
$ hg init repo1
|
|
|
|
$ cd repo1
|
2019-12-17 05:10:38 +03:00
|
|
|
$ drawdag <<'EOS'
|
2017-12-11 09:39:46 +03:00
|
|
|
> c b
|
|
|
|
> |/
|
|
|
|
> d
|
|
|
|
> |
|
|
|
|
> a
|
|
|
|
> EOS
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg up -C $a
|
2017-12-11 09:39:46 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
o 814f6bd05178 'c'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o db0e82a16a62 'b'
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
o 02952614a83d 'd'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
@ b173517d0057 'a'
|
2017-12-11 09:39:46 +03:00
|
|
|
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r $c c
|
2017-12-11 09:39:46 +03:00
|
|
|
c (no-eol)
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r $b b
|
2017-12-11 09:39:46 +03:00
|
|
|
b (no-eol)
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg rebase --debug -r $b -d $c | grep rebasing
|
2017-12-11 09:39:46 +03:00
|
|
|
rebasing in-memory
|
2019-12-17 05:10:38 +03:00
|
|
|
rebasing db0e82a16a62 "b"
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
o ca58782ad1e4 'b'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o 814f6bd05178 'c'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o 02952614a83d 'd'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
@ b173517d0057 'a'
|
2017-12-11 09:39:46 +03:00
|
|
|
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r $b b
|
2017-12-11 09:39:46 +03:00
|
|
|
b (no-eol)
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r $c c
|
2017-12-11 09:39:46 +03:00
|
|
|
c (no-eol)
|
|
|
|
|
|
|
|
Case 2:
|
|
|
|
$ hg init repo2
|
|
|
|
$ cd repo2
|
2019-12-17 05:10:38 +03:00
|
|
|
$ drawdag <<'EOS'
|
2017-12-11 09:39:46 +03:00
|
|
|
> c b
|
|
|
|
> |/
|
|
|
|
> d
|
|
|
|
> |
|
|
|
|
> a
|
|
|
|
> EOS
|
|
|
|
|
|
|
|
Add a symlink and executable file:
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg up -C $c
|
2017-12-11 09:39:46 +03:00
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ ln -s somefile e
|
|
|
|
$ echo f > f
|
|
|
|
$ chmod +x f
|
|
|
|
$ hg add e f
|
|
|
|
$ hg amend -q
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg up -Cq $a
|
2017-12-11 09:39:46 +03:00
|
|
|
|
|
|
|
Write files to the working copy, and ensure they're still there after the rebase
|
|
|
|
$ echo "abc" > a
|
|
|
|
$ ln -s def b
|
|
|
|
$ echo "ghi" > c
|
|
|
|
$ echo "jkl" > d
|
|
|
|
$ echo "mno" > e
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
o f56b71190a8f 'c'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o db0e82a16a62 'b'
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
o 02952614a83d 'd'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
@ b173517d0057 'a'
|
2017-12-11 09:39:46 +03:00
|
|
|
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r 'desc(c)' c
|
2017-12-11 09:39:46 +03:00
|
|
|
c (no-eol)
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r 'desc(b)' b
|
2017-12-11 09:39:46 +03:00
|
|
|
b (no-eol)
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r 'desc(c)' e
|
2017-12-11 09:39:46 +03:00
|
|
|
somefile (no-eol)
|
2019-12-17 05:10:38 +03:00
|
|
|
$ hg rebase --debug -s $b -d $a | grep rebasing
|
2017-12-11 09:39:46 +03:00
|
|
|
rebasing in-memory
|
2019-12-17 05:10:38 +03:00
|
|
|
rebasing db0e82a16a62 "b"
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
o fc055c3b4d33 'b'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o f56b71190a8f 'c'
|
|
|
|
│ │
|
|
|
|
│ o 02952614a83d 'd'
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
@ b173517d0057 'a'
|
2017-12-11 09:39:46 +03:00
|
|
|
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r 'desc(c)' c
|
2017-12-11 09:39:46 +03:00
|
|
|
c (no-eol)
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg cat -r 'desc(b)' b
|
2017-12-11 09:39:46 +03:00
|
|
|
b (no-eol)
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg rebase --debug -s 'desc(d)' -d 'desc(b)' | grep rebasing
|
2017-12-11 09:39:46 +03:00
|
|
|
rebasing in-memory
|
2019-12-17 05:10:38 +03:00
|
|
|
rebasing 02952614a83d "d"
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing f56b71190a8f "c"
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
o 753feb6fd12a 'c'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o 09c044d2cb43 'd'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o fc055c3b4d33 'b'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
@ b173517d0057 'a'
|
2017-12-11 09:39:46 +03:00
|
|
|
|
|
|
|
Ensure working copy files are still there:
|
|
|
|
$ cat a
|
|
|
|
abc
|
|
|
|
$ readlink.py b
|
|
|
|
b -> def
|
|
|
|
$ cat e
|
|
|
|
mno
|
|
|
|
|
|
|
|
Ensure symlink and executable files were rebased properly:
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg up -Cq 'desc(c)'
|
2017-12-11 09:39:46 +03:00
|
|
|
$ readlink.py e
|
|
|
|
e -> somefile
|
|
|
|
$ ls -l f | cut -c -10
|
|
|
|
-rwxr-xr-x
|
2018-03-30 02:29:48 +03:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
Make a change that only changes the flags of a file and ensure it rebases
|
|
|
|
cleanly.
|
|
|
|
$ hg clone repo2 repo3
|
|
|
|
updating to branch default
|
|
|
|
6 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd repo3
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
@ 753feb6fd12a 'c'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o 09c044d2cb43 'd'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o fc055c3b4d33 'b'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o b173517d0057 'a'
|
2018-03-30 02:29:48 +03:00
|
|
|
|
|
|
|
$ chmod +x a
|
|
|
|
$ hg commit -m "change a's flags"
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg up 'desc(a)-desc(change)'
|
2018-03-30 02:29:48 +03:00
|
|
|
1 files updated, 0 files merged, 5 files removed, 0 files unresolved
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg rebase -r 'desc(change)' -d .
|
2019-12-18 00:45:17 +03:00
|
|
|
rebasing 0666f6a71f74 "change a's flags"
|
2018-03-30 02:29:48 +03:00
|
|
|
$ hg up -q tip
|
|
|
|
$ ls -l a | cut -c -10
|
|
|
|
-rwxr-xr-x
|
|
|
|
$ cd ..
|
2017-12-11 09:39:46 +03:00
|
|
|
|
2018-06-24 22:11:41 +03:00
|
|
|
Rebase the working copy parent:
|
2018-03-30 02:29:48 +03:00
|
|
|
$ cd repo2
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg up -C 'desc(c)'
|
2017-12-11 09:39:46 +03:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg rebase -r '753feb6fd12a' -d 'desc(a)' --debug | egrep 'rebasing|disabling'
|
2018-06-24 22:11:41 +03:00
|
|
|
rebasing in-memory
|
2019-12-18 00:45:17 +03:00
|
|
|
rebasing 753feb6fd12a "c"
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
@ 844a7de3e617 'c'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o 09c044d2cb43 'd'
|
|
|
|
│ │
|
|
|
|
│ o fc055c3b4d33 'b'
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
o b173517d0057 'a'
|
2017-12-11 09:39:46 +03:00
|
|
|
|
2018-06-24 22:11:41 +03:00
|
|
|
Rerun with merge conflicts, demonstrating switching to on-disk merge:
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg up 'desc(d)'
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
2 files updated, 0 files merged, 3 files removed, 0 files unresolved
|
|
|
|
$ echo 'e' > c
|
|
|
|
$ hg add
|
|
|
|
adding c
|
|
|
|
$ hg com -m 'e -> c'
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg up 'desc(b)'
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
o 6af061510c70 'e -> c'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o 844a7de3e617 'c'
|
|
|
|
│ │
|
|
|
|
o │ 09c044d2cb43 'd'
|
|
|
|
│ │
|
|
|
|
@ │ fc055c3b4d33 'b'
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
o b173517d0057 'a'
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg rebase -r 844a7de3e617 -d 'desc(e)'
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing 844a7de3e617 "c"
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
merging c
|
2018-07-02 21:24:57 +03:00
|
|
|
hit merge conflicts (in c); switching to on-disk merge
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing 844a7de3e617 "c"
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
merging c
|
2018-10-22 22:45:46 +03:00
|
|
|
warning: 1 conflicts while merging c! (edit, then use 'hg resolve --mark')
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
unresolved conflicts (see hg resolve, then hg rebase --continue)
|
|
|
|
[1]
|
2018-02-03 02:33:37 +03:00
|
|
|
$ hg rebase --abort
|
|
|
|
rebase aborted
|
|
|
|
|
2018-06-24 22:11:41 +03:00
|
|
|
Allow the working copy parent to be rebased with IMM:
|
2018-07-02 21:24:56 +03:00
|
|
|
$ setconfig rebase.experimental.inmemorywarning='rebasing in-memory!'
|
2020-07-02 23:11:57 +03:00
|
|
|
$ hg up -qC 'desc(c)-desc(e)'
|
|
|
|
$ hg rebase -r . -d 'desc(d)'
|
2018-04-02 22:11:53 +03:00
|
|
|
rebasing in-memory!
|
2019-10-16 02:28:01 +03:00
|
|
|
rebasing 844a7de3e617 "c"
|
2018-08-16 20:37:29 +03:00
|
|
|
$ tglog
|
2020-10-09 06:30:01 +03:00
|
|
|
@ 6f55b7035492 'c'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
|
|
|
│ o 6af061510c70 'e -> c'
|
|
|
|
├─╯
|
2020-10-09 06:30:01 +03:00
|
|
|
o 09c044d2cb43 'd'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o fc055c3b4d33 'b'
|
2020-10-20 03:05:23 +03:00
|
|
|
│
|
2020-10-09 06:30:01 +03:00
|
|
|
o b173517d0057 'a'
|
2018-04-02 22:11:53 +03:00
|
|
|
|
|
|
|
|
|
|
|
Ensure if we rebase the WCP, we still require the working copy to be clean up
|
|
|
|
front:
|
|
|
|
$ echo 'd' > i
|
|
|
|
$ hg add i
|
2020-10-08 21:06:31 +03:00
|
|
|
$ hg rebase -r . -d 'desc(a)'
|
2018-04-02 22:11:53 +03:00
|
|
|
abort: uncommitted changes
|
|
|
|
[255]
|
|
|
|
$ hg up -Cq .
|
2018-06-19 22:15:18 +03:00
|
|
|
$ hg st
|
|
|
|
? c.orig
|
|
|
|
? i
|