diff hglib/client.py @ 63:939d1d763bb1

client: add resolve command
author Idan Kamara <idankk86@gmail.com>
date Fri, 19 Aug 2011 22:52:59 +0300
parents d1f57f162274
children a7d98dc798c5
line wrap: on
line diff
--- a/hglib/client.py	Fri Aug 19 22:24:14 2011 +0300
+++ b/hglib/client.py	Fri Aug 19 22:52:59 2011 +0300
@@ -678,6 +678,28 @@
 
         return bool(eh)
 
+    def resolve(self, file=[], all=False, listfiles=False, mark=False, unmark=False,
+                tool=None, include=None, exclude=None):
+        """
+        redo merges or set/view the merge status of files
+
+        When listfiles is True, returns a list of (code, file path) of resolved
+        and unresolved files. Code will be 'R' or 'U' accordingly.
+        """
+        if not isinstance(file, list):
+            file = [file]
+
+        args = cmdbuilder('resolve', *file, a=all, l=listfiles, m=mark, u=unmark,
+                          t=tool, I=include, X=exclude)
+
+        out = self.rawcommand(args)
+
+        if listfiles:
+            l = []
+            for line in out.splitlines():
+                l.append(tuple(line.split(' ', 1)))
+            return l
+
     def revert(self, files, rev=None, all=False, date=None, nobackup=False,
                dryrun=False, include=None, exclude=None):
         if not isinstance(files, list):