89912d294ece

Add more patches filters, and reformat the regexes.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 24 Nov 2009 19:50:03 -0500
parents 0a2397ca6669
children 213be62d55e2
branches/tags (none)
files prompt.py

Changes

--- a/prompt.py	Tue Nov 24 19:41:35 2009 -0500
+++ b/prompt.py	Tue Nov 24 19:50:03 2009 -0500
@@ -231,6 +231,13 @@
         sep = join_filter_arg if join_filter else ' -> '
         
         patches = repo.mq.series
+        applied = [p.name for p in repo.mq.applied]
+        unapplied = [p[1] for p in repo.mq.unapplied(repo)]
+        
+        if _get_filter('hide_applied', g):
+            patches = filter(lambda p: p not in applied, patches)
+        if _get_filter('hide_unapplied', g):
+            patches = filter(lambda p: p not in unapplied, patches)
         
         if _get_filter('reverse', g):
             patches = reversed(patches)
@@ -319,16 +326,34 @@
     patterns = {
         'bookmark': _bookmark,
         'branch': _branch,
-        'node(?:(\|short)|(\|merge))*': _node,
-        'patch(?:(\|applied)|(\|unapplied)|(\|count))?': _patch,
-        'patches(?:(\|join\(.*?\))|(\|reverse))*': _patches,
+        'node(?:'
+            '(\|short)'
+            '|(\|merge)'
+            ')*': _node,
+        'patch(?:'
+            '(\|applied)'
+            '|(\|unapplied)'
+            '|(\|count)'
+            ')?': _patch,
+        'patches(?:'
+            '(\|join\(.*?\))'
+            '|(\|reverse)'
+            '|(\|hide_applied)'
+            '|(\|hide_unapplied)'
+            ')*': _patches,
         'rev(\|merge)?': _rev,
         'root': _root,
         'root\|basename': _basename,
-        'status(?:(\|modified)|(\|unknown))*': _status,
+        'status(?:'
+            '(\|modified)'
+            '|(\|unknown)'
+            ')*': _status,
         'tags(\|[^}]*)?': _tags,
         'task': _task,
-        'tip(?:(\|node)|(\|short))*?': _tip,
+        'tip(?:'
+            '(\|node)'
+            '|(\|short)'
+            ')*': _tip,
         'update': _update,
         
         'incoming(\|count)?': _remote('incoming'),