Plugins/VcsPlugins/vcsSubversion/subversion.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2847
1843ef6e2656
parent 3009
bf5ae5d7477d
child 3058
0a02c433f52d
diff -r 9986ec0e559a -r 10516539f238 Plugins/VcsPlugins/vcsSubversion/subversion.py
--- a/Plugins/VcsPlugins/vcsSubversion/subversion.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Plugins/VcsPlugins/vcsSubversion/subversion.py	Fri Oct 18 23:00:41 2013 +0200
@@ -103,14 +103,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):
         """
@@ -145,7 +147,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 = ""
@@ -160,7 +163,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])
@@ -172,11 +176,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.")
         
@@ -198,7 +203,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
@@ -207,9 +213,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:
@@ -229,9 +236,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
@@ -251,7 +259,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)
@@ -280,7 +289,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:
@@ -299,7 +309,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_()
@@ -310,7 +321,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)
@@ -332,7 +344,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"),
@@ -358,7 +371,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_()
@@ -366,7 +380,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)
@@ -384,7 +399,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"),
@@ -407,7 +423,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_()
@@ -415,10 +432,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
         """
@@ -461,11 +479,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:
@@ -474,8 +494,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
@@ -483,10 +504,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:
@@ -520,7 +541,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_()
@@ -529,9 +551,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)
@@ -554,7 +578,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_()
@@ -564,7 +589,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)
@@ -597,15 +623,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
@@ -617,14 +646,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:
@@ -643,7 +675,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_()
@@ -660,9 +693,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')
@@ -676,14 +711,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:
@@ -703,10 +741,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:
@@ -731,12 +772,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)
         """
@@ -756,7 +800,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_()
@@ -858,8 +903,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)
         """
@@ -908,9 +954,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"]:
@@ -942,7 +989,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)
         
@@ -990,11 +1038,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:
@@ -1014,6 +1063,7 @@
         Public method used to switch a directory to a different tag/branch.
         
         @param name directory name to be switched (string)
+        @return flag indicating added or changed files (boolean)
         """
         dname, fname = self.splitPath(name)
         
@@ -1021,9 +1071,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"]:
@@ -1056,7 +1107,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'
@@ -1095,8 +1147,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:
@@ -1158,8 +1210,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
@@ -1185,10 +1237,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
@@ -1211,11 +1263,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)
@@ -1230,14 +1283,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)
@@ -1275,8 +1329,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))
@@ -1298,14 +1352,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)
@@ -1340,8 +1395,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)
@@ -1441,17 +1496,22 @@
         
         @param project reference to the project object
         @param archive name of the project in the repository (string)
-        @param editable flag indicating that the project name is editable (boolean)
+        @param editable flag indicating that the project name is editable
+            (boolean)
         @param parent parent widget (QWidget)
+        @return reference to the instantiated options dialog (SvnOptionsDialog)
         """
         from .SvnOptionsDialog import SvnOptionsDialog
         return SvnOptionsDialog(self, project, parent)
         
     def vcsNewProjectOptionsDialog(self, parent=None):
         """
-        Public method to get a dialog to enter repository info for getting a new project.
+        Public method to get a dialog to enter repository info for getting
+        a new project.
         
         @param parent parent widget (QWidget)
+        @return reference to the instantiated options dialog
+            (SvnNewProjectOptionsDialog)
         """
         from .SvnNewProjectOptionsDialog import SvnNewProjectOptionsDialog
         return SvnNewProjectOptionsDialog(self, parent)
@@ -1485,7 +1545,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 +1568,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 +1598,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 +1623,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 +1727,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 +1771,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 +1820,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 +1840,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 +1876,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 +1901,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 +1913,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 +1943,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')
@@ -1881,12 +1953,13 @@
     
     def svnSbsDiff(self, name, extended=False, revisions=None):
         """
-        Public method used to view the difference of a file to the Mercurial repository
-        side-by-side.
+        Public method used to view the difference of a file to the Mercurial
+        repository side-by-side.
         
         @param name file name to be diffed (string)
         @keyparam extended flag indicating the extended variant (boolean)
         @keyparam revisions tuple of two revisions (tuple of strings)
+        @exception ValueError raised to indicate an illegal name parameter type
         """
         if isinstance(name, list):
             raise ValueError("Wrong parameter type")
@@ -1930,7 +2003,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
         
@@ -1957,9 +2031,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')
@@ -1973,7 +2049,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_()
@@ -1982,9 +2059,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')
@@ -1998,7 +2077,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_()
@@ -2163,9 +2243,9 @@
         
         return changelists
 
-    ############################################################################
+    ###########################################################################
     ## Private Subversion specific methods are below.
-    ############################################################################
+    ###########################################################################
     
     def __svnURL(self, url):
         """
@@ -2180,7 +2260,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":
@@ -2191,7 +2272,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):
         """
@@ -2212,22 +2294,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):
         """
@@ -2239,20 +2324,24 @@
         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 project reference to the project object
-        @param interval check interval for the monitor thread in seconds (integer)
         @return reference to the monitor thread (QThread)
         """
         from .SvnStatusMonitorThread import SvnStatusMonitorThread

eric ide

mercurial