Plugins/VcsPlugins/vcsMercurial/HgBundleDialog.py

changeset 5678
0aa72754d535
parent 5500
5e723c249586
child 6048
82ad8ec9548c
--- a/Plugins/VcsPlugins/vcsMercurial/HgBundleDialog.py	Thu Apr 06 18:33:40 2017 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/HgBundleDialog.py	Thu Apr 06 18:37:10 2017 +0200
@@ -20,21 +20,32 @@
     Class implementing a dialog to enter the data for a bundle operation.
     """
     def __init__(self, tagsList, branchesList, bookmarksList=None,
-                 parent=None):
+                 version=(0, 0, 0), parent=None):
         """
         Constructor
         
-        @param tagsList list of tags (list of strings)
-        @param branchesList list of branches (list of strings)
-        @param bookmarksList list of bookmarks (list of strings)
-        @param parent parent widget (QWidget)
+        @param tagsList list of tags
+        @type list of str
+        @param branchesList list of branches
+        @type list of str
+        @param bookmarksList list of bookmarks
+        @type list of str
+        @param version Mercurial version info
+        @type tuple of three integers
+        @param parent parent widget
+        @type QWidget
         """
         super(HgBundleDialog, self).__init__(parent)
         self.setupUi(self)
         
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
         
-        self.compressionCombo.addItems(["", "bzip2", "gzip", "none"])
+        self.__version = version
+        
+        bundleTypes = ["", "bzip2", "gzip", "none"]
+        if version >= (4, 1, 0):
+            bundleTypes.insert(-1, "zstd")
+        self.compressionCombo.addItems(bundleTypes)
         self.tagCombo.addItems(sorted(tagsList))
         self.branchCombo.addItems(["default"] + sorted(branchesList))
         if bookmarksList is not None:
@@ -154,5 +165,8 @@
                     self.baseRevisionsEdit.toPlainText().strip().splitlines()
                     if rev.strip()]
         
-        return (revs, baseRevs, self.compressionCombo.currentText(),
-                self.allCheckBox.isChecked())
+        bundleType = self.compressionCombo.currentText()
+        if bundleType == "zstd":
+            bundleType += "-v2"
+        
+        return (revs, baseRevs, bundleType, self.allCheckBox.isChecked())

eric ide

mercurial