views:

22

answers:

1

I'm trying to build a pruned Mercurial repository from a larger one and need to pull in changes from several branches. I want to use hg convert, but I am getting errors like

abort: unknown revision '81b79760e1350d185dbf645ab67633eda9d52ada'!

when try to use convert to get changes from a related branch. Here's what I did. I started with mybranch and used

hg convert --filemap filemap mybranch mybranch_converted

Then, to capture any changes to the paired down converted repository from anotherbranch (that shares a common ancestor with mybranch), I invoked

hg convert --filemap filemap anotherbranch mybranch_converted

but that fails with an abort error like the one I showed above.

I am lead to understand that this indicates that the shamap file created by the first conversion is borked somehow, so what should I do to generate a good shamap file? I'd also be interested in knowing what could cause this process to fail considering that it is so straight forward. Also, as this may be relevant, I should note that the ancestor of mybranch and anotherbranch was itself generated by converting yet another Mercurial repository.

A: 

I think that message is telling you that one of the changesets you're pulling in has a parent whose node id doesn't show up in the destination repo -- and it doesn't show up because your initial convert changed the nodeids.

Rather than doing two converts, you should do two pulls and a single convert like this:

hg init both_unconverted
hg -R both_unconverted pull ../mybranch
hg -R both_unconverted pull ../anotherbranch
hg convert --filemap myfilemap both_unconverted both_converted

That way you're not trying to graft the new branch onto already modified changesets.

It's possible you could get your route to work with a --splicemap, but I'm not certain and the suggestion above does the same thing more simply.

Ry4an