how to push selected changes only?
Anton Shestakov
engored at gmail.com
Sun Jan 19 06:15:19 UTC 2014
2014/1/19 <hamann.w at t-online.de>:
> I have just upgraded my installation (which was too old to offer graft) and tried it, but
> unfortunately no success.
> The way I am trying is
> cd orig-dir
> hg graft -R ../clone-dir -r 13:14 -r 17:20
> (I had to use the -R because it complained about unknown revisions in orig-dir)
> Should I perhaps run the command from the clone-dir instead?
As far as I understand, graft works only on one repository. Supplying
-R will switch to that repository and ignore current working
directory.
Here's what you probably need to do: go to repository with your
changes (or probably a clone of that to be safe), update it to the
reference revision with "hg update REV", then do "hg graft -r 13:14 -r
17:20". Use --dry-run to see what will happen.
This will create an unnamed branch with copies of 13:14 and 17:20 on
top of your reference revision. They will have different revision
numbers, but you'll be able to push them separately. That is because
you created a fork in your repo's history (you can see it with
graphlog extension). Later, if you need to push your other changes,
you will have to merge those two branches. If that sounds complicated,
read a guide to branches/branching in mercurial [1].
This is not the most elegant way to separate changes, as it leaves
original changes in place and creates an unnamed branch, but it's a
non-destructive operation. When you feel comfortable with editing
history, you might be better off with a destructive operation, such as
one of the commands provided by mq extension.
This question on SO [2] is similar to what you are suggested to do.
[1]: http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/
[2]: https://stackoverflow.com/questions/8467624/splitting-linear-history-into-two-branches-in-mercurial
More information about the Mercurial
mailing list