Subrepo status/diff/revert

Tim Henigan tim.henigan at
Mon Aug 23 09:54:16 CDT 2010


My team intends to use subrepos for shared modules in our products.
However, some concerns were raised about the current user interface.

Developers here are interested in a few key features:
    1) `hg status` must show when a subrepo has been modified (e.g.
updated to different changeset or locally modified).
    2) If a subrepo has been modified, then `hg diff` must show the
change to the SHA1 (or just append '+dirty' to the SHA1 if locally
    3) If a subrepo has been mistakenly modified, then `hg revert`
must update it to the correct changeset.
    4) The above changes must not break TortoiseHg.

I understand that changes to subrepo behavior are being considered [1]
[2], but I haven't seen anything yet that would address these needs.

With that in mind, I plan to develop an extension to:

    1) Modify `hg status` to show when a subrepo SHA1 does not match
the SHA1 in .hgsubstate.  My current plan is to output 'S subrepo/dir'
when a mismatch is found. This is the same action done in TortoiseHg

    2) Modify `hg revert` to update subrepos to the SHA1 listed in .hgsubstate.

    3) Modify `hg diff` to show changes to the .hgsubstate SHA1.  This includes:
        a) Replacing the subrepo SHA1 in .hgsubstate if it does not match.
        b) Appending '+dirty' to the SHA1 in .hgsubstate if the
subrepo has local modifications.
        -) NOTE: I am not sure if modifying .hgsubstate is safe in this context.

Does this group of changes sound reasonable?
Are there other plans to develop similar features?

Tim Henigan


More information about the Mercurial-devel mailing list