# HG changeset patch # User Steve Losh # Date 1331759622 14400 # Node ID 661dbd42f386611a1c03f3eaf82927d3f1b874d8 # Parent e16ee632ce6faa93c45cbbcc4320d64418bec737# Parent 5faf9b0ae984b02877837ff6a2e1685d67bd305c Merge. diff -r 5faf9b0ae984 -r 661dbd42f386 docs/wiki/documentation/keywords/index.mdown --- a/docs/wiki/documentation/keywords/index.mdown Tue Jul 05 14:19:52 2011 -0500 +++ b/docs/wiki/documentation/keywords/index.mdown Wed Mar 14 17:13:42 2012 -0400 @@ -157,6 +157,9 @@ ##tags## : Display the tags of the current parent, separated by a space. + |quiet + Display the tags of the current parent, excluding the tag "tip". + |SEP : Display the tags of the current parent, separated by `SEP`. diff -r 5faf9b0ae984 -r 661dbd42f386 prompt.py --- a/prompt.py Tue Jul 05 14:19:52 2011 -0500 +++ b/prompt.py Wed Mar 14 17:13:42 2012 -0400 @@ -1,7 +1,5 @@ #!/usr/bin/env python -from __future__ import with_statement - '''get repository information for use in a shell prompt Take a string, parse any special variables inside, and output the result. @@ -10,6 +8,8 @@ a shell prompt. ''' +from __future__ import with_statement + import re import os import subprocess @@ -18,6 +18,13 @@ from mercurial import extensions, commands, cmdutil, help from mercurial.node import hex, short +# `revrange' has been moved into module `scmutil' since v1.9. +try : + from mercurial import scmutil + revrange = scmutil.revrange +except : + revrange = cmdutil.revrange + CACHE_PATH = ".hg/prompt/cache" CACHE_TIMEOUT = timedelta(minutes=15) @@ -137,7 +144,7 @@ def _count(m): g = m.groups() query = [g[1][1:]] if g[1] else ['all()'] - return _with_groups(g, str(len(cmdutil.revrange(repo, query)))) + return _with_groups(g, str(len(revrange(repo, query)))) def _node(m): g = m.groups() @@ -309,9 +316,13 @@ def _tags(m): g = m.groups() - sep = g[1][1:] if g[1] else ' ' + sep = g[2][1:] if g[2] else ' ' tags = repo[None].tags() + quiet = _get_filter('quiet', g) + if quiet: + tags = filter(lambda tag: tag != 'tip', tags) + return _with_groups(g, sep.join(tags)) if tags else '' def _task(m): @@ -385,7 +396,10 @@ '(\|modified)' '|(\|unknown)' ')*': _status, - 'tags(\|[^%s]*?)?' % brackets[-1]: _tags, + 'tags(?:' + + '(\|quiet)' + + '|(\|[^%s]*?)' % brackets[-1] + + ')*': _tags, 'task': _task, 'tip(?:' '(\|node)' @@ -598,6 +612,9 @@ tags Display the tags of the current parent, separated by a space. + |quiet + Display the tags of the current parent, excluding the tag "tip". + |SEP Display the tags of the current parent, separated by `SEP`.