2

I have a Mercurial main-repository with one sub-repository, like this:

Main
  .hg
  .hgsub
  .hgsubstate
  <some_regular_files_and_subdirs>
  Sub
    .hg
    <some_regular_files_and_subdirs>

And I wish to tag Sub, only, while keeping Main/.hgsubstate up-to-date (i.e. point to the changeset of Sub resulting from the tagging process).
I don't want to tag the main-repository.
Is that possible without tagging from within Sub and do some magic to get Main/.hgsubstate up to date?

2 Answers2

1

When updating a subrepo, you always need to perform a commit on the main repo to begin using that subrepo revision. Therefore, you can't exactly do what you want from the subrepo itself, you will have to enter the main repo and execute a single command there.

from the command line:

(navigate to subrepo directory)
> hg tag <tagName>
(navigate to main repo directory)
> hg commit -m "updating to subrepo tag <tagName>"

After you have created the subrepo tag and updated the subrepo to that tag, performing a commit from the top level (ie: Main) should update .hgsubstate and does not require you to tag the Main repo. In fact, changing the revision of any subrepo should trigger a change in the .hgsubstate file, which can be committed in the main repo without a tag.

dls
  • 4,146
  • 2
  • 24
  • 26
  • Thanks. This works! I thought that once `Main/Sub/.hgtags` was auto-committed, then going back to `Main` and doing a `hg stat` would show no changed files, but it actually shows that `Main/Sub/.hgtags` has changed, which is why a commit from there will update `Main/.hgsubstate`. Interesting. – René Nielsen Apr 29 '11 at 06:14
0

Something like below?

hg -R Sub tag tagname
hg -R Sub commit -m "Comitting tag"
manojlds
  • 290,304
  • 63
  • 469
  • 417
  • Thanks for the reply, but it doesn't quite seem to work. I think it would work if you removed `-R Sub` from the second command, since it seems that `-R Sub` corresponds to a chdir to that subrepo's folder. – René Nielsen Apr 29 '11 at 06:27