mercurialmercurial-subrepos

How to fix the main repo when a commit/push has been made from a subrepo in Mercurial


So I have a main Mercurial repo composed of 3 sub-repos.

Usually the right way to commit/push that I understood is the following:

hg commit -Sm 'Fixed a bug' # This commit was done from the main repo
hg push

I did a mistake and commit/push from one of the sub-repos:

hg commit -m 'Fixed a bug' # This commit was done from a sub-repo
hg push

Now, the other coder that will pull/update the main repo won't see my changes in the sub-repo.

What is the right Mercurial way of fixing that?

Manually modifying the .hgsubstate file in the main repo and commit/pushing it?

If so, I understand that the first part of the ID is the tip of the last sub-repo changeset but what about the rest of the ID? How is it generated?

OR

Waiting to the next commit/push so the .hgsubstate file is fixed with the latest changeset?

OR

Committing and pushing a dummy changeset?

OR

Something else...


Solution

  • I do not know if I understood your problem correctly but to me it seems like the correct way would be to step into the subrepo do a pull and update, then step out to the main repo and do commit/push.

    See https://www.mercurial-scm.org/wiki/Subrepository#Synchronizing_in_subrepositories