26 @param vcs reference to the Mercurial vcs object |
24 @param vcs reference to the Mercurial vcs object |
27 @type Hg |
25 @type Hg |
28 """ |
26 """ |
29 super(Strip, self).__init__(vcs) |
27 super(Strip, self).__init__(vcs) |
30 |
28 |
31 def hgStrip(self, name, rev=""): |
29 def hgStrip(self, rev=""): |
32 """ |
30 """ |
33 Public method to strip revisions from a repository. |
31 Public method to strip revisions from a repository. |
34 |
32 |
35 @param name file/directory name |
|
36 @type str |
|
37 @param rev revision to strip from |
33 @param rev revision to strip from |
38 @type str |
34 @type str |
39 @return flag indicating that the project should be reread |
35 @return flag indicating that the project should be reread |
40 @rtype bool |
36 @rtype bool |
41 """ |
37 """ |
42 # find the root of the repo |
|
43 repodir = self.vcs.splitPath(name)[0] |
|
44 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
45 repodir = os.path.dirname(repodir) |
|
46 if os.path.splitdrive(repodir)[1] == os.sep: |
|
47 return False |
|
48 |
|
49 from .HgStripDialog import HgStripDialog |
38 from .HgStripDialog import HgStripDialog |
50 res = False |
39 res = False |
51 dlg = HgStripDialog(self.vcs.hgGetTagsList(repodir), |
40 dlg = HgStripDialog(self.vcs.hgGetTagsList(), |
52 self.vcs.hgGetBranchesList(repodir), |
41 self.vcs.hgGetBranchesList(), |
53 self.vcs.hgGetBookmarksList(repodir), |
42 self.vcs.hgGetBookmarksList(), |
54 rev) |
43 rev) |
55 if dlg.exec() == QDialog.Accepted: |
44 if dlg.exec() == QDialog.Accepted: |
56 rev, bookmark, force, noBackup, keep = dlg.getData() |
45 rev, bookmark, force, noBackup, keep = dlg.getData() |
57 |
46 |
58 args = self.vcs.initCommand("strip") |
47 args = self.vcs.initCommand("strip") |