15 |
15 |
16 from ..HgExtension import HgExtension |
16 from ..HgExtension import HgExtension |
17 from ..HgDialog import HgDialog |
17 from ..HgDialog import HgDialog |
18 |
18 |
19 |
19 |
20 # TODO: add strip support to the log browser |
|
21 class Strip(HgExtension): |
20 class Strip(HgExtension): |
22 """ |
21 """ |
23 Class implementing the strip extension interface. |
22 Class implementing the strip extension interface. |
24 """ |
23 """ |
25 def __init__(self, vcs): |
24 def __init__(self, vcs): |
26 """ |
25 """ |
27 Constructor |
26 Constructor |
28 |
27 |
29 @param vcs reference to the Mercurial vcs object |
28 @param vcs reference to the Mercurial vcs object |
|
29 @type Hg |
30 """ |
30 """ |
31 super(Strip, self).__init__(vcs) |
31 super(Strip, self).__init__(vcs) |
32 |
32 |
33 def hgStrip(self, name): |
33 def hgStrip(self, name, rev=""): |
34 """ |
34 """ |
35 Public method to strip revisions from a repository. |
35 Public method to strip revisions from a repository. |
36 |
36 |
37 @param name file/directory name (string) |
37 @param name file/directory name |
38 @return flag indicating that the project should be reread (boolean) |
38 @type str |
|
39 @keyparam rev revision to strip from |
|
40 @type str |
|
41 @return flag indicating that the project should be reread |
|
42 @rtype bool |
39 """ |
43 """ |
40 # find the root of the repo |
44 # find the root of the repo |
41 repodir = self.vcs.splitPath(name)[0] |
45 repodir = self.vcs.splitPath(name)[0] |
42 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
46 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
43 repodir = os.path.dirname(repodir) |
47 repodir = os.path.dirname(repodir) |
46 |
50 |
47 from .HgStripDialog import HgStripDialog |
51 from .HgStripDialog import HgStripDialog |
48 res = False |
52 res = False |
49 dlg = HgStripDialog(self.vcs.hgGetTagsList(repodir), |
53 dlg = HgStripDialog(self.vcs.hgGetTagsList(repodir), |
50 self.vcs.hgGetBranchesList(repodir), |
54 self.vcs.hgGetBranchesList(repodir), |
51 self.vcs.hgGetBookmarksList(repodir)) |
55 self.vcs.hgGetBookmarksList(repodir), |
|
56 rev) |
52 if dlg.exec_() == QDialog.Accepted: |
57 if dlg.exec_() == QDialog.Accepted: |
53 rev, bookmark, force, noBackup, keep = dlg.getData() |
58 rev, bookmark, force, noBackup, keep = dlg.getData() |
54 |
59 |
55 args = self.vcs.initCommand("strip") |
60 args = self.vcs.initCommand("strip") |
56 if bookmark: |
61 if bookmark: |