15 |
15 |
16 class Strip(HgExtension): |
16 class Strip(HgExtension): |
17 """ |
17 """ |
18 Class implementing the strip extension interface. |
18 Class implementing the strip extension interface. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, vcs): |
21 def __init__(self, vcs): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param vcs reference to the Mercurial vcs object |
25 @param vcs reference to the Mercurial vcs object |
25 @type Hg |
26 @type Hg |
26 """ |
27 """ |
27 super().__init__(vcs) |
28 super().__init__(vcs) |
28 |
29 |
29 def hgStrip(self, rev=""): |
30 def hgStrip(self, rev=""): |
30 """ |
31 """ |
31 Public method to strip revisions from a repository. |
32 Public method to strip revisions from a repository. |
32 |
33 |
33 @param rev revision to strip from |
34 @param rev revision to strip from |
34 @type str |
35 @type str |
35 @return flag indicating that the project should be reread |
36 @return flag indicating that the project should be reread |
36 @rtype bool |
37 @rtype bool |
37 """ |
38 """ |
38 from .HgStripDialog import HgStripDialog |
39 from .HgStripDialog import HgStripDialog |
|
40 |
39 res = False |
41 res = False |
40 dlg = HgStripDialog(self.vcs.hgGetTagsList(), |
42 dlg = HgStripDialog( |
41 self.vcs.hgGetBranchesList(), |
43 self.vcs.hgGetTagsList(), |
42 self.vcs.hgGetBookmarksList(), |
44 self.vcs.hgGetBranchesList(), |
43 rev) |
45 self.vcs.hgGetBookmarksList(), |
|
46 rev, |
|
47 ) |
44 if dlg.exec() == QDialog.DialogCode.Accepted: |
48 if dlg.exec() == QDialog.DialogCode.Accepted: |
45 rev, bookmark, force, noBackup, keep = dlg.getData() |
49 rev, bookmark, force, noBackup, keep = dlg.getData() |
46 |
50 |
47 args = self.vcs.initCommand("strip") |
51 args = self.vcs.initCommand("strip") |
48 if bookmark: |
52 if bookmark: |
49 args.append("--bookmark") |
53 args.append("--bookmark") |
50 args.append(bookmark) |
54 args.append(bookmark) |
51 if force: |
55 if force: |
54 args.append("--no-backup") |
58 args.append("--no-backup") |
55 if keep: |
59 if keep: |
56 args.append("--keep") |
60 args.append("--keep") |
57 args.append("-v") |
61 args.append("-v") |
58 args.append(rev) |
62 args.append(rev) |
59 |
63 |
60 dia = HgDialog( |
64 dia = HgDialog(self.tr("Stripping changesets from repository"), self.vcs) |
61 self.tr("Stripping changesets from repository"), |
|
62 self.vcs) |
|
63 res = dia.startProcess(args) |
65 res = dia.startProcess(args) |
64 if res: |
66 if res: |
65 dia.exec() |
67 dia.exec() |
66 res = dia.hasAddOrDelete() |
68 res = dia.hasAddOrDelete() |
67 self.vcs.checkVCSStatus() |
69 self.vcs.checkVCSStatus() |