17 from E5Gui.E5PathPicker import E5PathPickerModes |
17 from E5Gui.E5PathPicker import E5PathPickerModes |
18 |
18 |
19 from .Ui_HgExportDialog import Ui_HgExportDialog |
19 from .Ui_HgExportDialog import Ui_HgExportDialog |
20 |
20 |
21 |
21 |
22 # TODO: Mercurial 4.7: add support for --bookmark flag |
|
23 class HgExportDialog(QDialog, Ui_HgExportDialog): |
22 class HgExportDialog(QDialog, Ui_HgExportDialog): |
24 """ |
23 """ |
25 Class implementing a dialog to enter data for the Mercurial export command. |
24 Class implementing a dialog to enter data for the Mercurial export command. |
26 """ |
25 """ |
27 def __init__(self, parent=None): |
26 def __init__(self, bookmarksList, bookmarkAvailable, parent=None): |
28 """ |
27 """ |
29 Constructor |
28 Constructor |
30 |
29 |
31 @param parent reference to the parent widget (QWidget) |
30 @param bookmarksList list of defined bookmarks |
|
31 @type list of str |
|
32 @param bookmarkAvailable flag indicating the availability of the |
|
33 "--bookmark" option |
|
34 @type bool |
|
35 @param parent reference to the parent widget |
|
36 @type QWidget |
32 """ |
37 """ |
33 super(HgExportDialog, self).__init__(parent) |
38 super(HgExportDialog, self).__init__(parent) |
34 self.setupUi(self) |
39 self.setupUi(self) |
35 |
40 |
36 self.directoryPicker.setMode(E5PathPickerModes.DirectoryMode) |
41 self.directoryPicker.setMode(E5PathPickerModes.DirectoryMode) |
38 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
43 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
39 |
44 |
40 # set default values for directory and pattern |
45 # set default values for directory and pattern |
41 self.patternEdit.setText("%b_%r_%h_%n_of_%N.diff") |
46 self.patternEdit.setText("%b_%r_%h_%n_of_%N.diff") |
42 self.directoryPicker.setText(QDir.tempPath()) |
47 self.directoryPicker.setText(QDir.tempPath()) |
|
48 |
|
49 self.bookmarkCombo.addItem("") |
|
50 self.bookmarkCombo.addItems(sorted(bookmarksList)) |
|
51 self.bookmarkCombo.setenabled(bookmarkAvailable) |
43 |
52 |
44 def __updateOK(self): |
53 def __updateOK(self): |
45 """ |
54 """ |
46 Private slot to update the OK button. |
55 Private slot to update the OK button. |
47 """ |
56 """ |
49 |
58 |
50 if self.directoryPicker.text() == "": |
59 if self.directoryPicker.text() == "": |
51 enabled = False |
60 enabled = False |
52 elif self.patternEdit.text() == "": |
61 elif self.patternEdit.text() == "": |
53 enabled = False |
62 enabled = False |
54 elif self.changesetsEdit.toPlainText() == "": |
63 elif self.changesetsEdit.toPlainText() == "" and \ |
|
64 self.bookmarkCombo.currentText() == "": |
55 enabled = False |
65 enabled = False |
56 |
66 |
57 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) |
67 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) |
58 |
68 |
59 @pyqtSlot(str) |
69 @pyqtSlot(str) |
84 def getParameters(self): |
94 def getParameters(self): |
85 """ |
95 """ |
86 Public method to retrieve the export data. |
96 Public method to retrieve the export data. |
87 |
97 |
88 @return tuple naming the output file name, the list of revisions to |
98 @return tuple naming the output file name, the list of revisions to |
89 export, and flags indicating to compare against the second parent, |
99 export, the name of a bookmarked branch and flags indicating to |
90 to treat all files as text, to omit dates in the diff headers and |
100 compare against the second parent, to treat all files as text, |
91 to use the git extended diff format (string, list of strings, |
101 to omit dates in the diff headers and to use the git extended |
92 boolean, boolean, boolean, boolean) |
102 diff format |
|
103 @rtype tuple of (str, list of str, str, bool, bool, bool, bool) |
93 """ |
104 """ |
94 return ( |
105 return ( |
95 os.path.join( |
106 os.path.join( |
96 self.directoryPicker.text(), |
107 self.directoryPicker.text(), |
97 self.patternEdit.text()), |
108 self.patternEdit.text()), |
98 self.changesetsEdit.toPlainText().splitlines(), |
109 self.changesetsEdit.toPlainText().splitlines(), |
|
110 self.bookmarkCombo.currentText(), |
99 self.switchParentCheckBox.isChecked(), |
111 self.switchParentCheckBox.isChecked(), |
100 self.textCheckBox.isChecked(), |
112 self.textCheckBox.isChecked(), |
101 self.datesCheckBox.isChecked(), |
113 self.datesCheckBox.isChecked(), |
102 self.gitCheckBox.isChecked() |
114 self.gitCheckBox.isChecked() |
103 ) |
115 ) |