19 |
19 |
20 class StripProjectHelper(HgExtensionProjectHelper): |
20 class StripProjectHelper(HgExtensionProjectHelper): |
21 """ |
21 """ |
22 Class implementing the strip extension project helper. |
22 Class implementing the strip extension project helper. |
23 """ |
23 """ |
|
24 |
24 def __init__(self): |
25 def __init__(self): |
25 """ |
26 """ |
26 Constructor |
27 Constructor |
27 """ |
28 """ |
28 super().__init__() |
29 super().__init__() |
29 |
30 |
30 def initActions(self): |
31 def initActions(self): |
31 """ |
32 """ |
32 Public method to generate the action objects. |
33 Public method to generate the action objects. |
33 """ |
34 """ |
34 self.hgStripAct = EricAction( |
35 self.hgStripAct = EricAction( |
35 self.tr('Strip changesets'), |
36 self.tr("Strip changesets"), |
36 UI.PixmapCache.getIcon("fileDelete"), |
37 UI.PixmapCache.getIcon("fileDelete"), |
37 self.tr('Strip changesets'), |
38 self.tr("Strip changesets"), |
38 0, 0, self, 'mercurial_strip') |
39 0, |
39 self.hgStripAct.setStatusTip(self.tr( |
40 0, |
40 'Strip changesets from a repository' |
41 self, |
41 )) |
42 "mercurial_strip", |
42 self.hgStripAct.setWhatsThis(self.tr( |
43 ) |
43 """<b>Strip changesets</b>""" |
44 self.hgStripAct.setStatusTip(self.tr("Strip changesets from a repository")) |
44 """<p>This deletes a changeset and all its descendants""" |
45 self.hgStripAct.setWhatsThis( |
45 """ from a repository. Each removed changeset will be""" |
46 self.tr( |
46 """ stored in .hg/strip-backup as a bundle file.</p>""" |
47 """<b>Strip changesets</b>""" |
47 )) |
48 """<p>This deletes a changeset and all its descendants""" |
|
49 """ from a repository. Each removed changeset will be""" |
|
50 """ stored in .hg/strip-backup as a bundle file.</p>""" |
|
51 ) |
|
52 ) |
48 self.hgStripAct.triggered.connect(self.__hgStrip) |
53 self.hgStripAct.triggered.connect(self.__hgStrip) |
49 self.actions.append(self.hgStripAct) |
54 self.actions.append(self.hgStripAct) |
50 |
55 |
51 def initMenu(self, mainMenu): |
56 def initMenu(self, mainMenu): |
52 """ |
57 """ |
53 Public method to generate the extension menu. |
58 Public method to generate the extension menu. |
54 |
59 |
55 @param mainMenu reference to the main menu |
60 @param mainMenu reference to the main menu |
56 @type QMenu |
61 @type QMenu |
57 @return populated menu (QMenu) |
62 @return populated menu (QMenu) |
58 """ |
63 """ |
59 menu = QMenu(self.menuTitle(), mainMenu) |
64 menu = QMenu(self.menuTitle(), mainMenu) |
60 menu.setIcon(UI.PixmapCache.getIcon("fileDelete")) |
65 menu.setIcon(UI.PixmapCache.getIcon("fileDelete")) |
61 menu.setTearOffEnabled(True) |
66 menu.setTearOffEnabled(True) |
62 |
67 |
63 menu.addAction(self.hgStripAct) |
68 menu.addAction(self.hgStripAct) |
64 |
69 |
65 return menu |
70 return menu |
66 |
71 |
67 def menuTitle(self): |
72 def menuTitle(self): |
68 """ |
73 """ |
69 Public method to get the menu title. |
74 Public method to get the menu title. |
70 |
75 |
71 @return title of the menu |
76 @return title of the menu |
72 @rtype str |
77 @rtype str |
73 """ |
78 """ |
74 return self.tr("Strip") |
79 return self.tr("Strip") |
75 |
80 |
76 def __hgStrip(self): |
81 def __hgStrip(self): |
77 """ |
82 """ |
78 Private slot used to strip revisions from a repository. |
83 Private slot used to strip revisions from a repository. |
79 """ |
84 """ |
80 shouldReopen = self.vcs.getExtensionObject("strip").hgStrip( |
85 shouldReopen = self.vcs.getExtensionObject("strip").hgStrip( |
81 self.project.getProjectPath()) |
86 self.project.getProjectPath() |
|
87 ) |
82 if shouldReopen: |
88 if shouldReopen: |
83 res = EricMessageBox.yesNo( |
89 res = EricMessageBox.yesNo( |
84 None, |
90 None, |
85 self.tr("Strip"), |
91 self.tr("Strip"), |
86 self.tr("""The project should be reread. Do this now?"""), |
92 self.tr("""The project should be reread. Do this now?"""), |
87 yesDefault=True) |
93 yesDefault=True, |
|
94 ) |
88 if res: |
95 if res: |
89 self.project.reopenProject() |
96 self.project.reopenProject() |