42 def __getEntries(self, repodir, all): |
42 def __getEntries(self, repodir, all): |
43 """ |
43 """ |
44 Public method to get a list of files/directories being purged. |
44 Public method to get a list of files/directories being purged. |
45 |
45 |
46 @param repodir directory name of the repository (string) |
46 @param repodir directory name of the repository (string) |
47 @param all flag indicating to delete all files including ignored ones (boolean) |
47 @param all flag indicating to delete all files including ignored ones |
|
48 (boolean) |
48 @return name of the current patch (string) |
49 @return name of the current patch (string) |
49 """ |
50 """ |
50 purgeEntries = [] |
51 purgeEntries = [] |
51 |
52 |
52 args = [] |
53 args = [] |
78 def hgPurge(self, name, all=False): |
79 def hgPurge(self, name, all=False): |
79 """ |
80 """ |
80 Public method to purge files and directories not tracked by Mercurial. |
81 Public method to purge files and directories not tracked by Mercurial. |
81 |
82 |
82 @param name file/directory name (string) |
83 @param name file/directory name (string) |
83 @param all flag indicating to delete all files including ignored ones (boolean) |
84 @param all flag indicating to delete all files including ignored ones |
|
85 (boolean) |
84 """ |
86 """ |
85 # find the root of the repo |
87 # find the root of the repo |
86 repodir = self.vcs.splitPath(name)[0] |
88 repodir = self.vcs.splitPath(name)[0] |
87 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
89 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
88 repodir = os.path.dirname(repodir) |
90 repodir = os.path.dirname(repodir) |
89 if os.path.splitdrive(repodir)[1] == os.sep: |
91 if os.path.splitdrive(repodir)[1] == os.sep: |
90 return False |
92 return |
91 |
93 |
92 if all: |
94 if all: |
93 title = self.trUtf8("Purge All Files") |
95 title = self.trUtf8("Purge All Files") |
94 message = self.trUtf8("""Do really want to delete all files not tracked by""" |
96 message = self.trUtf8( |
95 """ Mercurial (including ignored ones)?""") |
97 """Do really want to delete all files not tracked by""" |
|
98 """ Mercurial (including ignored ones)?""") |
96 else: |
99 else: |
97 title = self.trUtf8("Purge Files") |
100 title = self.trUtf8("Purge Files") |
98 message = self.trUtf8("""Do really want to delete files not tracked by""" |
101 message = self.trUtf8( |
99 """ Mercurial?""") |
102 """Do really want to delete files not tracked by Mercurial?""") |
100 entries = self.__getEntries(repodir, all) |
103 entries = self.__getEntries(repodir, all) |
101 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
104 from UI.DeleteFilesConfirmationDialog import \ |
|
105 DeleteFilesConfirmationDialog |
102 dlg = DeleteFilesConfirmationDialog(None, title, message, entries) |
106 dlg = DeleteFilesConfirmationDialog(None, title, message, entries) |
103 if dlg.exec_() == QDialog.Accepted: |
107 if dlg.exec_() == QDialog.Accepted: |
104 args = [] |
108 args = [] |
105 args.append("purge") |
109 args.append("purge") |
106 if all: |
110 if all: |
115 def hgPurgeList(self, name, all=False): |
119 def hgPurgeList(self, name, all=False): |
116 """ |
120 """ |
117 Public method to list files and directories not tracked by Mercurial. |
121 Public method to list files and directories not tracked by Mercurial. |
118 |
122 |
119 @param name file/directory name (string) |
123 @param name file/directory name (string) |
120 @param all flag indicating to list all files including ignored ones (boolean) |
124 @param all flag indicating to list all files including ignored ones |
|
125 (boolean) |
121 """ |
126 """ |
122 # find the root of the repo |
127 # find the root of the repo |
123 repodir = self.vcs.splitPath(name)[0] |
128 repodir = self.vcs.splitPath(name)[0] |
124 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
129 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
125 repodir = os.path.dirname(repodir) |
130 repodir = os.path.dirname(repodir) |
126 if os.path.splitdrive(repodir)[1] == os.sep: |
131 if os.path.splitdrive(repodir)[1] == os.sep: |
127 return False |
132 return |
128 |
133 |
129 entries = self.__getEntries(repodir, all) |
134 entries = self.__getEntries(repodir, all) |
130 from .HgPurgeListDialog import HgPurgeListDialog |
135 from .HgPurgeListDialog import HgPurgeListDialog |
131 self.purgeListDialog = HgPurgeListDialog(entries) |
136 self.purgeListDialog = HgPurgeListDialog(entries) |
132 self.purgeListDialog.show() |
137 self.purgeListDialog.show() |