How to fix a Mercurial repo that fails updating because points to missing revision in subrepo?
Asked Answered
S

1

9

Our mercurial repository gets stuck when trying to update to an old branch which has a subrepo / revision pair that doesn't exist anymore.

abort: unknown revision '22e9bb6a6cd98be85b995f632b2f72d6298f9354'!

Is there any way to tell Mercurial to update to a revision or branch but not attempt to update the subrepos?

Stabile answered 30/10, 2011 at 16:51 Comment(1)
Thanks for asking this question. FWIW, it seems this was patched two years after you asked: mercurial.808500.n3.nabble.com/…Anuradhapura
C
9

Does the subrepo still exist somewhere else? You can change the pointer to it using the [subpaths] section, which provides a translation layer atop the locations in .hgsub.

If it really doesn't exist anywhere you could so some deep magic like:

hg debugsetparent REVISION_YOU_WANT
cat /dev/null > .hgsub   # put an empty .hgsub in place
hg commit .hgsub
hg update tip

That should create a new revision that's just like REVISION_YOU_WANT except it has an empty .hgsub file, so you can then update to it.

It'd be much better if you could find the subrepo at some new location and point to it with the subpaths.

Charkha answered 30/10, 2011 at 20:34 Comment(4)
Is this hack going to be propagated to other repos in anyway next time I push or it's just local?Stabile
If you commit, it will be propagated on 'push. If you don't want that clone before you act. Local clones are (near) instantaneous and take up (nearly) no disk space -- they're a great way to try thing out.Charkha
Note that if the commit you're trying to update back to is on a named branch (other than default), after you do hg debugsetparent <branchname> you will also have to do hg branch <branchname>.Francenefrances
Great point @KevinBerridge -- thanks for relaying that info from IRC back into this question. That's great Mercurial citizenship.Charkha

© 2022 - 2024 — McMap. All rights reserved.