16 class Closehead(HgExtension): |
16 class Closehead(HgExtension): |
17 """ |
17 """ |
18 Class implementing the strip extension interface. |
18 Class implementing the strip extension interface. |
19 """ |
19 """ |
20 |
20 |
21 def __init__(self, vcs): |
21 def __init__(self, vcs, ui=None): |
22 """ |
22 """ |
23 Constructor |
23 Constructor |
24 |
24 |
25 @param vcs reference to the Mercurial vcs object |
25 @param vcs reference to the Mercurial vcs object |
26 @type Hg |
26 @type Hg |
|
27 @param ui reference to a UI widget (defaults to None) |
|
28 @type QWidget |
27 """ |
29 """ |
28 super().__init__(vcs) |
30 super().__init__(vcs, ui=ui) |
29 |
31 |
30 def hgCloseheads(self, revisions=None): |
32 def hgCloseheads(self, revisions=None): |
31 """ |
33 """ |
32 Public method to close arbitrary heads. |
34 Public method to close arbitrary heads. |
33 |
35 |
36 """ |
38 """ |
37 from .HgCloseHeadSelectionDialog import HgCloseHeadSelectionDialog |
39 from .HgCloseHeadSelectionDialog import HgCloseHeadSelectionDialog |
38 |
40 |
39 message = "" |
41 message = "" |
40 if not revisions: |
42 if not revisions: |
41 dlg = HgCloseHeadSelectionDialog(self.vcs) |
43 dlg = HgCloseHeadSelectionDialog(self.vcs, parent=self.ui) |
42 if dlg.exec() == QDialog.DialogCode.Accepted: |
44 if dlg.exec() == QDialog.DialogCode.Accepted: |
43 revisions, message = dlg.getData() |
45 revisions, message = dlg.getData() |
44 |
46 |
45 if not revisions: |
47 if not revisions: |
46 # still no revisions given; abort... |
48 # still no revisions given; abort... |
56 ) |
58 ) |
57 args += ["--message", message] |
59 args += ["--message", message] |
58 for revision in revisions: |
60 for revision in revisions: |
59 args += ["--rev", revision] |
61 args += ["--rev", revision] |
60 |
62 |
61 dia = HgDialog(self.tr("Closing Heads"), self.vcs) |
63 dia = HgDialog(self.tr("Closing Heads"), hg=self.vcs, parent=self.ui) |
62 res = dia.startProcess(args) |
64 res = dia.startProcess(args) |
63 if res: |
65 if res: |
64 dia.exec() |
66 dia.exec() |