Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 1315
faafd2aa48d5
parent 1312
12506dba74dc
child 1318
6fa303bd65d6
diff -r 7e7b88c58fda -r faafd2aa48d5 Plugins/VcsPlugins/vcsMercurial/hg.py
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Tue Sep 13 18:39:41 2011 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Tue Sep 13 19:41:54 2011 +0200
@@ -49,6 +49,7 @@
 from .HgUtilities import getConfigPath
 from .HgClient import HgClient
 from .HgImportDialog import HgImportDialog
+from .HgExportDialog import HgExportDialog
 
 from .BookmarksExtension.bookmarks import Bookmarks
 from .QueuesExtension.queues import Queues
@@ -2430,6 +2431,47 @@
         
         return res
     
+    def hgExport(self, name):
+        """
+        Public method to export patches to files.
+        
+        @param name directory name of the project to export from (string)
+        """
+        dname, fname = self.splitPath(name)
+        
+        # find the root of the repo
+        repodir = dname
+        while not os.path.isdir(os.path.join(repodir, self.adminDir)):
+            repodir = os.path.dirname(repodir)
+            if repodir == os.sep:
+                return
+        
+        dlg = HgExportDialog()
+        if dlg.exec_() == QDialog.Accepted:
+            filePattern, revisions, switchParent, allText, noDates, git = \
+                dlg.getParameters()
+            
+            args = []
+            args.append("export")
+            args.append("--output")
+            args.append(filePattern)
+            args.append("--verbose")
+            if switchParent:
+                args.append("--switch-parent")
+            if allText:
+                args.append("--text")
+            if noDates:
+                args.append("--nodates")
+            if git:
+                args.append("--git")
+            for rev in revisions:
+                args.append(rev)
+            
+            dia = HgDialog(self.trUtf8("Export Patches"), self)
+            res = dia.startProcess(args, repodir)
+            if res:
+                dia.exec_()
+    
     ############################################################################
     ## Methods to handle extensions are below.
     ############################################################################

eric ide

mercurial