diff hglib/client.py @ 33:d74a5891d9d1

client: add missing options to status
author Idan Kamara <idankk86@gmail.com>
date Sun, 14 Aug 2011 00:49:56 +0300
parents a2fc0a7f648e
children f6e1d9a6e0cd
line wrap: on
line diff
--- a/hglib/client.py	Sun Aug 14 00:49:28 2011 +0300
+++ b/hglib/client.py	Sun Aug 14 00:49:56 2011 +0300
@@ -516,9 +516,34 @@
     def root(self):
         return self.rawcommand(['root']).rstrip()
 
-    def status(self):
-        out = self.rawcommand(['status', '-0'])
+    def status(self, rev=None, change=None, all=False, modified=False, added=False,
+               removed=False, deleted=False, clean=False, unknown=False,
+               ignored=False, copies=False, subrepos=False, include=None,
+               exclude=None):
+        """
+        Return a dictionary with the following keys:
 
+                M = modified
+                A = added
+                R = removed
+                C = clean
+                ! = missing (deleted by non-hg command, but still tracked)
+                ? = untracked
+                I = ignored
+                  = origin of the previous file listed as A (added)
+
+        And a list of files to match as values.
+        """
+        if rev and change:
+            raise ValueError('cannot specify both rev and change')
+
+        args = cmdbuilder('status', rev=rev, change=change, A=all, m=modified,
+                          a=added, r=removed, d=deleted, c=clean, u=unknown,
+                          i=ignored, C=copies, S=subrepos, I=include, X=exclude)
+
+        args.append('-0')
+
+        out = self.rawcommand(args)
         d = dict((c, []) for c in 'MARC!?I')
 
         for entry in out.split('\0'):