# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1497469028 -19800 # Thu Jun 15 01:07:08 2017 +0530 # Node ID 312ec8385177d5780851ae1e682ea992a99a17ba # Parent 622220c3eb0a6ae2f0e7dfc94ac103ad4bfc53aa status: add a flag to terse the output (issue4119)
This adds an experimental flag -t/--terse which will terse the output. The terse flag respects other flags which filters the output. The flag takes a string as value whose value can be a subsequence of "marduic" (the order does not matter here.) If "i" is not present in the terse flag value and not also passed as -i, ignored files will not be considered while tersing. If one wants to consider ignored files, he can add "i" to his terse flag' value or pass the -i flag. The flag is experimental because there might be some cases which might not yet covered resulting in bug. Also we can set the terse on by default for unknowns by passing 'u' if opts.get('terse') is None. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4708,6 +4708,7 @@ ('u', 'unknown', None, _('show only unknown (not tracked) files')), ('i', 'ignored', None, _('show only ignored files')), ('n', 'no-status', None, _('hide status prefix')), + ('t', 'terse', '', _('show the terse output (EXPERIMENTAL)')), ('C', 'copies', None, _('show source of copied files')), ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), ('', 'rev', [], _('show difference from revision'), _('REV')), @@ -4779,6 +4780,7 @@ opts = pycompat.byteskwargs(opts) revs = opts.get('rev') change = opts.get('change') + terse = opts.get('terse') if revs and change: msg = _('cannot specify --rev and --change at the same time') @@ -4803,16 +4805,27 @@ show = [k for k in states if opts.get(k)] if opts.get('all'): show += ui.quiet and (states[:4] + ['clean']) or states + if ui.quiet and terse: + for st in ('ignored', 'unknown'): + if st[0:1] in terse: + show.append(st) + if not show: if ui.quiet: show = states[:4] else: show = states[:5] + if terse: + for st in ('ignored', 'unknown', 'clean'): + if st[0:1] in terse: + show.append(st) m = scmutil.match(repo[node2], pats, opts) stat = repo.status(node1, node2, m, 'ignored' in show, 'clean' in show, 'unknown' in show, opts.get('subrepos')) + if terse: + stat = cmdutil.tersestatus(repo, stat, terse, opts.get('ignore')) changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat) if (opts.get('all') or opts.get('copies') diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -230,7 +230,7 @@ push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure remove: after, force, subrepos, include, exclude serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate, subrepos - status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template + status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, terse, copies, print0, rev, change, include, exclude, subrepos, template summary: remote update: clean, check, merge, date, rev, tool addremove: similarity, subrepos, include, exclude, dry-run _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel