Mercurial and Agile

Gilles Moris gilles.moris at free.fr
Thu Jul 9 02:48:11 CDT 2009


On Thu July 2 2009 03:31:40 Matt Mackall wrote:
> We can define a fairly complex "cherrypick" operator like this:
> 
> a-o-p-s-o-o   s is the change we want to pick, p is its parent
>  \
>   o-o-d       d is where we want it to end up
> 
> First check out p:
> 
>  hg up -C p
> 
> Then get change s in our working directory, without changing our parent:
> 
>  hg revert -a -r s
> 
> Now do a 'reverse merge' (needs 1.3) to the ancestor:
> 
>  hg up a   # linearly transplant change s to a -> s'
> 
> Now do a 'forward merge' to d:
> 
>  hg up d   # transplant s' to d -> s''
> 

I tried this workflow, but it does not work.
The first update (reverse merge) merges not only s but also everything
between a -> p. This makes the merge of update non symmetric:
hg up -C rev
edit, hack ...
hg up rev+N
hg up rev
does not leave you back at your hack state (full workflow below).

Is this a bug ?

Regards.
Gilles.

% hg version
Mercurial Distributed SCM (version 1.3)
% hg init t
% cd t

# this is rev 0
% echo a > file
% hg ci -Am a
adding file

# this is rev 1
% echo b >> file
% hg ci -m b
% cat file
a
b

# go back to a (rev 0)
% hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% cat file
a

# insert a line before a
% echo change > file
% echo a >> file
% hg diff
diff -r c136b045b9a8 file
--- a/file      Thu Jul 09 09:29:32 2009 +0200
+++ b/file      Thu Jul 09 09:29:33 2009 +0200
@@ -1,1 +1,2 @@
+change
 a

# merge forward
% hg up 1
merging file
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
% hg diff
diff -r e5e76ddf871b file
--- a/file      Thu Jul 09 09:29:32 2009 +0200
+++ b/file      Thu Jul 09 09:29:33 2009 +0200
@@ -1,2 +1,3 @@
+change
 a
 b
# merge ok

# merge backward
% hg up 0
merging file
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
% hg diff
diff -r c136b045b9a8 file
--- a/file      Thu Jul 09 09:29:32 2009 +0200
+++ b/file      Thu Jul 09 09:29:33 2009 +0200
@@ -1,1 +1,3 @@
+change
 a
+b
# reverse merge keeps b diff
# hg up is not symmetric





More information about the Mercurial mailing list