Tagging a subrepository only
-
26-10-2019 - |
سؤال
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?
المحلول
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.
نصائح أخرى
Something like below?
hg -R Sub tag tagname
hg -R Sub commit -m "Comitting tag"