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

StackOverflow https://stackoverflow.com/questions/7946320

  •  16-02-2021
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top