Marking subrepos in 'hg status'

Didly Bom didlybom at gmail.com
Sun Oct 10 17:51:11 CDT 2010


On Mon, Sep 27, 2010 at 6:26 PM, Martin Geisler <mg at aragost.com> wrote:

>
> Consider a situaion like this:
>
>  $ hg status -S
>  M dir/x.txt
>  M sub/a.txt
>  A dir/y.txt
>  A sub/b.txt
>
> where sub/ is a subrepository and dir/ is just a folder.
>
> In some older discussions, people asked for an indicator of when a file
> is inside a subrepository and when it is inside a directory -- I felt
> the most natural choice was to write sub/ for the subrepositories.
>
> But in the case above, it is hard to see what to write for the line with
> 'A sub/b.txt' -- should it look like this:
>
>  $ hg status -S
>  M dir/x.txt
>  M sub/
>  M sub/a.txt
>  A dir/y.txt
>  A sub/
>  A sub/b.txt
>
> That is strange since the subrepo has not been added. An alternative
> would be to move the recusion up, so that all status lines are kept
> together for each subrepo:
>
>  $ hg status -S
>  M dir/x.txt
>  A dir/y.txt
>  M sub/
>  M sub/a.txt
>  A sub/b.txt
>
> which I think works better, though it results in scrambled order of
> added and modified files. What do you guys think?
>

Martin,

In my opinion, the first option is _really_ confusing. I think that option
two is much better and also makes much more sense. After all you could say
that the files changed, added or remove within a subrepo are the details of
the modification of that subrepo. As such it makes sense to show them
immediately after the subrepo modification line.

One thing that I would do differently, though, is that the "subrepo line"
should somehow indicate that the change is within a subrepo. Perhaps an "S"
could be used instead or in addition to the "M" tag in the "M sub/" line?

Where things would probably break down a little is once you introduce
subrepos within subrepos. Since there is no "end of subrepo modification"
line, it may be a bit hard to tell when a change belongs to a subrepo or not
(it won't be impossible, just harder than it should). Maybe showing all
subrepo changes at the end would help in that case?

Another option would be to append an "S" tag to the modification status of
all files contained in a subrepo. In your example the result would be:

 $ hg status -S
 M dir/x.txt
 A dir/y.txt
 MS sub/
 MS sub/a.txt
 AS sub/b.txt

 This could be repeated for subrepos within subrepos. This has the problem
that the "status" column would no longer be one char wide, but it would show
without a doubt which files belong to a subrepo and which do not.

Just my 2 cents. Cheers!

Angel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20101011/229e7db1/attachment.htm>


More information about the Mercurial-devel mailing list