# HG changeset patch # User Matt Mackall # Date 1410804907 18000 # Node ID 7a7eed5176a4d753a64482e2bd9d40873eeea6ab # Parent 427e80a18ef87f545b28982ac91b43e34488ce1b commands: add hidden -T option for files/manifest/status/tags These commands have generic formatting support but no way to enable it yet. When this feature is more fully developed, this flag will be unhidden. diff -r 427e80a18ef8 -r 7a7eed5176a4 mercurial/commands.py --- a/mercurial/commands.py Fri Sep 12 18:29:29 2014 -0500 +++ b/mercurial/commands.py Mon Sep 15 13:15:07 2014 -0500 @@ -101,6 +101,12 @@ _('record the specified user as committer'), _('USER')), ] +# hidden for now +formatteropts = [ + ('T', 'template', '', + _('display with template (DEPRECATED)'), _('TEMPLATE')), +] + templateopts = [ ('', 'style', '', _('display using template map file (DEPRECATED)'), _('STYLE')), @@ -3064,7 +3070,7 @@ @command('files', [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), - ] + walkopts, + ] + walkopts + formatteropts, _('[OPTION]... [PATTERN]...')) def files(ui, repo, *pats, **opts): """list tracked files @@ -4343,7 +4349,8 @@ @command('manifest', [('r', 'rev', '', _('revision to display'), _('REV')), - ('', 'all', False, _("list files from all revisions"))], + ('', 'all', False, _("list files from all revisions"))] + + formatteropts, _('[-r REV]')) def manifest(ui, repo, node=None, rev=None, **opts): """output the current or given revision of the project manifest @@ -5502,7 +5509,7 @@ ('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')), - ] + walkopts + subrepoopts, + ] + walkopts + subrepoopts + formatteropts, _('[OPTION]... [FILE]...'), inferrepo=True) def status(ui, repo, *pats, **opts): @@ -5957,7 +5964,7 @@ finally: release(lock, wlock) -@command('tags', [], '') +@command('tags', formatteropts, '') def tags(ui, repo, **opts): """list repository tags diff -r 427e80a18ef8 -r 7a7eed5176a4 tests/test-completion.t --- a/tests/test-completion.t Fri Sep 12 18:29:29 2014 -0500 +++ b/tests/test-completion.t Mon Sep 15 13:15:07 2014 -0500 @@ -211,7 +211,7 @@ push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure remove: after, force, include, exclude serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate - status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos + status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template summary: remote update: clean, check, date, rev, tool addremove: similarity, include, exclude, dry-run @@ -258,7 +258,7 @@ debugsuccessorssets: debugwalk: include, exclude debugwireargs: three, four, five, ssh, remotecmd, insecure - files: rev, print0, include, exclude + files: rev, print0, include, exclude, template graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude heads: rev, topo, active, closed, style, template @@ -267,7 +267,7 @@ import: strip, base, edit, force, no-commit, bypass, partial, exact, import-branch, message, logfile, date, user, similarity incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos locate: rev, print0, fullpath, include, exclude - manifest: rev, all + manifest: rev, all, template outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos parents: rev, style, template paths: @@ -279,7 +279,7 @@ rollback: dry-run, force root: tag: force, local, rev, remove, edit, message, date, user - tags: + tags: template tip: patch, git, style, template unbundle: update verify: diff -r 427e80a18ef8 -r 7a7eed5176a4 tests/test-encoding.t --- a/tests/test-encoding.t Fri Sep 12 18:29:29 2014 -0500 +++ b/tests/test-encoding.t Mon Sep 15 13:15:07 2014 -0500 @@ -179,6 +179,24 @@ tip 5:a52c0692f24a \xc3\xa9 3:ca661e7520de (esc) +hg tags (JSON) + + $ hg tags -Tjson + [ + { + "id": "a52c0692f24a", + "rev": 5, + "tag": "tip", + "type": "" + }, + { + "id": "ca661e7520de", + "rev": 3, + "tag": "\xc3\xa9", (esc) + "type": "" + } + ] + hg branches (ascii) $ HGENCODING=ascii hg branches diff -r 427e80a18ef8 -r 7a7eed5176a4 tests/test-status.t --- a/tests/test-status.t Fri Sep 12 18:29:29 2014 -0500 +++ b/tests/test-status.t Mon Sep 15 13:15:07 2014 -0500 @@ -165,6 +165,42 @@ C .hgignore C modified + $ hg status -A -Tjson + [ + { + "path": "added", + "status": "A" + }, + { + "copy": "modified", + "path": "copied", + "status": "A" + }, + { + "path": "removed", + "status": "R" + }, + { + "path": "deleted", + "status": "!" + }, + { + "path": "unknown", + "status": "?" + }, + { + "path": "ignored", + "status": "I" + }, + { + "path": ".hgignore", + "status": "C" + }, + { + "path": "modified", + "status": "C" + } + ] $ echo "^ignoreddir$" > .hgignore $ mkdir ignoreddir