diff hglib/client.py @ 31:ee8863882aae

client: add forget command
author Idan Kamara <idankk86@gmail.com>
date Sun, 14 Aug 2011 00:49:15 +0300
parents b7042bb3dbfd
children a2fc0a7f648e
line wrap: on
line diff
--- a/hglib/client.py	Sun Aug 14 00:48:51 2011 +0300
+++ b/hglib/client.py	Sun Aug 14 00:49:15 2011 +0300
@@ -322,6 +322,24 @@
         self.rawcommand(args, eh=eh)
         return not warnings[0]
 
+    def forget(self, files, include=None, exclude=None):
+        if not isinstance(files, list):
+            files = [files]
+
+        args = cmdbuilder('forget', *files, I=include, X=exclude)
+
+        # we could use Python 3 nonlocal here...
+        warnings = [False]
+
+        def eh(ret, out, err):
+            if ret == 1:
+                warnings[0] = True
+            else:
+                raise error.CommandError(args, ret, out, err)
+
+        out = self.rawcommand(args, eh=eh)
+        return not warnings[0]
+
     def import_(self, patches, strip=None, force=False, nocommit=False,
                 bypass=False, exact=False, importbranch=False, message=None,
                 date=None, user=None, similarity=None):