Rebase extension behaviour
Guido Ostkamp
hg at ostkamp.fastmail.fm
Wed Sep 3 13:55:12 CDT 2008
Hello,
[I posted the following a few days ago on mercurial list, but there was no
response, thus I retry it once to development list as well as directly to
the author of the Rebase extension]
I played a bit with the new 'rebase' extension (hg version version
a04d8cadb6af) and came along the following strange behaviour:
Test preparation:
--- snip --- snap ---
#!/bin/bash
rm -fr repo
hg init repo
cd repo
echo "Line 0" > file0
hg add file0
hg commit -m "commit 0" -u "dummy"
for i in 1 2
do
echo "Line $i" >> file$i
hg add file$i
hg commit -m "commit $i" -u "dummy"
done
hg up 1
hg branch branch1
for i in 1a
do
echo "Line $i a" >> file$i
hg add file$i
hg commit -m "commit $i" -u "dummy"
done
--- snip --- snap ---
This gives the following repo:
$ hg glog
@ changeset: 3:9e7dc389db5a
| branch: branch1
| tag: tip
| parent: 1:a41c9b0a5310
| user: dummy
| date: Mon Sep 01 23:54:22 2008 +0200
| summary: commit 1a
|
| o changeset: 2:d32448327278
|/ user: dummy
| date: Mon Sep 01 23:54:22 2008 +0200
| summary: commit 2
|
o changeset: 1:a41c9b0a5310
| user: dummy
| date: Mon Sep 01 23:54:22 2008 +0200
| summary: commit 1
|
o changeset: 0:81fdb5376928
user: dummy
date: Mon Sep 01 23:54:22 2008 +0200
summary: commit 0
Now I want to rebase 'branch1' on top of 'default' without loosing the
branches.
If I try
$ hg rebase -d default
then I get
$ hg glog
@ changeset: 3:6e052f27eb3a
| tag: tip
| user: dummy
| date: Mon Sep 01 23:36:03 2008 +0200
| summary: commit 1a
|
o changeset: 2:a4e857f6fa54
| user: dummy
| date: Mon Sep 01 23:36:03 2008 +0200
| summary: commit 2
|
o changeset: 1:30e728e6b47b
| user: dummy
| date: Mon Sep 01 23:36:03 2008 +0200
| summary: commit 1
|
o changeset: 0:1dfe8d53368c
user: dummy
date: Mon Sep 01 23:36:03 2008 +0200
summary: commit 0
This looks not that bad, but
$ hg branches
default 3:26dfdd8b6fb2
which means the 'branch1' was lost!
And if I use
$ hg rebase -d default --keep
instead then I get
$ hg glog
@ changeset: 4:703cd3aa0943
| tag: tip
| parent: 2:5e8da88a083b
| user: dummy
| date: Mon Sep 01 23:36:51 2008 +0200
| summary: commit 1a
|
| o changeset: 3:ca0127af580d
| | branch: branch1
| | parent: 1:70ad1d6cafcb
| | user: dummy
| | date: Mon Sep 01 23:36:51 2008 +0200
| | summary: commit 1a
| |
o | changeset: 2:5e8da88a083b
|/ user: dummy
| date: Mon Sep 01 23:36:51 2008 +0200
| summary: commit 2
|
o changeset: 1:70ad1d6cafcb
| user: dummy
| date: Mon Sep 01 23:36:51 2008 +0200
| summary: commit 1
|
o changeset: 0:88c81c1c3ebc
user: dummy
date: Mon Sep 01 23:36:51 2008 +0200
summary: commit 0
that produced unexpected results with commit 1a in both cases.
I wanted the same behaviour as with 'Git' where after
--- snip --- snap ---
#!/bin/bash
rm -fr repo
mkdir repo
cd repo
git init
echo "Line 0" > file0
git add file0
git commit -m "commit 0"
for i in 1 2
do
echo "Line $i" >> file$i
git add file$i
git commit -m "commit $i"
git tag tag$i
done
git branch branch1 tag1
git checkout branch1
for i in 1a
do
echo "Line $i a" >> file$i
git add file$i
git commit -m "commit $i"
done
git rebase master
--- snip --- snap ---
I still have both branches available
$ git branch
* branch1
master
and the log on branch1 is
$ git log
commit c0ca1c14ff118d66f97ca34c44b98595bd282b35
Author: Testuser <testuser at bianca.dialin.t-online.de>
Date: Tue Sep 2 00:01:17 2008 +0200
commit 1a
commit f4d73c315ea6584d024895c78411ec6ae77bb221
Author: Testuser <testuser at bianca.dialin.t-online.de>
Date: Tue Sep 2 00:01:16 2008 +0200
commit 2
commit c227e5062fe808b810fcb02877945184588bc964
Author: Testuser <testuser at bianca.dialin.t-online.de>
Date: Tue Sep 2 00:01:16 2008 +0200
commit 1
commit bbdb2f7115a3678c5afffa7f1104793b27aaf81b
Author: Testuser <testuser at bianca.dialin.t-online.de>
Date: Tue Sep 2 00:01:16 2008 +0200
commit 0
and on branch master
$ git checkout master
$ git log
commit f4d73c315ea6584d024895c78411ec6ae77bb221
Author: Testuser <testuser at bianca.dialin.t-online.de>
Date: Tue Sep 2 00:01:16 2008 +0200
commit 2
commit c227e5062fe808b810fcb02877945184588bc964
Author: Testuser <testuser at bianca.dialin.t-online.de>
Date: Tue Sep 2 00:01:16 2008 +0200
commit 1
commit bbdb2f7115a3678c5afffa7f1104793b27aaf81b
Author: Testuser <testuser at bianca.dialin.t-online.de>
Date: Tue Sep 2 00:01:16 2008 +0200
commit 0
How can I achieve this with Mercurial?
Regards
Guido
More information about the Mercurial-devel
mailing list