rebase: fix working copy location after a --collapse (issue4080)
Rebasing with --collapse would leave the working copy on the parent of the
collapsed commit, instead of on the collapsed commit. This fixes that. Also
fixes a few tests that already covered this area but had bad data.
This also fixes issue3716 where bookmarks are not kept across rebases with
--collapse. I updated the test to cover that case as well.
--- a/hgext/rebase.py Mon Nov 04 19:59:00 2013 -0800
+++ b/hgext/rebase.py Fri Nov 01 17:08:06 2013 -0700
@@ -346,6 +346,9 @@
commitmsg = ui.edit(commitmsg, repo.ui.username())
newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
extrafn=extrafn, editor=editor)
+ for oldrev in state.iterkeys():
+ if state[oldrev] > nullmerge:
+ state[oldrev] = newrev
if 'qtip' in repo.tags():
updatemq(repo, state, skipped, **opts)
--- a/tests/test-rebase-collapse.t Mon Nov 04 19:59:00 2013 -0800
+++ b/tests/test-rebase-collapse.t Fri Nov 01 17:08:06 2013 -0700
@@ -57,11 +57,11 @@
saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
$ hg tglogp
- o 5:secret 'Collapsed revision
+ @ 5:secret 'Collapsed revision
| * B
| * C
| * D'
- @ 4:draft 'H'
+ o 4:draft 'H'
|
| o 3:draft 'G'
|/|
@@ -737,12 +737,13 @@
$ touch b
$ hg commit -Am b
adding b
+ $ hg book foo
$ hg rebase -d 0 -r "1::2" --collapse -m collapsed
saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/*-backup.hg (glob)
- $ hg tglog
- o 1: 'collapsed'
+ $ hg log -G --template "{rev}: '{desc}' {bookmarks}"
+ @ 1: 'collapsed' foo
|
- @ 0: 'base'
+ o 0: 'base'
$ hg manifest --rev tip
b
--- a/tests/test-rebase-detach.t Mon Nov 04 19:59:00 2013 -0800
+++ b/tests/test-rebase-detach.t Fri Nov 01 17:08:06 2013 -0700
@@ -329,11 +329,11 @@
saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob)
$ hg tglog
- o 8: 'Collapsed revision
+ @ 8: 'Collapsed revision
| * I
| * Merge
| * J'
- @ 7: 'H'
+ o 7: 'H'
|
| o 6: 'G'
|/|