Marking subrepos in 'hg status'

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Oct 20 10:59:14 CDT 2010


On Oct 20, 2010, at 3:37 AM, Martin Geisler wrote:

> Matt Mackall <mpm at selenic.com> writes:
> 
>> On Tue, 2010-10-19 at 09:26 +0200, Martin Geisler wrote:
>>> timeless <timeless at gmail.com> writes:
>>> 
>>>> On Mon, Oct 18, 2010 at 6:05 PM, Martin Geisler <mg at aragost.com> wrote:
>>>>> With your suggestion we can have
>>>>> 
>>>>>  M sub1/
>>>>>  M sub1/a
>>>>>  M sub2/
>>>>>  M sub2/x
>>>>>  A sub1/
>>>>>  A sub1/b
>>>>>  A sub2/
>>>>>  A sub2/y
>>> 
>>> I agree -- I think this is a nice and consistent way to show the
>>> status.
>> 
>> I don't like it. We've always only listed files.
> 
> Yes... but if one thinks of subrepos as versioned directories then it
> makes some sense.

But unlike svn, hg has never had a concept of versioned directories. Seeing directories in a status list seems weird to me too—it doesn't provide much indication that the listed dir is a subrepo.

If the goal is to make subrepos fairly transparent, and if committing is therefore always recursive, why not make it so that `hg status` shows the status of all files, including those in subrepos, sorted as normal; and then make `hg status -S` behave more like `hg tags -v`, showing the subrepo path _after_ the filename, like so:

$ hg status -S
M f1.txt
M sub1/f2.txt  (in sub1/)
A f3.txt
A sub1/f4.txt  (in sub1/)

pacem in terris / mir / shanti / salaam / heiwa
Kevin R. Bullock

>> In my view, the end goal of subrepo support is for you -not to have to
>> be aware you're using subrepos-. I think this is more or less the
>> experience in SVN and CVS.
> 
> Yes and no... some things are not very transparent in Subversion and
> status is quite verbose in that it first marks the "subrepo" with an X
> status and then reports the status recursively:
> 
>  $ svn status
>  X       b
> 
>  Performing status on external item at 'b'
>  M       b/b.txt
> 
> On the other hand, you can transparently access the subrepo:
> 
>  $ svn diff b
>  Index: b/b.txt
>  ===================================================================
>  --- b/b.txt     (revision 1)
>  +++ b/b.txt     (working copy)
>  @@ -1 +1,2 @@
>   b
>  +b
> 
> though a plain diff gives no output or indication of the dirty subrepo:
> 
>  $ svn diff
> 
> So it's a bit inconsistent. Also, a commit will not recurse and by
> defalt there is no tracking of which revision corresponds to which (no
> .hgsubstate file).
> 
>> That goal is obviously still a ways off, but adding new types of
>> status entries is not a step in the right direction.
>> 
>> An alternative:
>> 
>> hg sub -l
>> 
>> -l --list       show subrepository and their states
> 
> Something like that could be nice. Perhaps it could also get --add so
> that users can do
> 
>  hg subrepo --add foo/bar http://foo/bar
> 
> and Mercurial will then checkout http://foo/bar as needed. It is not
> like it's hard to edit the .hgsub file manually, but it is slightly
> confusing for people to sync their working copy with the edited .hgsub
> file afterwards.
> 
> -- 
> Martin Geisler
> 
> aragost Trifork
> Professional Mercurial support
> http://aragost.com/mercurial/
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list