why abort on grafting sibling?
Matt Mackall
mpm at selenic.com
Tue Sep 25 20:09:39 UTC 2012
On Tue, 2012-09-25 at 20:02 +0200, Robert Figura wrote:
> hi,
>
> in the middle of some history ...a-b-c...
> i'd like to tinker with a changeset b.
>
> so i'd like to duplicate it to qimport and edit it:
>
> $ hg up -r a
> $ hg graft b
> grafting revision b
> abort: nothing to merge
> (use 'hg update' or check 'hg heads')
>
> Aha, graft won't allow me to duplicate b.
The issue is that you're saying "please graft a copy of change b onto a
a". Mercurial says "right, boss!" and dives in. But a graft is actually
a special kind of merge. When you do a normal graft on a history that
looks like:
o-o-x-o-o-p-b
\
o-o-o-a
and "graft b onto a", Mercurial internally pretends the history looks
like:
p-b
\ \
a-b'
so that the "merge magic" does the right thing and then unwraps things
so it looks like:
o-o-x-o-o-p-b
\
o-o-o-a-b' <- our grafted changeset, now on another branch
But in your case, it tries to do:
a-b
\
a <- we're trying to merge with an ancestor??
and says "uh, sorry boss, there's nothing to merge here" and gives up.
Now we could make graft work anyway, and make a trivial duplicate b'.
But I'm going to say no to that, because it's not an intended use AND
it's a use case that's unusual enough that it will probably be
encountered more often by (painful) user error than on purpose, which is
not a good combination.
Obvious workaround: duplicate your change by qimporting an exported
change.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list