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?

Pol
  • 3,848
  • 1
  • 38
  • 55
  • Thanks for asking this question. FWIW, it seems this was patched two years after you asked: http://mercurial.808500.n3.nabble.com/PATCH-subrepo-check-phase-of-state-in-each-subrepositories-before-committing-td4005250.html – weberc2 Apr 16 '14 at 13:18

1 Answers1

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.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
  • Is this hack going to be propagated to other repos in anyway next time I push or it's just local? – Pol Nov 21 '11 at 23:20
  • 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. – Ry4an Brase Nov 22 '11 at 02:51
  • 2
    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 you will also have to do hg branch . – Kevin Berridge Jan 02 '13 at 19:10
  • Great point @KevinBerridge -- thanks for relaying that info from IRC back into this question. That's great Mercurial citizenship. – Ry4an Brase Jan 03 '13 at 19:24