diff hglib/client.py @ 55:5833f6ac0929

client: add export command
author Idan Kamara <idankk86@gmail.com>
date Fri, 19 Aug 2011 20:08:13 +0300
parents 29d01b5dc38c
children 9bd819da245a
line wrap: on
line diff
--- a/hglib/client.py	Fri Aug 19 20:07:56 2011 +0300
+++ b/hglib/client.py	Fri Aug 19 20:08:13 2011 +0300
@@ -369,6 +369,22 @@
 
         return bool(eh)
 
+    def export(self, revs, output=None, switchparent=False, text=False, git=False,
+               nodates=False):
+        """
+        Return the header and diffs for one or more changesets. When output is
+        given, dumps to file.
+        """
+        if not isinstance(revs, list):
+            revs = [revs]
+        args = cmdbuilder('export', *revs, o=output, switch_parent=switchparent,
+                          a=text, g=git, nodates=nodates)
+
+        out = self.rawcommand(args)
+
+        if output is None:
+            return out
+
     def forget(self, files, include=None, exclude=None):
         if not isinstance(files, list):
             files = [files]