Ad

Fast-forward Branch In Mercurial

- 1 answer

For some reason, I have following situation:

enter image description here

Now I want to get rid of default_2 and fast-forward default to rev 89. But when I do

hg up -r default
hg transplant 61:89

or

hg transplant -b default_2

Mercurial (1.8.2+20110401) just updates my working copy to rev 89. With mq extension it looks like I have to specify all intermediate revisions one-by-one.

So the questions are:

  1. Why doesn’t transplant work? (It’s recommended here: https://www.mercurial-scm.org/wiki/RebaseProject#When_rebase_is_not_allowed)
  2. Is there a way to fast-forward without much pain?
Ad

Answer

Using Mercurial Queues, you can:

hg qinit
hg qimport -r 61:89
hg qpop -a           # unapply all patches
hg up default        # return to your default branch
hg qpush -a          # apply all patches on default
hg qfinish -a        # move applied patches into repo history

NOTE: This assumes that revisions 61:89 have not been pushed to a public repo. The given mq commands will modify history. If these revisions have already been pushed, then it would be best to simply close the default2 branch and then merge default2 into default.

Ad
source: stackoverflow.com
Ad