[PATCH 4 of 9 hglib] client: add export command

Idan Kamara idankk86 at gmail.com
Fri Aug 19 12:15:25 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1313773693 -10800
# Node ID 5833f6ac0929e53cc3cd085ecf8d19ebb688007e
# Parent  29d01b5dc38ccab0b34f2c563923908ac75b4b5f
client: add export command

diff -r 29d01b5dc38c -r 5833f6ac0929 hglib/client.py
--- 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]


More information about the Mercurial-devel mailing list