--- a/eric6/Plugins/VcsPlugins/vcsMercurial/PurgeExtension/purge.py Tue Jan 12 20:03:30 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/PurgeExtension/purge.py Wed Jan 13 17:46:13 2021 +0100 @@ -7,8 +7,6 @@ Module implementing the purge extension interface. """ -import os - from PyQt5.QtWidgets import QDialog from ..HgExtension import HgExtension @@ -36,14 +34,15 @@ if self.purgeListDialog is not None: self.purgeListDialog.close() - def __getEntries(self, repodir, deleteAll): + def __getEntries(self, deleteAll): """ Private method to get a list of files/directories being purged. - @param repodir directory name of the repository (string) @param deleteAll flag indicating to delete all files including ignored - ones (boolean) - @return name of the current patch (string) + ones + @type bool + @return name of the current patch + @rtype str """ purgeEntries = [] @@ -59,21 +58,14 @@ return purgeEntries - def hgPurge(self, name, deleteAll=False): + def hgPurge(self, deleteAll=False): """ Public method to purge files and directories not tracked by Mercurial. - @param name file/directory name (string) @param deleteAll flag indicating to delete all files including ignored - ones (boolean) + ones + @type bool """ - # find the root of the repo - repodir = self.vcs.splitPath(name)[0] - while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): - repodir = os.path.dirname(repodir) - if os.path.splitdrive(repodir)[1] == os.sep: - return - if deleteAll: title = self.tr("Purge All Files") message = self.tr( @@ -83,7 +75,7 @@ title = self.tr("Purge Files") message = self.tr( """Do really want to delete files not tracked by Mercurial?""") - entries = self.__getEntries(repodir, deleteAll) + entries = self.__getEntries(deleteAll) from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog ) @@ -95,26 +87,18 @@ args.append("-v") dia = HgDialog(title, self.vcs) - res = dia.startProcess(args, repodir) + res = dia.startProcess(args) if res: dia.exec() - def hgPurgeList(self, name, deleteAll=False): + def hgPurgeList(self, deleteAll=False): """ Public method to list files and directories not tracked by Mercurial. - @param name file/directory name (string) @param deleteAll flag indicating to list all files including ignored ones (boolean) """ - # find the root of the repo - repodir = self.vcs.splitPath(name)[0] - while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): - repodir = os.path.dirname(repodir) - if os.path.splitdrive(repodir)[1] == os.sep: - return - - entries = self.__getEntries(repodir, deleteAll) + entries = self.__getEntries(deleteAll) from .HgPurgeListDialog import HgPurgeListDialog self.purgeListDialog = HgPurgeListDialog(entries) self.purgeListDialog.show()