Plugins/VcsPlugins/vcsMercurial/HgExportDialog.py

changeset 6462
58259e234dc9
parent 6458
97480c872ea9
child 6645
ad476851d7e0
--- a/Plugins/VcsPlugins/vcsMercurial/HgExportDialog.py	Sat Aug 04 14:48:27 2018 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/HgExportDialog.py	Sat Aug 04 15:24:58 2018 +0200
@@ -19,16 +19,21 @@
 from .Ui_HgExportDialog import Ui_HgExportDialog
 
 
-# TODO: Mercurial 4.7: add support for --bookmark flag
 class HgExportDialog(QDialog, Ui_HgExportDialog):
     """
     Class implementing a dialog to enter data for the Mercurial export command.
     """
-    def __init__(self, parent=None):
+    def __init__(self, bookmarksList, bookmarkAvailable, parent=None):
         """
         Constructor
         
-        @param parent reference to the parent widget (QWidget)
+        @param bookmarksList list of defined bookmarks
+        @type list of str
+        @param bookmarkAvailable flag indicating the availability of the
+            "--bookmark" option
+        @type bool
+        @param parent reference to the parent widget
+        @type QWidget
         """
         super(HgExportDialog, self).__init__(parent)
         self.setupUi(self)
@@ -40,6 +45,10 @@
         # set default values for directory and pattern
         self.patternEdit.setText("%b_%r_%h_%n_of_%N.diff")
         self.directoryPicker.setText(QDir.tempPath())
+        
+        self.bookmarkCombo.addItem("")
+        self.bookmarkCombo.addItems(sorted(bookmarksList))
+        self.bookmarkCombo.setenabled(bookmarkAvailable)
     
     def __updateOK(self):
         """
@@ -51,7 +60,8 @@
             enabled = False
         elif self.patternEdit.text() == "":
             enabled = False
-        elif self.changesetsEdit.toPlainText() == "":
+        elif self.changesetsEdit.toPlainText() == "" and \
+                self.bookmarkCombo.currentText() == "":
             enabled = False
         
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)
@@ -86,16 +96,18 @@
         Public method to retrieve the export data.
         
         @return tuple naming the output file name, the list of revisions to
-            export, and flags indicating to compare against the second parent,
-            to treat all files as text, to omit dates in the diff headers and
-            to use the git extended diff format (string, list of strings,
-            boolean, boolean, boolean, boolean)
+            export, the name of a bookmarked branch and flags indicating to
+            compare against the second parent, to treat all files as text,
+            to omit dates in the diff headers and to use the git extended
+            diff format
+        @rtype tuple of (str, list of str, str, bool, bool, bool, bool)
         """
         return (
             os.path.join(
                 self.directoryPicker.text(),
                 self.patternEdit.text()),
             self.changesetsEdit.toPlainText().splitlines(),
+            self.bookmarkCombo.currentText(),
             self.switchParentCheckBox.isChecked(),
             self.textCheckBox.isChecked(),
             self.datesCheckBox.isChecked(),

eric ide

mercurial