Commits

Ivan Andrus  committed 30fcb68 Merge

merge from upstream

  • Participants
  • Parent commits d625101, 661dbd4

Comments (0)

Files changed (2)

File docs/wiki/documentation/keywords/index.mdown

 ##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`.
 
 #!/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.
 a shell prompt.
 '''
 
+from __future__ import with_statement
+
 import re
 import os
 import subprocess
 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)
 
             book = getattr(repo, '_bookmarkcurrent', None)
         except KeyError:
             book = getattr(repo, '_bookmarkcurrent', None)
-        return _with_groups(m.groups(), book) if book else ''
+        if book:
+            cur = repo['.'].node()
+            if repo._bookmarks[book] == cur:
+                return _with_groups(m.groups(), book)
+        else:
+            return ''
 
     def _branch(m):
         g = m.groups()
     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()
     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):
             '(\|modified)'
             '|(\|unknown)'
             ')*': _status,
-        'tags(\|[^%s]*?)?' % brackets[-1]: _tags,
+        'tags(?:' +
+            '(\|quiet)' +
+            '|(\|[^%s]*?)' % brackets[-1] +
+            ')*': _tags,
         'task': _task,
         'tip(?:'
             '(\|node)'
 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`.