Amending non-tip changesets

Colin Caughie c.caughie at gmail.com
Fri Apr 11 17:00:02 UTC 2014


On 4/11/2014 8:00 AM, Pierre-Yves David wrote:
>
> On 04/11/2014 07:58 AM, Colin Caughie wrote:
>> I've recently started using the evolve extension as part of my daily 
>> workflow, replacing mq. So far my experience has been excellent; it 
>> seems to work very well and wasn't hard to pick up. I really like 
>> knowing that if I mess up I can always get back to where I was (even 
>> if it still sometimes takes a bit of thinking to figure out how).
>>
>> There is one part of my workflow that I haven't quite figured out how 
>> to optimize yet, I wonder if any of you have any suggestions. It 
>> relates to our code review process, which I discussed last month on 
>> the Mercurial list (the "ReviewBoard and Mercurial" discussion). Our 
>> mq-based process goes like this:
>>
>> 1. Commit changes as an mq patch
>> 2. Post a review
>> 3. Continue working, creating new mq patches as necessary
>> 4. When you get review feedback, pop the later patches, make the 
>> required changes to the patch under review and qrefresh
>> 5. Post a diff update based on the amended patch, e.g. using "hg 
>> postreview -e"
>> etc.
>> 6. qpush the later patches and continue working
>>
>> Steps 4-6 are the interesting ones. I know I can do:
>>
>> 4. After feedback, "hg update" to the the changeset that needs 
>> modified, make the required changes and run "hg amend"
>> 5. Post a diff update based on the amended patch
>> 6. Rebase the newer changesets using "hg rebase <rev>", where <rev> 
>> is the first changeset after the one being amended
>> 7. "hg update" to get back to tip.
>>
>> This works, but it would be nice to be able to do that 
>> "automatically", i.e. without having to find the revision number of 
>> the changeset to be rebased. Like maybe an "hg rebase --unstable" 
>> option?
>>
>> I did try "hg evolve -a" but that did something a bit weird; it 
>> looked like it *merged* the unstable changesets with my amended one 
>> which made the graph look a lot more complicated than it needed to be.
>
> hg evolve is exactly meant for that. Can you elaborate on this merge 
> thing? The result should have been the same as rebase.

Been doing some more testing. I updated to the latest version of the 
evolve extension (previously was on 6a67606e1c34 from March 2) and tried 
on both Linux and Windows (previously just using Windows). I'm using 
Mercurial 2.9.1. on both systems, and also tried with 2.9.2 on Windows.

On Linux it worked perfectly; "hg evolve -a" rebased all my unstable 
changesets. ("hg evolve" on its own only transplanted the first one to 
the top of my history which I found slightly counter-intuitive but 
acceptable).

On Windows something seems to be going wrong, even though I've made sure 
I'm using the same versions of both mercurial and the extension. I start 
out with:

@  changeset:   3:7e0c1f626f0a
|  tag:         tip
|  user:        Colin Caughie <ccaughie at openeye.net>
|  date:        Fri Apr 11 09:25:12 2014 -0700
|  summary:     add coffee
|
o  changeset:   2:9f9516784c1b
|  user:        Colin Caughie <ccaughie at openeye.net>
|  date:        Fri Apr 11 09:25:03 2014 -0700
|  summary:     add juice
|
o  changeset:   1:a8c2cae5be78
|  user:        Colin Caughie <ccaughie at openeye.net>
|  date:        Fri Apr 11 09:24:46 2014 -0700
|  summary:     start shopping list
|
o  changeset:   0:ba5cf4f68d7a
    user:        Colin Caughie <ccaughie at openeye.net>
    date:        Fri Apr 11 09:22:10 2014 -0700
    summary:     add shopping list

then I update to changeset 1 and edit the file. "hg amend" gives me

@  changeset:   5:401cabe98aed
|  tag:         tip
|  parent:      0:ba5cf4f68d7a
|  user:        Colin Caughie <ccaughie at openeye.net>
|  date:        Fri Apr 11 09:24:46 2014 -0700
|  summary:     start shopping list
|
| x  changeset:   4:00a3e0afd9a3
| |  parent:      1:a8c2cae5be78
| |  user:        Colin Caughie <ccaughie at openeye.net>
| |  date:        Fri Apr 11 09:24:46 2014 -0700
| |  summary:     temporary amend commit for a8c2cae5be78
| |
| | o  changeset:   3:7e0c1f626f0a
| | |  user:        Colin Caughie <ccaughie at openeye.net>
| | |  date:        Fri Apr 11 09:25:12 2014 -0700
| | |  summary:     add coffee
| | |
| | o  changeset:   2:9f9516784c1b
| |/   user:        Colin Caughie <ccaughie at openeye.net>
| |    date:        Fri Apr 11 09:25:03 2014 -0700
| |    summary:     add juice
| |
| x  changeset:   1:a8c2cae5be78
|/   user:        Colin Caughie <ccaughie at openeye.net>
|    date:        Fri Apr 11 09:24:46 2014 -0700
|    summary:     start shopping list
|
o  changeset:   0:ba5cf4f68d7a
    user:        Colin Caughie <ccaughie at openeye.net>
    date:        Fri Apr 11 09:22:10 2014 -0700
    summary:     add shopping list

