Question

I've had a folder in my repository. Then I have made this folder a subrepository (with the very same files), commited and pushed this change. Now I can't update back through that commit. Here's the message I get:

% hg update --repository <path to repo> --config ui.merge=internal:fail --rev 1159 --clean
abort: path 'subrepo\include\header.h' is inside nested repo 'subrepo'
[command returned code 255 Wed Dec 05 11:57:45 2012]

Where subrepo is the name of that folder where subrepo now resides. Any way to defeat this and update to earlier revision?

Was it helpful?

Solution

Found a solution: delete the folder in question, then update with the "discard changes" option. Works like charm.

OTHER TIPS

After a bit of googling, this looks like it's directly related to Caveat 3, to quote "Update/merge currently can't remove subrepositories entirely as that might lose local-only changes". Also caveat 5 states "Collisions between normal files and subrepos are not handled".

Interestingly, and something I'd not seen before, Subrepositories are considered a "feature of last resort", which is to say something you should try not to use if you can help it.

Probably not the answer you were looking for.

A workaround is to get to your revision by cloning... you can use a new clone based on a revision just before you created the subrepo:

% hg clone --repository <path to repo> new_copy --rev 1159

This will clone everything up to that point, so you will lose any "future history", but will at least be able to get back to an earlier version.

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