[PATCH V2] status: add terse option flag (issue4119)

Sean Farley sean at farley.io
Wed Oct 14 17:53:51 CDT 2015


Ryan McElroy <rm at fb.com> writes:

> On 10/14/2015 7:20 AM, Pierre-Yves David wrote:
>>
>>
>> On 10/13/2015 02:46 PM, Sean Farley wrote:
>>> # HG changeset patch
>>> # User Sean Farley <sean at farley.io>
>>> # Date 1427261050 25200
>>> #      Tue Mar 24 22:24:10 2015 -0700
>>> # Node ID 93173ffbe421307efe9cae4404587a541a826ee7
>>> # Parent  a38924f7680c6b7d95e14ade999c35748c9dcafd
>>> status: add terse option flag (issue4119)
>>
>> I really like the idea and think we should move forward on this topic. 
>> However there is likely some testing and discussion required. Can we 
>> flag the command switch as EXPERIMENTAL so that we have option to 
>> adjust this in the next cycle?
>>
>>>
>>> Based on an idea by Martin Geisler, this patch adds the ability to 
>>> abbreviate
>>> the ouput of status by only listing the parent directory for multiple 
>>> files. By
>>> default, we do this for all status types but control this through the
>>> experimental.terse option.
>>>
>>> Future work could speed up status operations even further by skipping 
>>> disk
>>> operations based on this config.
>>>
>>> For example, imagine we have the following output of status:
>>>
>>> $ hg st
>>> A mercurial/adddir/a
>>> A mercurial/adddir/b
>>> A mercurial/adddir/c
>>> ? bar
>>> ? baz
>>> ? foo/subdir/a
>>> ? foo/subdir/b
>>> ? foo/subdir/c
>>> ? foo/x
>>> ? foo/y
>>> ? mercurial/subdir/a
>>> ? mercurial/subdir/b
>>> ? mercurial/subdir/c
>>> ? ugh/x
>>>
>>> without any configuration, we get:
>>>
>>> $ hg st -t
>>> A mercurial/adddir/
>>> ? bar
>>> ? baz
>>> ? foo/
>>> ? mercurial/subdir/
>>> ? ugh/x
> Why do we get ugh/x and not just ugh/ ?

Because there is only one file.

> If not all files in  mercurial/adddir/a was not added (ie, only some 
> files were added, what does the output look like?)

(let's assume there are four files: two added and two unknown) There
would be two entries in the output:

A mercurial/adddir/
? mercurial/adddir/

>>> and with some config knobs, we get:
>>>
>>> $ hg st -t --config experimental.terse='?'
>
> This config option is poorly named -- I have no idea what to expect it 
> to do (I had to read the code).
>
> Perhaps better: experimental.tersestatuses='?'

Sure.

>>> A mercurial/adddir/a
>>> A mercurial/adddir/b
>>> A mercurial/adddir/c
>>> ? bar
>>> ? baz
>>> ? foo/
>>> ? mercurial/subdir/
>>> ? ugh/x
>>>
>>> And we can still see the files in 'foo' by:
>>>
>>> $ hg st -t foo
>>> ? foo/subdir/
>>> ? foo/x
>>> ? foo/y
>>>
>>> But, this has a downside of not working as desired with relative paths:
>>>
>>> $ hg st -t re:
>>> A mercurial/adddir/a
>>> A mercurial/adddir/b
>>> A mercurial/adddir/c
>>> ? bar
>>> ? baz
>>> ? foo/subdir/a
>>> ? foo/subdir/b
>>> ? foo/subdir/c
>>> ? foo/x
>>> ? foo/y
>>> ? mercurial/subdir/a
>>> ? mercurial/subdir/b
>>> ? mercurial/subdir/c
>>> ? ugh/x
>
> What about for the '' filematcher? (eg, hg status ''). Does that also 
> fail to be tersified?

Yep.

> What would it take to make this work?

Probably not too much work but this code has bit rotted for a long time
in my head. We could probably hammer it out at the sprint if there's
free time.


More information about the Mercurial-devel mailing list