--- a/Plugins/VcsPlugins/vcsSubversion/subversion.py Sat Oct 12 15:01:28 2013 +0200 +++ b/Plugins/VcsPlugins/vcsSubversion/subversion.py Sat Oct 12 17:31:40 2013 +0200 @@ -97,14 +97,16 @@ self.repoBrowser = None # regular expression object for evaluation of the status output - self.rx_status1 = QRegExp('(.{8})\\s+([0-9-]+)\\s+([0-9?]+)\\s+([\\w?]+)\\s+(.+)') + self.rx_status1 = QRegExp( + '(.{8})\\s+([0-9-]+)\\s+([0-9?]+)\\s+([\\w?]+)\\s+(.+)') self.rx_status2 = QRegExp('(.{8})\\s+(.+)\\s*') self.statusCache = {} self.__commitData = {} self.__commitDialog = None - self.__wcng = True # assume new generation working copy metadata format + self.__wcng = True # assume new generation working copy + # metadata format def getPlugin(self): """ @@ -139,7 +141,8 @@ """ Public method used to test for the presence of the svn executable. - @return flag indicating the existance (boolean) and an error message (string) + @return flag indicating the existance (boolean) and an error message + (string) """ self.versionStr = '' errMsg = "" @@ -154,7 +157,8 @@ output = \ str(process.readAllStandardOutput(), ioEncoding, 'replace') self.versionStr = output.split()[2] - v = list(re.match(r'.*?(\d+)\.(\d+)\.?(\d+)?', self.versionStr).groups()) + v = list(re.match(r'.*?(\d+)\.(\d+)\.?(\d+)?', self.versionStr) + .groups()) for i in range(3): try: v[i] = int(v[i]) @@ -166,11 +170,12 @@ return True, errMsg else: if finished: - errMsg = \ - self.trUtf8("The svn process finished with the exit code {0}")\ + errMsg = self.trUtf8( + "The svn process finished with the exit code {0}")\ .format(process.exitCode()) else: - errMsg = self.trUtf8("The svn process did not finish within 30s.") + errMsg = self.trUtf8( + "The svn process did not finish within 30s.") else: errMsg = self.trUtf8("Could not start the svn executable.") @@ -192,7 +197,8 @@ def vcsConvertProject(self, vcsDataDict, project): """ - Public method to convert an uncontrolled project to a version controlled project. + Public method to convert an uncontrolled project to a version + controlled project. @param vcsDataDict dictionary of data required for the conversion @param project reference to the project object @@ -201,9 +207,10 @@ if not success: E5MessageBox.critical(self.__ui, self.trUtf8("Create project in repository"), - self.trUtf8("""The project could not be created in the repository.""" - """ Maybe the given repository doesn't exist or the""" - """ repository server is down.""")) + self.trUtf8( + """The project could not be created in the repository.""" + """ Maybe the given repository doesn't exist or the""" + """ repository server is down.""")) else: cwdIsPpath = False if os.getcwd() == project.ppath: @@ -223,9 +230,10 @@ if not os.path.isfile(pfn): E5MessageBox.critical(self.__ui, self.trUtf8("New project"), - self.trUtf8("""The project could not be checked out of the""" - """ repository.<br />""" - """Restoring the original contents.""")) + self.trUtf8( + """The project could not be checked out of the""" + """ repository.<br />""" + """Restoring the original contents.""")) if os.getcwd() == project.ppath: os.chdir(os.path.dirname(project.ppath)) cwdIsPpath = True @@ -245,7 +253,8 @@ def vcsImport(self, vcsDataDict, projectDir, noDialog=False): """ - Public method used to import the project into the Subversion repository. + Public method used to import the project into the Subversion + repository. @param vcsDataDict dictionary of data required for the import @param projectDir project directory (string) @@ -274,7 +283,8 @@ os.mkdir(os.path.join(tmpDir, project)) os.mkdir(os.path.join(tmpDir, project, 'branches')) os.mkdir(os.path.join(tmpDir, project, 'tags')) - shutil.copytree(projectDir, os.path.join(tmpDir, project, 'trunk')) + shutil.copytree( + projectDir, os.path.join(tmpDir, project, 'trunk')) else: shutil.copytree(projectDir, os.path.join(tmpDir, project)) except OSError: @@ -293,7 +303,8 @@ status = self.startSynchronizedProcess(QProcess(), "svn", args, os.path.join(tmpDir, project)) else: - dia = SvnDialog(self.trUtf8('Importing project into Subversion repository')) + dia = SvnDialog( + self.trUtf8('Importing project into Subversion repository')) res = dia.startProcess(args, os.path.join(tmpDir, project)) if res: dia.exec_() @@ -304,7 +315,8 @@ def vcsCheckout(self, vcsDataDict, projectDir, noDialog=False): """ - Public method used to check the project out of the Subversion repository. + Public method used to check the project out of the Subversion + repository. @param vcsDataDict dictionary of data required for the checkout @param projectDir project directory to create (string) @@ -326,7 +338,8 @@ 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.trUtf8("Subversion Checkout"), @@ -352,7 +365,8 @@ if noDialog: return self.startSynchronizedProcess(QProcess(), 'svn', args) else: - dia = SvnDialog(self.trUtf8('Checking project out of Subversion repository')) + dia = SvnDialog( + self.trUtf8('Checking project out of Subversion repository')) res = dia.startProcess(args) if res: dia.exec_() @@ -360,7 +374,8 @@ def vcsExport(self, vcsDataDict, projectDir): """ - Public method used to export a directory from the Subversion repository. + Public method used to export a directory from the Subversion + repository. @param vcsDataDict dictionary of data required for the checkout @param projectDir project directory to create (string) @@ -378,7 +393,8 @@ 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.trUtf8("Subversion Export"), @@ -401,7 +417,8 @@ args.append(self.__svnURL(svnUrl)) args.append(projectDir) - dia = SvnDialog(self.trUtf8('Exporting project from Subversion repository')) + dia = SvnDialog( + self.trUtf8('Exporting project from Subversion repository')) res = dia.startProcess(args) if res: dia.exec_() @@ -409,10 +426,11 @@ def vcsCommit(self, name, message, noDialog=False): """ - Public method used to make the change of a file/directory permanent in the - Subversion repository. + Public method used to make the change of a file/directory permanent + in the Subversion repository. - @param name file/directory name to be committed (string or list of strings) + @param name file/directory name to be committed (string or list of + strings) @param message message for this operation (string) @param noDialog flag indicating quiet operations """ @@ -455,11 +473,13 @@ if os.path.isdir(nam): project = e5App().getObject("Project") if nam == project.getProjectPath(): - ok &= project.checkAllScriptsDirty(reportSyntaxErrors=True) and \ - project.checkDirty() + ok &= project.checkAllScriptsDirty( + 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: @@ -468,8 +488,9 @@ if not ok: res = E5MessageBox.yesNo(self.__ui, self.trUtf8("Commit Changes"), - self.trUtf8("""The commit affects files, that have unsaved""" - """ changes. Shall the commit be continued?"""), + self.trUtf8( + """The commit affects files, that have unsaved""" + """ changes. Shall the commit be continued?"""), icon=E5MessageBox.Warning) if not res: return @@ -477,10 +498,10 @@ if self.__commitDialog is not None: msg = self.__commitDialog.logMessage() if self.__commitDialog.hasChangelists(): - changelists, keepChangelists = self.__commitDialog.changelistsData() + changelists, keepChangelists = \ + self.__commitDialog.changelistsData() else: changelists, keepChangelists = [], False -## self.__commitDialog.accepted.disconnect(self.__vcsCommit_Step2) self.__commitDialog.deleteLater() self.__commitDialog = None else: @@ -514,7 +535,8 @@ if noDialog: self.startSynchronizedProcess(QProcess(), "svn", args, dname) else: - dia = SvnDialog(self.trUtf8('Commiting changes to Subversion repository')) + dia = SvnDialog( + self.trUtf8('Commiting changes to Subversion repository')) res = dia.startProcess(args, dname) if res: dia.exec_() @@ -523,9 +545,11 @@ def vcsUpdate(self, name, noDialog=False): """ - Public method used to update a file/directory with the Subversion repository. + Public method used to update a file/directory with the Subversion + repository. - @param name file/directory name to be updated (string or list of strings) + @param name file/directory name to be updated (string or list of + strings) @param noDialog flag indicating quiet operations (boolean) @return flag indicating, that the update contained an add or delete (boolean) @@ -548,7 +572,8 @@ self.startSynchronizedProcess(QProcess(), "svn", args, dname) res = False else: - dia = SvnDialog(self.trUtf8('Synchronizing with the Subversion repository')) + dia = SvnDialog( + self.trUtf8('Synchronizing with the Subversion repository')) res = dia.startProcess(args, dname, True) if res: dia.exec_() @@ -558,7 +583,8 @@ def vcsAdd(self, name, isDir=False, noDialog=False): """ - Public method used to add a file/directory to the Subversion repository. + Public method used to add a file/directory to the Subversion + repository. @param name file/directory name to be added (string) @param isDir flag indicating name is a directory (boolean) @@ -591,15 +617,18 @@ 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 \ - (os.path.normcase(dname) not in self.statusCache or \ - self.statusCache[os.path.normcase(dname)] == self.canBeAdded): - # add directories recursively, if they aren't in the repository already + (os.path.normcase(dname) not in self.statusCache or \ + self.statusCache[os.path.normcase(dname)] == + self.canBeAdded): + # add directories recursively, if they aren't in the + # repository already tree.insert(-1, dname) dname = os.path.dirname(dname) wdir = dname else: while not os.path.exists(os.path.join(dname, self.adminDir)): - # add directories recursively, if they aren't in the repository already + # add directories recursively, if they aren't in the + # repository already tree.insert(-1, dname) dname = os.path.dirname(dname) wdir = dname @@ -611,14 +640,17 @@ d = os.path.dirname(n) if self.__wcng: repodir = d - while not os.path.isdir(os.path.join(repodir, self.adminDir)): + while not os.path.isdir( + os.path.join(repodir, self.adminDir)): 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 \ - (os.path.normcase(d) not in self.statusCache or \ - self.statusCache[os.path.normcase(d)] == self.canBeAdded): + 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): tree2.append(d) d = os.path.dirname(d) else: @@ -637,7 +669,8 @@ self.startSynchronizedProcess(QProcess(), "svn", args, wdir) else: dia = SvnDialog( - self.trUtf8('Adding files/directories to the Subversion repository')) + self.trUtf8('Adding files/directories to the Subversion' + ' repository')) res = dia.startProcess(args, wdir) if res: dia.exec_() @@ -654,9 +687,11 @@ def vcsAddTree(self, path): """ - Public method to add a directory tree rooted at path to the Subversion repository. + Public method to add a directory tree rooted at path to the Subversion + repository. - @param path root directory of the tree to be added (string or list of strings)) + @param path root directory of the tree to be added (string or list of + strings)) """ args = [] args.append('add') @@ -670,14 +705,17 @@ d = os.path.dirname(n) if self.__wcng: repodir = d - while not os.path.isdir(os.path.join(repodir, self.adminDir)): + while not os.path.isdir( + os.path.join(repodir, self.adminDir)): 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 \ - (os.path.normcase(d) not in self.statusCache or \ - self.statusCache[os.path.normcase(d)] == self.canBeAdded): + 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): tree.append(d) d = os.path.dirname(d) else: @@ -697,10 +735,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(dname) != os.path.normcase(repodir) and \ - (os.path.normcase(dname) not in self.statusCache or \ - self.statusCache[os.path.normcase(dname)] == self.canBeAdded): - # add directories recursively, if they aren't in the repository already + 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): + # add directories recursively, if they aren't in the + # repository already tree.insert(-1, dname) dname = os.path.dirname(dname) else: @@ -725,12 +766,15 @@ def vcsRemove(self, name, project=False, noDialog=False): """ - Public method used to remove a file/directory from the Subversion repository. + Public method used to remove a file/directory from the Subversion + repository. The default operation is to remove the local copy as well. - @param name file/directory name to be removed (string or list of strings)) - @param project flag indicating deletion of a project tree (boolean) (not needed) + @param name file/directory name to be removed (string or list of + strings)) + @param project flag indicating deletion of a project tree (boolean) + (not needed) @param noDialog flag indicating quiet operations @return flag indicating successfull operation (boolean) """ @@ -750,7 +794,8 @@ res = self.startSynchronizedProcess(QProcess(), "svn", args) else: dia = SvnDialog( - self.trUtf8('Removing files/directories from the Subversion repository')) + self.trUtf8('Removing files/directories from the Subversion' + ' repository')) res = dia.startProcess(args) if res: dia.exec_() @@ -852,8 +897,9 @@ Subversion repository. If name is a directory and is the project directory, all project files - are saved first. If name is a file (or list of files), which is/are being edited - and has unsaved modification, they can be saved or the operation may be aborted. + are saved first. If name is a file (or list of files), which is/are + being edited and has unsaved modification, they can be saved or the + operation may be aborted. @param name file/directory name to be diffed (string) """ @@ -902,9 +948,10 @@ if reposURL is None: E5MessageBox.critical(self.__ui, self.trUtf8("Subversion Error"), - self.trUtf8("""The URL of the project repository could not be""" - """ retrieved from the working copy. The tag operation will""" - """ be aborted""")) + self.trUtf8( + """The URL of the project repository could not be""" + """ retrieved from the working copy. The tag operation""" + """ will be aborted""")) return if self.otherData["standardLayout"]: @@ -936,7 +983,8 @@ if tagOp in [1, 4]: url = '{0}/tags/{1}'.format(reposRoot, urllib.parse.quote(tag)) elif tagOp in [2, 8]: - url = '{0}/branches/{1}'.format(reposRoot, urllib.parse.quote(tag)) + url = '{0}/branches/{1}'.format( + reposRoot, urllib.parse.quote(tag)) else: url = self.__svnURL(tag) @@ -984,11 +1032,12 @@ project = e5App().getObject("Project") names = [project.getRelativePath(nam) for nam in names] if names[0]: - from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import \ + DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Revert changes"), - self.trUtf8("Do you really want to revert all changes to these files" - " or directories?"), + self.trUtf8("Do you really want to revert all changes to" + " these files or directories?"), names) yes = dlg.exec_() == QDialog.Accepted else: @@ -1016,9 +1065,10 @@ if reposURL is None: E5MessageBox.critical(self.__ui, self.trUtf8("Subversion Error"), - self.trUtf8("""The URL of the project repository could not be""" - """ retrieved from the working copy. The switch operation will""" - """ be aborted""")) + self.trUtf8( + """The URL of the project repository could not be""" + """ retrieved from the working copy. The switch""" + """ operation will be aborted""")) return False if self.otherData["standardLayout"]: @@ -1051,7 +1101,8 @@ if tagType == 1: url = '{0}/tags/{1}'.format(reposRoot, urllib.parse.quote(tag)) elif tagType == 2: - url = '{0}/branches/{1}'.format(reposRoot, urllib.parse.quote(tag)) + url = '{0}/branches/{1}'.format( + reposRoot, urllib.parse.quote(tag)) elif tagType == 4: url = '{0}/trunk'.format(reposRoot) tn = 'HEAD' @@ -1090,8 +1141,8 @@ del opts[opts.index('--force')] from .SvnMergeDialog import SvnMergeDialog - dlg = SvnMergeDialog(self.mergeList[0], self.mergeList[1], self.mergeList[2], - force) + dlg = SvnMergeDialog( + self.mergeList[0], self.mergeList[1], self.mergeList[2], force) if dlg.exec_() == QDialog.Accepted: urlrev1, urlrev2, target, force = dlg.getParameters() else: @@ -1153,8 +1204,8 @@ """ Private method used to get the registered state of a file in the vcs. - This is the variant for subversion installations using the new working copy - meta-data format. + This is the variant for subversion installations using the new + working copy meta-data format. @param name filename to check (string) @return a combination of canBeCommited and canBeAdded @@ -1180,10 +1231,10 @@ def __vcsRegisteredState_wc(self, name): """ - Private method used to get the registered state of a file in the vcs. + Private method used to get the registered state of a file in the VCS. - This is the variant for subversion installations using the old working copy - meta-data format. + This is the variant for subversion installations using the old working + copy meta-data format. @param name filename to check (string) @return a combination of canBeCommited and canBeAdded @@ -1206,11 +1257,12 @@ def vcsAllRegisteredStates(self, names, dname, shortcut=True): """ - Public method used to get the registered states of a number of files in the vcs. + Public method used to get the registered states of a number of files + in the VCS. - <b>Note:</b> If a shortcut is to be taken, the code will only check, if the named - directory has been scanned already. If so, it is assumed, that the states for - all files have been populated by the previous run. + <b>Note:</b> If a shortcut is to be taken, the code will only check, + if the named directory has been scanned already. If so, it is assumed, + that the states for all files have been populated by the previous run. @param names dictionary with all filenames to be checked as keys @param dname directory to check in (string) @@ -1225,14 +1277,15 @@ def __vcsAllRegisteredStates_wcng(self, names, dname, shortcut=True): """ - Private method used to get the registered states of a number of files in the vcs. + Private method used to get the registered states of a number of files + in the VCS. - This is the variant for subversion installations using the new working copy - meta-data format. + This is the variant for subversion installations using the new working + copy meta-data format. - <b>Note:</b> If a shortcut is to be taken, the code will only check, if the named - directory has been scanned already. If so, it is assumed, that the states for - all files has been populated by the previous run. + <b>Note:</b> If a shortcut is to be taken, the code will only check, + if the named directory has been scanned already. If so, it is assumed, + that the states for all files has been populated by the previous run. @param names dictionary with all filenames to be checked as keys @param dname directory to check in (string) @@ -1270,8 +1323,8 @@ if procStarted: finished = process.waitForFinished(30000) if finished and process.exitCode() == 0: - output = \ - str(process.readAllStandardOutput(), ioEncoding, 'replace') + output = str(process.readAllStandardOutput(), ioEncoding, + 'replace') for line in output.splitlines(): if self.rx_status1.exactMatch(line): flags = str(self.rx_status1.cap(1)) @@ -1293,14 +1346,15 @@ def __vcsAllRegisteredStates_wc(self, names, dname, shortcut=True): """ - Private method used to get the registered states of a number of files in the vcs. + Private method used to get the registered states of a number of files + in the VCS. - This is the variant for subversion installations using the old working copy - meta-data format. + This is the variant for subversion installations using the old working + copy meta-data format. - <b>Note:</b> If a shortcut is to be taken, the code will only check, if the named - directory has been scanned already. If so, it is assumed, that the states for - all files has been populated by the previous run. + <b>Note:</b> If a shortcut is to be taken, the code will only check, + if the named directory has been scanned already. If so, it is assumed, + that the states for all files has been populated by the previous run. @param names dictionary with all filenames to be checked as keys @param dname directory to check in (string) @@ -1335,8 +1389,8 @@ if procStarted: finished = process.waitForFinished(30000) if finished and process.exitCode() == 0: - output = \ - str(process.readAllStandardOutput(), ioEncoding, 'replace') + output = str(process.readAllStandardOutput(), ioEncoding, + 'replace') for line in output.splitlines(): if self.rx_status1.exactMatch(line): flags = self.rx_status1.cap(1) @@ -1485,7 +1539,8 @@ if procStarted: finished = process.waitForFinished(30000) if finished and process.exitCode() == 0: - output = str(process.readAllStandardOutput(), ioEncoding, 'replace') + output = str(process.readAllStandardOutput(), ioEncoding, + 'replace') entryFound = False commitFound = False for line in output.splitlines(): @@ -1507,10 +1562,11 @@ info['url'] = \ line.replace('<url>', '').replace('</url>', '') elif line.startswith('<author>'): - info['last-author'] = \ - line.replace('<author>', '').replace('</author>', '') + info['last-author'] = line.replace('<author>', '')\ + .replace('</author>', '') elif line.startswith('<date>'): - value = line.replace('<date>', '').replace('</date>', '') + value = line.replace('<date>', '')\ + .replace('</date>', '') date, time = value.split('T') info['committed-date'] = date info['committed-time'] = "{0}{1}".format( @@ -1536,13 +1592,14 @@ info['committed-time'], info['last-author']) - ############################################################################ + ########################################################################### ## Public Subversion specific methods are below. - ############################################################################ + ########################################################################### def svnGetReposName(self, path): """ - Public method used to retrieve the URL of the subversion repository path. + Public method used to retrieve the URL of the subversion repository + path. @param path local path to get the svn repository path for (string) @return string with the repository path URL @@ -1560,11 +1617,13 @@ if procStarted: finished = process.waitForFinished(30000) if finished and process.exitCode() == 0: - output = str(process.readAllStandardOutput(), ioEncoding, 'replace') + output = str(process.readAllStandardOutput(), ioEncoding, + 'replace') for line in output.splitlines(): line = line.strip() if line.startswith('<url>'): - reposURL = line.replace('<url>', '').replace('</url>', '') + reposURL = line.replace('<url>', '')\ + .replace('</url>', '') return reposURL return "" @@ -1662,7 +1721,8 @@ if not propName: E5MessageBox.critical(self.__ui, self.trUtf8("Subversion Set Property"), - self.trUtf8("""You have to supply a property name. Aborting.""")) + self.trUtf8("""You have to supply a property name.""" + """ Aborting.""")) return args = [] @@ -1705,7 +1765,8 @@ if not propName: E5MessageBox.critical(self.__ui, self.trUtf8("Subversion Delete Property"), - self.trUtf8("""You have to supply a property name. Aborting.""")) + self.trUtf8("""You have to supply a property name.""" + """ Aborting.""")) return args = [] @@ -1753,8 +1814,8 @@ else: self.branchesList = [] allTagsBranchesList = None - self.tagbranchList.start(path, tags, - self.branchesList, self.allTagsBranchesList) + self.tagbranchList.start( + path, tags, self.branchesList, self.allTagsBranchesList) def svnBlame(self, name): """ @@ -1773,8 +1834,9 @@ Subversion repository. If name is a directory and is the project directory, all project files - are saved first. If name is a file (or list of files), which is/are being edited - and has unsaved modification, they can be saved or the operation may be aborted. + are saved first. If name is a file (or list of files), which is/are + being edited and has unsaved modification, they can be saved or the + operation may be aborted. This method gives the chance to enter the revisions to be compared. @@ -1808,8 +1870,9 @@ repository URLs. If name is a directory and is the project directory, all project files - are saved first. If name is a file (or list of files), which is/are being edited - and has unsaved modification, they can be saved or the operation may be aborted. + are saved first. If name is a file (or list of files), which is/are + being edited and has unsaved modification, they can be saved or the + operation may be aborted. This method gives the chance to enter the revisions to be compared. @@ -1832,7 +1895,8 @@ dname = self.splitPath(names[0])[0] from .SvnUrlSelectionDialog import SvnUrlSelectionDialog - dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, dname) + dlg = SvnUrlSelectionDialog(self, self.tagsList, self.branchesList, + dname) if dlg.exec_() == QDialog.Accepted: urls, summary = dlg.getURLs() from .SvnDiffDialog import SvnDiffDialog @@ -1843,7 +1907,8 @@ def __svnGetFileForRevision(self, name, rev=""): """ - Private method to get a file for a specific revision from the repository. + Private method to get a file for a specific revision from the + repository. @param name file name to get from the repository (string) @keyparam rev revision to retrieve (integer or string) @@ -1872,7 +1937,8 @@ error = str(process.readAllStandardError(), Preferences.getSystem("IOEncoding"), 'replace') else: - error = self.trUtf8("The svn process did not finish within 30s.") + error = self.trUtf8( + "The svn process did not finish within 30s.") else: error = self.trUtf8('The process {0} could not be started. ' 'Ensure, that it is in the search path.').format('svn') @@ -1931,7 +1997,8 @@ except IOError: E5MessageBox.critical(self.__ui, self.trUtf8("Subversion Side-by-Side Difference"), - self.trUtf8("""<p>The file <b>{0}</b> could not be read.</p>""") + self.trUtf8( + """<p>The file <b>{0}</b> could not be read.</p>""") .format(name)) return @@ -1958,9 +2025,11 @@ """ Public method used to lock a file in the Subversion repository. - @param name file/directory name to be locked (string or list of strings) + @param name file/directory name to be locked (string or list of + strings) @param stealIt flag indicating a forced operation (boolean) - @param parent reference to the parent object of the subversion dialog (QWidget) + @param parent reference to the parent object of the subversion dialog + (QWidget) """ args = [] args.append('lock') @@ -1974,7 +2043,8 @@ dname, fname = self.splitPath(name) args.append(fname) - dia = SvnDialog(self.trUtf8('Locking in the Subversion repository'), parent) + dia = SvnDialog( + self.trUtf8('Locking in the Subversion repository'), parent) res = dia.startProcess(args, dname) if res: dia.exec_() @@ -1983,9 +2053,11 @@ """ Public method used to unlock a file in the Subversion repository. - @param name file/directory name to be unlocked (string or list of strings) + @param name file/directory name to be unlocked (string or list of + strings) @param breakIt flag indicating a forced operation (boolean) - @param parent reference to the parent object of the subversion dialog (QWidget) + @param parent reference to the parent object of the subversion dialog + (QWidget) """ args = [] args.append('unlock') @@ -1999,7 +2071,8 @@ dname, fname = self.splitPath(name) args.append(fname) - dia = SvnDialog(self.trUtf8('Unlocking in the Subversion repository'), parent) + dia = SvnDialog( + self.trUtf8('Unlocking in the Subversion repository'), parent) res = dia.startProcess(args, dname) if res: dia.exec_() @@ -2164,9 +2237,9 @@ return changelists - ############################################################################ + ########################################################################### ## Private Subversion specific methods are below. - ############################################################################ + ########################################################################### def __svnURL(self, url): """ @@ -2181,7 +2254,8 @@ scheme = url[0] host = url[1] port, path = url[2].split("/", 1) - return "{0}:{1}:{2}/{3}".format(scheme, host, port, urllib.parse.quote(path)) + return "{0}:{1}:{2}/{3}".format( + scheme, host, port, urllib.parse.quote(path)) else: scheme = url[0] if scheme == "file": @@ -2192,7 +2266,8 @@ except ValueError: host = url[1][2:] path = "" - return "{0}://{1}/{2}".format(scheme, host, urllib.parse.quote(path)) + return "{0}://{1}/{2}".format( + scheme, host, urllib.parse.quote(path)) def svnNormalizeURL(self, url): """ @@ -2213,22 +2288,25 @@ url = "/{0}".format(url) return "{0}://{1}".format(protocol, url) - ############################################################################ + ########################################################################### ## Methods to get the helper objects are below. - ############################################################################ + ########################################################################### - def vcsGetProjectBrowserHelper(self, browser, project, isTranslationsBrowser=False): + def vcsGetProjectBrowserHelper(self, browser, project, + isTranslationsBrowser=False): """ - Public method to instanciate a helper object for the different project browsers. + Public method to instanciate a helper object for the different + project browsers. @param browser reference to the project browser object @param project reference to the project object - @param isTranslationsBrowser flag indicating, the helper is requested for the - translations browser (this needs some special treatment) + @param isTranslationsBrowser flag indicating, the helper is requested + for the translations browser (this needs some special treatment) @return the project browser helper object """ from .ProjectBrowserHelper import SvnProjectBrowserHelper - return SvnProjectBrowserHelper(self, browser, project, isTranslationsBrowser) + return SvnProjectBrowserHelper(self, browser, project, + isTranslationsBrowser) def vcsGetProjectHelper(self, project): """ @@ -2240,19 +2318,23 @@ helper = self.__plugin.getProjectHelper() helper.setObjects(self, project) self.__wcng = \ - os.path.exists(os.path.join(project.getProjectPath(), ".svn", "format")) or \ - os.path.exists(os.path.join(project.getProjectPath(), "_svn", "format")) + os.path.exists( + os.path.join(project.getProjectPath(), ".svn", "format")) or \ + os.path.exists( + os.path.join(project.getProjectPath(), "_svn", "format")) return helper - ############################################################################ + ########################################################################### ## Status Monitor Thread methods - ############################################################################ + ########################################################################### def _createStatusMonitorThread(self, interval, project): """ - Protected method to create an instance of the VCS status monitor thread. + Protected method to create an instance of the VCS status monitor + thread. - @param interval check interval for the monitor thread in seconds (integer) + @param interval check interval for the monitor thread in seconds + (integer) @param project reference to the project object @return reference to the monitor thread (QThread) """