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

Sean Farley sean at farley.io
Wed Mar 25 00:58:00 CDT 2015


Sean Farley <sean at farley.io> writes:

> # HG changeset patch
> # User Sean Farley <sean at farley.io>
> # Date 1427261050 25200
> #      Tue Mar 24 22:24:10 2015 -0700
> # Node ID 1fc4b58112600db90c710f32a3ec6f5c4438d5df
> # Parent  f9e43618a84b4ce1de23c8cdf22de5e9bcadafdd
> status: add terse option flag (issue4119)
>
> Based on work by Martin Geisler, this patch adds the option to list only
> directories of untracked files. A test has been added.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -5688,10 +5688,11 @@ class httpservice(object):
>      ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
>      ('', 'rev', [], _('show difference from revision'), _('REV')),
>      ('', 'change', '', _('list the changed files of a revision'), _('REV')),
>      ('', 'relative', None,
>       ('list the changed files relative to working directory')),
> +    ('t', 'terse', None, _('show only directory of unknown files')),
>      ] + walkopts + subrepoopts + formatteropts,
>      _('[OPTION]... [FILE]...'),
>      inferrepo=True)
>  def status(ui, repo, *pats, **opts):
>      """show changed files in the working directory
> @@ -5788,10 +5789,40 @@ def status(ui, repo, *pats, **opts):
>              show = states[:5]
>  
>      stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts),
>                         'ignored' in show, 'clean' in show, 'unknown' in show,
>                         opts.get('subrepos'))
> +
> +    if 'unknown' in show and opts.get('terse'):
> +        knowndirs = set(['']) # root is always known
> +        results = set()
> +
> +        # gather known directories
> +        for path in repo[node1]:

Whoops, this should be repo[None] so we can avoid reading obs markers.


More information about the Mercurial-devel mailing list