Subrepo status/diff/revert

Martin Geisler mg at lazybytes.net
Mon Aug 23 11:10:49 CDT 2010


Tim Henigan <tim.henigan at gmail.com> writes:

Hi Tim,

> 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
> modified).
>     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.

I am working for another client to fix these problems. I have added the
requested enhancements to the wiki:

  http://mercurial.selenic.com/wiki/Subrepositories#Wanted_Feature_per_Command

Fixing 'hg status' and 'hg diff' is first on my list since it is quite
confusing that 'hg commit' recurses into a subrepository when 'hg
status' gives no output.

I have patches for this on Bitbucket:

  http://bitbucket.org/mg/subrepo-mq

though that repository is down right now, so I've put the files here:

  http://lazybytes.net/tmp/subpo-mq/

This is a static-http repository, I'll setup a hgweb as soon as my DNS
change has propagated...

The biggest problem right now is matching paths inside subrepos, please
see this mail:

  http://mercurial.markmail.org/message/en22vxyyqgbgbllb

> 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 today.

I kind of like this -- the wiki suggests a slightly different output:

  $ hg status
  M sub-a/
  M sub-b/
  M sub-b/file.txt

Here 'M sub-a/' means that the sub-a subrepo is not at its right
revision and where 'M sub-b/' means that there are uncommitted changes
in sub-b (as indicated by the next line).

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

It is actually a good question what 'hg revert --all sub/' should do. My
client has not said how they want this to be handled so it's in the
wiki.

I guess it should recurse, that is, do 'hg revert --all' inside the sub/
repository. Now, the next question is how to reset the state of the
subrepo to what .hgsubstate say? Perhaps we could let

  hg revert --no-recurse sub

do that? I hope we can find an interpretation that is consistent and
natural...


-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100823/86637f36/attachment.pgp>


More information about the Mercurial-devel mailing list