and then if I do "hg evolve -a" I get the following output:

D:\work\hgtest\evolve>hg evolve -a
move:[2] add juice
atop:[5] start shopping list
merging shopping.txt
move:[3] add coffee
atop:[6] add juice
merging shopping.txt
6 [<changectx a777d86b2bd0>, <changectx 7e0c1f626f0a>]
7
move:[7] add coffee
atop:[7] add coffee
abort: no support for evolution merge changesets yet
(Redo the merge a use `hg prune` to obsolete the old one)

and the resulting graph looks like this:

@    changeset:   7:bb3a19a8dd66
|\   tag:         tip
| |  parent:      6:a777d86b2bd0
| |  parent:      3:7e0c1f626f0a
| |  user:        Colin Caughie <ccaughie at openeye.net>
| |  date:        Fri Apr 11 09:25:12 2014 -0700
| |  summary:     add coffee
| |
| o    changeset:   6:a777d86b2bd0
| |\   tag:         local
| | |  parent:      5:401cabe98aed
| | |  parent:      2:9f9516784c1b
| | |  user:        Colin Caughie <ccaughie at openeye.net>
| | |  date:        Fri Apr 11 09:25:03 2014 -0700
| | |  summary:     add juice
| | |
| | o  changeset:   5:401cabe98aed
| | |  parent:      0:ba5cf4f68d7a
| | |  user:        Colin Caughie <ccaughie at openeye.net>
| | |  date:        Fri Apr 11 09:24:46 2014 -0700
| | |  summary:     start shopping list
| | |
| | | x  changeset:   4:00a3e0afd9a3
| | | |  parent:      1:a8c2cae5be78
| | | |  user:        Colin Caughie <ccaughie at openeye.net>
| | | |  date:        Fri Apr 11 09:24:46 2014 -0700
| | | |  summary:     temporary amend commit for a8c2cae5be78
| | | |
x | | |  changeset:   3:7e0c1f626f0a
|/ / /   tag:         other
| | |    user:        Colin Caughie <ccaughie at openeye.net>
| | |    date:        Fri Apr 11 09:25:12 2014 -0700
| | |    summary:     add coffee
| | |
x---+  changeset:   2:9f9516784c1b
   | |  tag:         base
  / /   user:        Colin Caughie <ccaughie at openeye.net>
| |    date:        Fri Apr 11 09:25:03 2014 -0700
| |    summary:     add juice
| |
| x  changeset:   1:a8c2cae5be78
|/   user:        Colin Caughie <ccaughie at openeye.net>
|    date:        Fri Apr 11 09:24:46 2014 -0700
|    summary:     start shopping list
|
o  changeset:   0:ba5cf4f68d7a
    user:        Colin Caughie <ccaughie at openeye.net>
    date:        Fri Apr 11 09:22:10 2014 -0700
    summary:     add shopping list


Note that when I was still using the March 2 version of evolve I got the 
same resulting graph but it didn't output the abort message that it does 
now.

I've attached the test script I used to run this scenario. Any advice 
for getting it to work on Windows would be welcome!

Thanks,
Colin

-------------- next part --------------
#!/bin/bash

mkdir evolve
cd evolve
hg init
touch shopping.txt
hg add shopping.txt
hg commit -m "add shopping list"
cat >> shopping.txt << EOF
milk
eggs
bread
EOF
hg commit -m "start shopping list"
cat >> shopping.txt << EOF
juice
EOF
hg commit -m "add juice"
cat >> shopping.txt << EOF
coffee
EOF
hg commit -m "add coffee"
echo "Before amending"
hg glog --hidden
hg update 1
sed -i 's/milk/organic milk/' shopping.txt
hg amend
echo "After amending"
hg glog --hidden
hg evolve -a
echo "After evolve"
hg glog --hidden


More information about the Evolve-testers mailing list