Plugins/VcsPlugins/vcsMercurial/PurgeExtension/purge.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2791
a9577f248f04
parent 2962
d6c9d1ca2da4
child 3145
a9de05d4a22f
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
48 def __getEntries(self, repodir, all): 48 def __getEntries(self, repodir, all):
49 """ 49 """
50 Public method to get a list of files/directories being purged. 50 Public method to get a list of files/directories being purged.
51 51
52 @param repodir directory name of the repository (string) 52 @param repodir directory name of the repository (string)
53 @param all flag indicating to delete all files including ignored ones (boolean) 53 @param all flag indicating to delete all files including ignored ones
54 (boolean)
54 @return name of the current patch (string) 55 @return name of the current patch (string)
55 """ 56 """
56 purgeEntries = [] 57 purgeEntries = []
57 58
58 args = [] 59 args = []
84 def hgPurge(self, name, all=False): 85 def hgPurge(self, name, all=False):
85 """ 86 """
86 Public method to purge files and directories not tracked by Mercurial. 87 Public method to purge files and directories not tracked by Mercurial.
87 88
88 @param name file/directory name (string) 89 @param name file/directory name (string)
89 @param all flag indicating to delete all files including ignored ones (boolean) 90 @param all flag indicating to delete all files including ignored ones
91 (boolean)
90 """ 92 """
91 # find the root of the repo 93 # find the root of the repo
92 repodir = self.vcs.splitPath(name)[0] 94 repodir = self.vcs.splitPath(name)[0]
93 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): 95 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
94 repodir = os.path.dirname(repodir) 96 repodir = os.path.dirname(repodir)
95 if os.path.splitdrive(repodir)[1] == os.sep: 97 if os.path.splitdrive(repodir)[1] == os.sep:
96 return False 98 return
97 99
98 if all: 100 if all:
99 title = self.trUtf8("Purge All Files") 101 title = self.trUtf8("Purge All Files")
100 message = self.trUtf8("""Do really want to delete all files not tracked by""" 102 message = self.trUtf8(
101 """ Mercurial (including ignored ones)?""") 103 """Do really want to delete all files not tracked by"""
104 """ Mercurial (including ignored ones)?""")
102 else: 105 else:
103 title = self.trUtf8("Purge Files") 106 title = self.trUtf8("Purge Files")
104 message = self.trUtf8("""Do really want to delete files not tracked by""" 107 message = self.trUtf8(
105 """ Mercurial?""") 108 """Do really want to delete files not tracked by Mercurial?""")
106 entries = self.__getEntries(repodir, all) 109 entries = self.__getEntries(repodir, all)
107 from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog 110 from UI.DeleteFilesConfirmationDialog import \
111 DeleteFilesConfirmationDialog
108 dlg = DeleteFilesConfirmationDialog(None, title, message, entries) 112 dlg = DeleteFilesConfirmationDialog(None, title, message, entries)
109 if dlg.exec_() == QDialog.Accepted: 113 if dlg.exec_() == QDialog.Accepted:
110 args = [] 114 args = []
111 args.append("purge") 115 args.append("purge")
112 if all: 116 if all:
121 def hgPurgeList(self, name, all=False): 125 def hgPurgeList(self, name, all=False):
122 """ 126 """
123 Public method to list files and directories not tracked by Mercurial. 127 Public method to list files and directories not tracked by Mercurial.
124 128
125 @param name file/directory name (string) 129 @param name file/directory name (string)
126 @param all flag indicating to list all files including ignored ones (boolean) 130 @param all flag indicating to list all files including ignored ones
131 (boolean)
127 """ 132 """
128 # find the root of the repo 133 # find the root of the repo
129 repodir = self.vcs.splitPath(name)[0] 134 repodir = self.vcs.splitPath(name)[0]
130 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): 135 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
131 repodir = os.path.dirname(repodir) 136 repodir = os.path.dirname(repodir)
132 if os.path.splitdrive(repodir)[1] == os.sep: 137 if os.path.splitdrive(repodir)[1] == os.sep:
133 return False 138 return
134 139
135 entries = self.__getEntries(repodir, all) 140 entries = self.__getEntries(repodir, all)
136 from .HgPurgeListDialog import HgPurgeListDialog 141 from .HgPurgeListDialog import HgPurgeListDialog
137 self.purgeListDialog = HgPurgeListDialog(entries) 142 self.purgeListDialog = HgPurgeListDialog(entries)
138 self.purgeListDialog.show() 143 self.purgeListDialog.show()

eric ide

mercurial