13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QButtonGroup |
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QButtonGroup |
14 |
14 |
15 from .Ui_HgRebaseDialog import Ui_HgRebaseDialog |
15 from .Ui_HgRebaseDialog import Ui_HgRebaseDialog |
16 |
16 |
17 |
17 |
18 # TODO: Mercurial 4.7: add support for --confirm and --dry-run flags |
|
19 class HgRebaseDialog(QDialog, Ui_HgRebaseDialog): |
18 class HgRebaseDialog(QDialog, Ui_HgRebaseDialog): |
20 """ |
19 """ |
21 Class implementing a dialog to enter the data for a rebase session. |
20 Class implementing a dialog to enter the data for a rebase session. |
22 """ |
21 """ |
23 def __init__(self, tagsList, branchesList, bookmarksList=None, |
22 def __init__(self, tagsList, branchesList, bookmarksList, version, |
24 parent=None): |
23 parent=None): |
25 """ |
24 """ |
26 Constructor |
25 Constructor |
27 |
26 |
28 @param tagsList list of tags (list of strings) |
27 @param tagsList list of tags (list of strings) |
40 |
39 |
41 self.tag1Combo.addItems(sorted(tagsList)) |
40 self.tag1Combo.addItems(sorted(tagsList)) |
42 self.tag2Combo.addItems(sorted(tagsList)) |
41 self.tag2Combo.addItems(sorted(tagsList)) |
43 self.branch1Combo.addItems(["default"] + sorted(branchesList)) |
42 self.branch1Combo.addItems(["default"] + sorted(branchesList)) |
44 self.branch2Combo.addItems(["default"] + sorted(branchesList)) |
43 self.branch2Combo.addItems(["default"] + sorted(branchesList)) |
45 if bookmarksList is not None: |
44 self.bookmark1Combo.addItems(sorted(bookmarksList)) |
46 self.bookmark1Combo.addItems(sorted(bookmarksList)) |
45 self.bookmark2Combo.addItems(sorted(bookmarksList)) |
47 self.bookmark2Combo.addItems(sorted(bookmarksList)) |
46 |
48 else: |
47 self.dryRunGroup.setEnabled(version >= (4, 7, 0)) |
49 self.bookmark1Button.setHidden(True) |
|
50 self.bookmark1Combo.setHidden(True) |
|
51 self.bookmark2Button.setHidden(True) |
|
52 self.bookmark2Combo.setHidden(True) |
|
53 |
48 |
54 msh = self.minimumSizeHint() |
49 msh = self.minimumSizeHint() |
55 self.resize(max(self.width(), msh.width()), msh.height()) |
50 self.resize(max(self.width(), msh.width()), msh.height()) |
56 |
51 |
57 def __updateOK(self): |
52 def __updateOK(self): |
274 Public method to retrieve the data for the rebase session. |
269 Public method to retrieve the data for the rebase session. |
275 |
270 |
276 @return tuple with a source indicator of "S" or "B", the source |
271 @return tuple with a source indicator of "S" or "B", the source |
277 revision, the destination revision, a flag indicating to collapse, |
272 revision, the destination revision, a flag indicating to collapse, |
278 a flag indicating to keep the original changesets, a flag |
273 a flag indicating to keep the original changesets, a flag |
279 indicating to keep the original branch name and a flag indicating |
274 indicating to keep the original branch name, a flag indicating |
280 to detach the source (string, string, string, boolean, boolean, |
275 to detach the source, a flag indicating to perform a dry-run only |
281 boolean, boolean) |
276 and a flag indicating to perform a dry-run first, than ask for |
|
277 confirmation |
|
278 @rtype tuple of (str, str, str, bool, bool, bool, bool, bool, bool) |
282 """ |
279 """ |
283 if self.sourceButton.isChecked(): |
280 if self.sourceButton.isChecked(): |
284 indicator = "S" |
281 indicator = "S" |
285 elif self.baseButton.isChecked(): |
282 elif self.baseButton.isChecked(): |
286 indicator = "B" |
283 indicator = "B" |
296 rev1, |
293 rev1, |
297 self.__getRevision(2), |
294 self.__getRevision(2), |
298 self.collapseCheckBox.isChecked(), |
295 self.collapseCheckBox.isChecked(), |
299 self.keepChangesetsCheckBox.isChecked(), |
296 self.keepChangesetsCheckBox.isChecked(), |
300 self.keepBranchCheckBox.isChecked(), |
297 self.keepBranchCheckBox.isChecked(), |
301 self.detachCheckBox.isChecked() |
298 self.detachCheckBox.isChecked(), |
|
299 self.dryRunOnlyButton.isChecked(), |
|
300 self.dryRunConfirmButton.isChecked(), |
302 ) |
301 ) |