diff -r 7c017076c12e -r 4cc6f121119a eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py --- a/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py Mon Sep 23 19:22:12 2019 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsPySvn/subversion.py Mon Sep 23 20:03:20 2019 +0200 @@ -13,8 +13,9 @@ import time from urllib.parse import quote -from PyQt5.QtCore import Qt, QMutexLocker, pyqtSignal, QRegExp, QDateTime, \ - QCoreApplication +from PyQt5.QtCore import ( + Qt, QMutexLocker, pyqtSignal, QRegExp, QDateTime, QCoreApplication +) from PyQt5.QtWidgets import QLineEdit, QDialog, QInputDialog, QApplication from E5Gui.E5Application import e5App @@ -85,8 +86,10 @@ self.commandHistory = [] self.wdHistory = [] - if pysvn.version >= (1, 4, 3, 0) and \ - "SVN_ASP_DOT_NET_HACK" in os.environ: + if ( + pysvn.version >= (1, 4, 3, 0) and + "SVN_ASP_DOT_NET_HACK" in os.environ + ): self.adminDir = '_svn' else: self.adminDir = '.svn' @@ -356,8 +359,10 @@ if tag is None or tag == '': svnUrl = '{0}/trunk'.format(vcsDir) else: - if not tag.startswith('tags') and \ - not tag.startswith('branches'): + if ( + not tag.startswith('tags') and + not tag.startswith('branches') + ): type_, ok = QInputDialog.getItem( None, self.tr("Subversion Checkout"), @@ -421,8 +426,10 @@ if tag is None or tag == '': svnUrl = '{0}/trunk'.format(vcsDir) else: - if not tag.startswith('tags') and \ - not tag.startswith('branches'): + if ( + not tag.startswith('tags') and + not tag.startswith('branches') + ): type_, ok = QInputDialog.getItem( None, self.tr("Subversion Export"), @@ -511,12 +518,11 @@ project = e5App().getObject("Project") if nam == project.getProjectPath(): ok &= project.checkAllScriptsDirty( - reportSyntaxErrors=True) and \ - project.checkDirty() + reportSyntaxErrors=True) and project.checkDirty() continue elif os.path.isfile(nam): - editor = e5App().getObject("ViewManager")\ - .getOpenEditor(nam) + editor = e5App().getObject("ViewManager").getOpenEditor( + nam) if editor: ok &= editor.checkDirty() if not ok: @@ -536,8 +542,9 @@ if self.__commitDialog is not None: msg = self.__commitDialog.logMessage() if self.__commitDialog.hasChangelists(): - changelists, keepChangelists = \ + changelists, keepChangelists = ( self.__commitDialog.changelistsData() + ) else: changelists, keepChangelists = [], False self.__commitDialog.deleteLater() @@ -554,8 +561,10 @@ dname, fname = self.splitPath(name) fnames = [fname] - if self.svnGetReposName(dname).startswith('http') or \ - self.svnGetReposName(dname).startswith('svn'): + if ( + self.svnGetReposName(dname).startswith('http') or + self.svnGetReposName(dname).startswith('svn') + ): noDialog = False locker = QMutexLocker(self.vcsExecutionMutex) @@ -674,10 +683,12 @@ repodir = os.path.dirname(repodir) if os.path.splitdrive(repodir)[1] == os.sep: return # oops, project is not version controlled - while os.path.normcase(dname) != os.path.normcase(repodir) and \ + while ( + os.path.normcase(dname) != os.path.normcase(repodir) and (os.path.normcase(dname) not in self.statusCache or self.statusCache[os.path.normcase(dname)] == - self.canBeAdded): + self.canBeAdded) + ): # add directories recursively, if they aren't in the # repository already tree.insert(-1, dname) @@ -703,12 +714,13 @@ repodir = os.path.dirname(repodir) if os.path.splitdrive(repodir)[1] == os.sep: return # oops, project is not version controlled - while (os.path.normcase(d) != - os.path.normcase(repodir)) and \ - (d not in tree2 + tree) and \ + while ( + (os.path.normcase(d) != os.path.normcase(repodir)) and + (d not in tree2 + tree) and (os.path.normcase(d) not in self.statusCache or self.statusCache[os.path.normcase(d)] == - self.canBeAdded): + self.canBeAdded) + ): tree2.append(d) d = os.path.dirname(d) else: @@ -783,12 +795,13 @@ repodir = os.path.dirname(repodir) if os.path.splitdrive(repodir)[1] == os.sep: return # oops, project is not version controlled - while (os.path.normcase(d) != - os.path.normcase(repodir)) and \ - (d not in tree) and \ + while ( + (os.path.normcase(d) != os.path.normcase(repodir)) and + (d not in tree) and (os.path.normcase(d) not in self.statusCache or self.statusCache[os.path.normcase(d)] == - self.canBeAdded): + self.canBeAdded) + ): tree.append(d) d = os.path.dirname(d) else: @@ -808,11 +821,12 @@ repodir = os.path.dirname(repodir) if os.path.splitdrive(repodir)[1] == os.sep: return # oops, project is not version controlled - while (os.path.normcase(dname) != - os.path.normcase(repodir)) and \ + while ( + (os.path.normcase(dname) != os.path.normcase(repodir)) and (os.path.normcase(dname) not in self.statusCache or self.statusCache[os.path.normcase(dname)] == - self.canBeAdded): + self.canBeAdded) + ): # add directories recursively, if they aren't in the # repository already tree.insert(-1, dname) @@ -942,14 +956,13 @@ log = "" target = target if not noDialog: - dlg = \ - SvnDialog( - self.tr('Moving {0}').format(name), - "move{0}{1} {2} {3}".format( - force and " --force" or "", - log and (" --message {0}".format(log)) or "", - name, target), - client, log=log) + dlg = SvnDialog( + self.tr('Moving {0}').format(name), + "move{0}{1} {2} {3}".format( + force and " --force" or "", + log and (" --message {0}".format(log)) or "", + name, target), + client, log=log) QApplication.processEvents() locker = QMutexLocker(self.vcsExecutionMutex) try: @@ -1131,8 +1144,9 @@ project = e5App().getObject("Project") names = [project.getRelativePath(nam) for nam in name] if names[0]: - from UI.DeleteFilesConfirmationDialog import \ + from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog + ) dia = DeleteFilesConfirmationDialog( self.parent(), self.tr("Revert changes"), @@ -1330,16 +1344,15 @@ revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified) rev2 = "" client = self.getClient() - dlg = \ - SvnDialog( - self.tr('Merging {0}').format(name), - "merge{0}{1} {2} {3} {4}".format( - (not recurse) and " --non-recursive" or "", - force and " --force" or "", - "{0}{1}".format(url1, rev1 and ("@" + rev1) or ""), - "{0}{1}".format(url2, rev2 and ("@" + rev2) or ""), - fname), - client) + dlg = SvnDialog( + self.tr('Merging {0}').format(name), + "merge{0}{1} {2} {3} {4}".format( + (not recurse) and " --non-recursive" or "", + force and " --force" or "", + "{0}{1}".format(url1, rev1 and ("@" + rev1) or ""), + "{0}{1}".format(url2, rev2 and ("@" + rev2) or ""), + fname), + client) QApplication.processEvents() try: client.merge(url1, revision1, url2, revision2, fname, @@ -1477,10 +1490,10 @@ from .SvnDialogMixin import SvnDialogMixin mixin = SvnDialogMixin() client = self.getClient() - client.callback_get_login = \ - mixin._clientLoginCallback - client.callback_ssl_server_trust_prompt = \ + client.callback_get_login = mixin._clientLoginCallback + client.callback_ssl_server_trust_prompt = ( mixin._clientSslServerTrustPromptCallback + ) try: locker = QMutexLocker(self.vcsExecutionMutex) @@ -1495,11 +1508,16 @@ if name in names: names[name] = self.canBeCommitted dn = name - while os.path.splitdrive(dn)[1] != os.sep and \ - dn != repodir: + while ( + os.path.splitdrive(dn)[1] != os.sep and + dn != repodir + ): dn = os.path.dirname(dn) - if dn in self.statusCache and \ - self.statusCache[dn] == self.canBeCommitted: + if ( + dn in self.statusCache and + self.statusCache[dn] == + self.canBeCommitted + ): break self.statusCache[dn] = self.canBeCommitted self.statusCache[name] = self.canBeCommitted @@ -1553,10 +1571,10 @@ from .SvnDialogMixin import SvnDialogMixin mixin = SvnDialogMixin() client = self.getClient() - client.callback_get_login = \ - mixin._clientLoginCallback - client.callback_ssl_server_trust_prompt = \ + client.callback_get_login = mixin._clientLoginCallback + client.callback_ssl_server_trust_prompt = ( mixin._clientSslServerTrustPromptCallback + ) try: locker = QMutexLocker(self.vcsExecutionMutex) @@ -1669,8 +1687,9 @@ args = [] self.addArguments(args, commandList) - from Plugins.VcsPlugins.vcsSubversion.SvnDialog import \ + from Plugins.VcsPlugins.vcsSubversion.SvnDialog import ( SvnDialog as SvnProcessDialog + ) dia = SvnProcessDialog(self.tr('Subversion command')) res = dia.startProcess(args, wd) if res: @@ -1736,18 +1755,18 @@ """<tr><td><b>Comitted time</b></td><td>{7}</td></tr>""" """<tr><td><b>Last author</b></td><td>{8}</td></tr>""" """</table>""" - )\ - .format(".".join([str(v) for v in pysvn.version]), - ".".join([str(v) for v in pysvn.svn_version[:3]]), - apiVersion, - entry.url, - entry.revision.number, - entry.commit_revision.number, - time.strftime( - "%Y-%m-%d", time.localtime(entry.commit_time)), - hmsz, - entry.commit_author - ) + ).format( + ".".join([str(v) for v in pysvn.version]), + ".".join([str(v) for v in pysvn.svn_version[:3]]), + apiVersion, + entry.url, + entry.revision.number, + entry.commit_revision.number, + time.strftime( + "%Y-%m-%d", time.localtime(entry.commit_time)), + hmsz, + entry.commit_author + ) ########################################################################### ## Public Subversion specific methods are below. @@ -1828,13 +1847,12 @@ else: log = "" target = target - dlg = \ - SvnDialog( - self.tr('Copying {0}').format(name), - "copy{0} {1} {2}".format( - log and (" --message {0}".format(log)) or "", - name, target), - client, log=log) + dlg = SvnDialog( + self.tr('Copying {0}').format(name), + "copy{0} {1} {2}".format( + log and (" --message {0}".format(log)) or "", + name, target), + client, log=log) QApplication.processEvents() locker = QMutexLocker(self.vcsExecutionMutex) try: @@ -1846,9 +1864,11 @@ locker.unlock() dlg.finish() dlg.exec_() - if res and \ - not rx_prot.exactMatch(target) and \ - target.startswith(project.getProjectPath()): + if ( + res and + not rx_prot.exactMatch(target) and + target.startswith(project.getProjectPath()) + ): if os.path.isdir(name): project.copyDirectory(name, target) else: @@ -1901,15 +1921,14 @@ opts = self.options['global'] skipchecks = "--skip-checks" in opts client = self.getClient() - dlg = \ - SvnDialog( - self.tr('Subversion Set Property'), - "propset{0}{1} {2} {3} {4}".format( - recurse and " --recurse" or "", - skipchecks and " --skip-checks" or "", - propName, propValue, - " ".join(fnames)), - client) + dlg = SvnDialog( + self.tr('Subversion Set Property'), + "propset{0}{1} {2} {3} {4}".format( + recurse and " --recurse" or "", + skipchecks and " --skip-checks" or "", + propName, propValue, + " ".join(fnames)), + client) QApplication.processEvents() try: for name in fnames: @@ -1955,14 +1974,13 @@ opts = self.options['global'] skipchecks = "--skip-checks" in opts client = self.getClient() - dlg = \ - SvnDialog( - self.tr('Subversion Delete Property'), - "propdel{0}{1} {2} {3}".format( - recurse and " --recurse" or "", - skipchecks and " --skip-checks" or "", - propName, " ".join(fnames)), - client) + dlg = SvnDialog( + self.tr('Subversion Delete Property'), + "propdel{0}{1} {2} {3}".format( + recurse and " --recurse" or "", + skipchecks and " --skip-checks" or "", + propName, " ".join(fnames)), + client) QApplication.processEvents() try: for name in fnames: @@ -1995,14 +2013,18 @@ if tags: self.tagsList = self.tagbranchList.getTagList() if not self.showedTags: - self.allTagsBranchesList = \ - self.allTagsBranchesList + self.tagsList + self.allTagsBranchesList = ( + self.allTagsBranchesList + + self.tagsList + ) self.showedTags = True elif not tags: self.branchesList = self.tagbranchList.getTagList() if not self.showedBranches: - self.allTagsBranchesList = \ - self.allTagsBranchesList + self.branchesList + self.allTagsBranchesList = ( + self.allTagsBranchesList + + self.branchesList + ) self.showedBranches = True def svnBlame(self, name): @@ -2258,14 +2280,13 @@ cwd = os.getcwd() os.chdir(dname) client = self.getClient() - dlg = \ - SvnDialog( - self.tr('Locking in the Subversion repository'), - "lock{0}{1} {2}".format( - stealIt and " --force" or "", - comment and (" --message {0}".format(comment)) or "", - " ".join(fnames)), - client, parent=parent) + dlg = SvnDialog( + self.tr('Locking in the Subversion repository'), + "lock{0}{1} {2}".format( + stealIt and " --force" or "", + comment and (" --message {0}".format(comment)) or "", + " ".join(fnames)), + client, parent=parent) QApplication.processEvents() try: client.lock(fnames, comment, force=stealIt) @@ -2298,13 +2319,11 @@ cwd = os.getcwd() os.chdir(dname) client = self.getClient() - dlg = \ - SvnDialog( - self.tr('Unlocking in the Subversion repository'), - "unlock{0} {1}".format( - breakIt and " --force" or "", - " ".join(fnames)), - client, parent=parent) + dlg = SvnDialog( + self.tr('Unlocking in the Subversion repository'), + "unlock{0} {1}".format(breakIt and " --force" or "", + " ".join(fnames)), + client, parent=parent) QApplication.processEvents() try: client.unlock(fnames, force=breakIt) @@ -2346,8 +2365,7 @@ msg = "relocate {0} {1} {2}".format(currUrl, newUrl, projectPath) client = self.getClient() - dlg = \ - SvnDialog(self.tr('Relocating'), msg, client) + dlg = SvnDialog(self.tr('Relocating'), msg, client) QApplication.processEvents() locker = QMutexLocker(self.vcsExecutionMutex) try: @@ -2400,10 +2418,10 @@ if not isinstance(names, list): names = [names] client = self.getClient() - dlg = \ - SvnDialog(self.tr('Remove from changelist'), - "changelist --remove {0}".format(" ".join(names)), - client) + dlg = SvnDialog( + self.tr('Remove from changelist'), + "changelist --remove {0}".format(" ".join(names)), + client) QApplication.processEvents() locker = QMutexLocker(self.vcsExecutionMutex) try: @@ -2437,10 +2455,10 @@ return client = self.getClient() - dlg = \ - SvnDialog(self.tr('Add to changelist'), - "changelist {0}".format(" ".join(names)), - client) + dlg = SvnDialog( + self.tr('Add to changelist'), + "changelist {0}".format(" ".join(names)), + client) QApplication.processEvents() locker = QMutexLocker(self.vcsExecutionMutex) try: @@ -2496,10 +2514,10 @@ @param path directory name to show change lists for (string) """ client = self.getClient() - dlg = \ - SvnDialog(self.tr('Upgrade'), - "upgrade {0}".format(path), - client) + dlg = SvnDialog( + self.tr('Upgrade'), + "upgrade {0}".format(path), + client) QApplication.processEvents() locker = QMutexLocker(self.vcsExecutionMutex) try: @@ -2590,15 +2608,16 @@ """ helper = self.__plugin.getProjectHelper() helper.setObjects(self, project) - self.__wcng = \ + self.__wcng = ( os.path.exists( - os.path.join(project.getProjectPath(), ".svn", "format")) or \ + os.path.join(project.getProjectPath(), ".svn", "format")) or os.path.exists( - os.path.join(project.getProjectPath(), "_svn", "format")) or \ + os.path.join(project.getProjectPath(), "_svn", "format")) or os.path.exists( - os.path.join(project.getProjectPath(), ".svn", "wc.db")) or \ + os.path.join(project.getProjectPath(), ".svn", "wc.db")) or os.path.exists( os.path.join(project.getProjectPath(), "_svn", "wc.db")) + ) return helper ###########################################################################