b74891ea0325

Add modified and ignored filters to the status keyword.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 27 Sep 2009 10:21:45 -0400
parents 5339b74840b1
children 4786ae21ac3d
branches/tags (none)
files prompt.py

Changes

--- a/prompt.py	Thu Sep 10 18:33:15 2009 -0400
+++ b/prompt.py	Sun Sep 27 10:21:45 2009 -0400
@@ -114,9 +114,23 @@
         return _with_groups(m.groups(), branch) if branch else ''
     
     def _status(m):
+        g = m.groups()
+        out_g = (g[0],) + (g[-1],)
+        
         st = repo.status(unknown=True)[:5]
-        flag = '!' if any(st[:4]) else '?' if st[-1] else ''
-        return _with_groups(m.groups(), flag) if flag else ''
+        modified = any(st[:4])
+        unknown = len(st[-1]) > 0
+        
+        flag = ''
+        if '|modified' not in g and '|unknown' not in g:
+            flag = '!' if modified else '?' if unknown else ''
+        else:
+            if '|modified' in g:
+                flag += '!' if modified else ''
+            if '|unknown' in g:
+                flag += '?' if unknown else ''
+        
+        return _with_groups(out_g, flag) if flag else ''
     
     def _bookmark(m):
         try:
@@ -215,7 +229,7 @@
         'rev(\|merge)?': _rev,
         'root': _root,
         'root\|basename': _basename,
-        'status': _status,
+        'status(?:(\|modified)|(\|unknown))*': _status,
         'tags(\|[^}]*)?': _tags,
         'task': _task,
         'update': _update,