[PATCH STABLE] rebase: fix working copy location after a --collapse (issue4080)
Durham Goode
durham at fb.com
Fri Nov 1 19:09:12 CDT 2013
# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1383350886 25200
# Fri Nov 01 17:08:06 2013 -0700
# Branch stable
# Node ID a08ed9678dead79c9a2c104dca74e848bfa1e974
# Parent 1d7a36ff2615e6e12ce65681db4e07622e7b60d1
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.
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -345,6 +345,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)
diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -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
diff --git a/tests/test-rebase-detach.t b/tests/test-rebase-detach.t
--- a/tests/test-rebase-detach.t
+++ b/tests/test-rebase-detach.t
@@ -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'
|/|
More information about the Mercurial-devel
mailing list