--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Fri Dec 22 19:45:17 2023 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py Sat Dec 23 15:40:23 2023 +0100 @@ -49,8 +49,11 @@ Constructor @param plugin reference to the plugin object - @param parent parent widget (QWidget) - @param name name of this object (string) + @type VcsMercurialPlugin + @param parent parent widget + @type QWidget + @param name name of this object + @type str """ from .CloseheadExtension.closehead import Closehead from .GpgExtension.gpg import Gpg @@ -161,7 +164,8 @@ """ Public method to get a reference to the plugin object. - @return reference to the plugin object (VcsMercurialPlugin) + @return reference to the plugin object + @rtype VcsMercurialPlugin """ return self.__plugin @@ -169,7 +173,8 @@ """ Public method to get the encoding to be used by Mercurial. - @return encoding (string) + @return encoding + @rtype str """ return self.__plugin.getPreferences("Encoding") @@ -224,8 +229,10 @@ """ Public method to initialize a command arguments list. - @param command command name (string) - @return list of command options (list of string) + @param command command name + @type str + @return list of command options + @rtype list of str """ args = [command] self.addArguments(args, self.__plugin.getGlobalOptions()) @@ -235,8 +242,8 @@ """ Public method used to test for the presence of the hg executable. - @return flag indicating the existence (boolean) and an error message - (string) + @return flag indicating the existence and an error message + @rtype tuple of (bool, str) """ from .HgUtilities import hgVersion @@ -254,9 +261,12 @@ Mercurial controlled project. Therefore we always return TRUE without doing anything. - @param vcsDir name of the VCS directory (string) - @param noDialog flag indicating quiet operations (boolean) - @return always TRUE + @param vcsDir name of the VCS directory + @type str + @param noDialog flag indicating quiet operations + @type bool + @return always True + @rtype bool """ return True @@ -294,7 +304,7 @@ @param vcsDataDict dictionary of data required for the import @type dict - @param projectDir project directory (string) + @param projectDir project directory @type str @param noDialog flag indicating quiet operations @type bool @@ -343,9 +353,13 @@ (clone). @param vcsDataDict dictionary of data required for the checkout - @param projectDir project directory to create (string) + @type dict + @param projectDir project directory to create + @type str @param noDialog flag indicating quiet operations - @return flag indicating an execution without errors (boolean) + @type bool + @return flag indicating an execution without errors + @rtype bool """ noDialog = False try: @@ -378,8 +392,11 @@ Public method used to export a directory from the Mercurial repository. @param vcsDataDict dictionary of data required for the checkout - @param projectDir project directory to create (string) - @return flag indicating an execution without errors (boolean) + @type dict + @param projectDir project directory to create + @type str + @return flag indicating an execution without errors + @rtype bool """ status = self.vcsCheckout(vcsDataDict, projectDir) shutil.rmtree(os.path.join(projectDir, self.adminDir), ignore_errors=True) @@ -394,13 +411,18 @@ Public method used to make the change of a file/directory permanent in the Mercurial repository. - @param name file/directory name to be committed (string or list of - strings) - @param message message for this operation (string) + @param name file/directory name to be committed + @type str or list of str + @param message message for this operation + @type str @param noDialog flag indicating quiet operations - @param closeBranch flag indicating a close branch commit (boolean) - @param mq flag indicating a queue commit (boolean) - @param merge flag indicating a merge commit (boolean) + @type bool + @param closeBranch flag indicating a close branch commit + @type bool + @param mq flag indicating a queue commit + @type bool + @param merge flag indicating a merge commit + @type bool """ from .HgCommitDialog import HgCommitDialog @@ -606,10 +628,13 @@ repository. @param name file/directory name to be updated (not used) - @param noDialog flag indicating quiet operations (boolean) - @param revision revision to update to (string) - @return flag indicating, that the update contained an add - or delete (boolean) + @type str + @param noDialog flag indicating quiet operations + @type bool + @param revision revision to update to + @type str + @return flag indicating, that the update contained an add or delete + @rtype bool """ args = self.initCommand("update") if "-v" not in args and "--verbose" not in args: @@ -634,9 +659,12 @@ """ Public method used to add a file/directory to the Mercurial repository. - @param name file/directory name to be added (string) - @param isDir flag indicating name is a directory (boolean) + @param name file/directory name to be added + @type str + @param isDir flag indicating name is a directory + @type bool @param noDialog flag indicating quiet operations + @type bool """ args = self.initCommand("add") args.append("-v") @@ -661,8 +689,10 @@ Public method used to add a file/directory in binary mode to the Mercurial repository. - @param name file/directory name to be added (string) - @param isDir flag indicating name is a directory (boolean) + @param name file/directory name to be added + @type str + @param isDir flag indicating name is a directory + @type bool """ self.vcsAdd(name, isDir) @@ -671,8 +701,8 @@ Public method to add a directory tree rooted at path to the Mercurial 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 + @type str or list of str """ self.vcsAdd(path, isDir=False) @@ -683,12 +713,14 @@ 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 + @type str or list of str + @param project flag indicating deletion of a project tree + @type bool @param noDialog flag indicating quiet operations - @return flag indicating successfull operation (boolean) + @type bool + @return flag indicating successfull operation + @rtype bool """ args = self.initCommand("remove") args.append("-v") @@ -719,11 +751,16 @@ """ Public method used to move a file/directory. - @param name file/directory name to be moved (string) + @param name file/directory name to be moved + @type str @param project reference to the project object - @param target new name of the file/directory (string) + @type Project + @param target new name of the file/directory + @type str @param noDialog flag indicating quiet operations - @return flag indicating successfull operation (boolean) + @type bool + @return flag indicating successfull operation + @rtype bool """ from .HgCopyDialog import HgCopyDialog @@ -781,7 +818,8 @@ 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) + @param name file/directory name to be diffed + @type str """ from .HgDiffDialog import HgDiffDialog @@ -808,7 +846,7 @@ Mercurial repository. @param name file/directory name(s) to show the status of - (string or list of strings) + @type str or list of str """ from .HgStatusDialog import HgStatusDialog @@ -823,9 +861,11 @@ Public method used to show some summary information of the working directory state. - @param mq flag indicating to show the queue status as well (boolean) + @param mq flag indicating to show the queue status as well + @type bool @param largefiles flag indicating to show the largefiles status as - well (boolean) + well + @type bool """ from .HgSummaryDialog import HgSummaryDialog @@ -840,10 +880,13 @@ Public method used to set/remove a tag in the Mercurial repository. @param name file/directory name to determine the repo root from - (string) - @param revision revision to set tag for (string) - @param tagName name of the tag (string) - @return flag indicating a performed tag action (boolean) + @type str + @param revision revision to set tag for + @type str + @param tagName name of the tag + @type str + @return flag indicating a performed tag action + @rtype bool """ from .HgTagDialog import HgTagDialog @@ -986,7 +1029,8 @@ """ Public method used to merge a URL/revision into the local project. - @param name file/directory name to be merged (string) + @param name file/directory name to be merged + @type str """ from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog @@ -1029,9 +1073,10 @@ Public method used to switch a working directory to a different revision. - @param name directory name to be switched (string) - @return flag indicating, that the switch contained an add - or delete (boolean) + @param name directory name to be switched + @type str + @return flag indicating, that the switch contained an add or delete + @rtype bool """ from .HgRevisionSelectionDialog import HgRevisionSelectionDialog @@ -1053,7 +1098,7 @@ @param name file or directory name to check @type str - @return a combination of canBeCommited and canBeAdded + @return registered state (one of canBeCommited and canBeAdded) @rtype int """ if name.endswith(os.sep): @@ -1094,10 +1139,14 @@ 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) - @param shortcut flag indicating a shortcut should be taken (boolean) + @type dict + @param dname directory to check in + @type str + @param shortcut flag indicating a shortcut should be taken + @type bool @return the received dictionary completed with a combination of canBeCommited and canBeAdded or None in order to signal an error + @rtype dict """ if dname.endswith(os.sep): dname = dname[:-1] @@ -1155,7 +1204,8 @@ """ Public method returning the name of the vcs. - @return always 'Mercurial' (string) + @return always 'Mercurial' + @rtype str """ return "Mercurial" @@ -1165,7 +1215,8 @@ This method ensures, that an ignore file exists. - @param project reference to the project (Project) + @param project reference to the project + @type Project """ ppath = project.getProjectPath() if ppath: @@ -1177,7 +1228,8 @@ """ Public method used to cleanup the working directory. - @param name directory name to be cleaned up (string) + @param name directory name to be cleaned up + @type str """ patterns = self.getPlugin().getPreferences("CleanupPatterns").split() @@ -1193,7 +1245,8 @@ """ Public method used to execute arbitrary mercurial commands. - @param name directory name of the working directory (string) + @param name directory name of the working directory + @type str """ from .HgCommandDialog import HgCommandDialog @@ -1223,11 +1276,15 @@ Public method to get a dialog to enter repository info. @param project reference to the project object - @param archive name of the project in the repository (string) + @type Project + @param archive name of the project in the repository + @type str @param editable flag indicating that the project name is editable - (boolean) - @param parent parent widget (QWidget) - @return reference to the instantiated options dialog (HgOptionsDialog) + @type bool + @param parent parent widget + @type QWidget + @return reference to the instantiated options dialog + @rtype HgOptionsDialog """ from .HgOptionsDialog import HgOptionsDialog @@ -1238,9 +1295,10 @@ Public method to get a dialog to enter repository info for getting a new project. - @param parent parent widget (QWidget) + @param parent parent widget + @type QWidget @return reference to the instantiated options dialog - (HgNewProjectOptionsDialog) + @rtype HgNewProjectOptionsDialog """ from .HgNewProjectOptionsDialog import HgNewProjectOptionsDialog @@ -1250,8 +1308,10 @@ """ Public method to retrieve information about the repository. - @param ppath local path to get the repository infos (string) - @return string with ready formated info for display (string) + @param ppath local path to get the repository infos + @type str + @return string with ready formated info for display + @rtype str """ args = self.initCommand("log") args.extend( @@ -1335,7 +1395,7 @@ Public method to signal the support of user settable command options. @return flag indicating the support of user settable command options - (boolean) + @rtype bool """ return False @@ -1347,8 +1407,10 @@ """ Public method to normalize a url for Mercurial. - @param url url string (string) - @return properly normalized url for mercurial (string) + @param url url string + @type str + @return properly normalized url for mercurial + @rtype str """ url = url.replace("\\", "/") if url.endswith("/"): @@ -1360,9 +1422,12 @@ """ Public method used to copy a file/directory. - @param name file/directory name to be copied (string) + @param name file/directory name to be copied + @type str @param project reference to the project object - @return flag indicating successful operation (boolean) + @type Project + @return flag indicating successful operation + @rtype bool """ from .HgCopyDialog import HgCopyDialog @@ -1392,10 +1457,11 @@ """ Public method to get the list of tags. - @param withType flag indicating to get the tag type as well (boolean) - @return list of tags (list of string) or list of tuples of - tag name and flag indicating a local tag (list of tuple of string - and boolean), if withType is True + @param withType flag indicating to get the tag type as well + @type bool + @return list of tags or list of tuples of tag name and flag indicating + a local tag, if withType is True + @rtype list of str or list of [(str, bool)] """ args = self.initCommand("tags") args.append("--verbose") @@ -1473,7 +1539,8 @@ Public method used to list the available tags or branches. @param tags flag indicating listing of branches or tags - (False = branches, True = tags) + (False = branches, True = tags) + @type bool """ from .HgTagBranchListDialog import HgTagBranchListDialog @@ -1525,7 +1592,8 @@ This method gives the chance to enter the revisions to be compared. - @param name file/directory name to be diffed (string) + @param name file/directory name to be diffed + @type str """ from .HgDiffDialog import HgDiffDialog from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog @@ -1559,9 +1627,12 @@ Private method to get a file for a specific revision from the repository. - @param name file name to get from the repository (string) - @param rev revision to retrieve (string) - @return contents of the file (string) and an error message (string) + @param name file name to get from the repository + @type str + @param rev revision to retrieve + @type str + @return contents of the file (string) and an error message + @rtype str """ args = self.initCommand("cat") if rev: @@ -1579,9 +1650,12 @@ 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) - @param extended flag indicating the extended variant (boolean) - @param revisions tuple of two revisions (tuple of strings) + @param name file name to be diffed + @type str + @param extended flag indicating the extended variant + @type bool + @param revisions tuple of two revisions + @type tuple of (str, str) @exception ValueError raised to indicate an invalid name parameter """ from eric7.UI.CompareDialog import CompareDialog @@ -1648,9 +1722,10 @@ Public method used to browse the log of a file/directory from the Mercurial repository. - @param name file/directory name to show the log of (string) + @param name file/directory name to show the log of + @type str @param isFile flag indicating log for a file is to be shown - (boolean) + @type bool """ from .HgLogBrowserDialog import HgLogBrowserDialog @@ -1737,9 +1812,12 @@ """ Public method used to push changes to a remote Mercurial repository. - @param force flag indicating a forced push (boolean) - @param newBranch flag indicating to push a new branch (boolean) - @param rev revision to be pushed (including all ancestors) (string) + @param force flag indicating a forced push + @type bool + @param newBranch flag indicating to push a new branch + @type bool + @param rev revision to be pushed (including all ancestors) + @type str """ args = self.initCommand("push") args.append("-v") @@ -1761,8 +1839,8 @@ """ Public method to show information about the heads of the repository. - @param mode mode of the operation (string, one of heads, parents, - tip) + @param mode mode of the operation (one of 'heads', 'parents', 'tip') + @type str """ if mode not in ("heads", "parents", "tip"): mode = "heads" @@ -1873,9 +1951,11 @@ """ Public method used to resolve conflicts of a file/directory. - @param name file/directory name to be resolved (string) + @param name file/directory name to be resolved + @type str @param unresolve flag indicating to mark the file/directory as - unresolved (boolean) + unresolved + @type bool """ args = self.initCommand("resolve") if unresolve: @@ -1903,8 +1983,8 @@ """ Public method to abort an uncommitted merge. - @return flag indicating, that the abortion contained an add - or delete (boolean) + @return flag indicating, that the abortion contained an add or delete + @rtype bool """ if self.version >= (4, 5, 0): args = self.initCommand("merge") @@ -2095,9 +2175,12 @@ """ Public method to create the ignore file. - @param name directory name to create the ignore file in (string) - @param autoAdd flag indicating to add it automatically (boolean) + @param name directory name to create the ignore file in + @type str + @param autoAdd flag indicating to add it automatically + @type bool @return flag indicating success + @rtype bool """ status = False ignorePatterns = [ @@ -2439,7 +2522,8 @@ Public method to import a patch file. @return flag indicating, that the import contained an add, a delete - or a change to the project file (boolean) + or a change to the project file + @rtype bool """ from .HgImportDialog import HgImportDialog @@ -2537,8 +2621,10 @@ Public method to change the phase of revisions. @param data tuple giving phase data (list of revisions, phase, flag - indicating a forced operation) (list of strings, string, boolean) - @return flag indicating success (boolean) + indicating a forced operation) + @type tuple of (list of str, str, bool) + @return flag indicating success + @rtype bool @exception ValueError raised to indicate an invalid phase """ from .HgPhaseDialog import HgPhaseDialog @@ -2581,9 +2667,10 @@ """ Public method to copy changesets from another branch. - @param revs list of revisions to show in the revisions pane (list of - strings) - @return flag indicating that the project should be reread (boolean) + @param revs list of revisions to show in the revisions pane + @type list of str + @return flag indicating that the project should be reread + @rtype bool """ from .HgGraftDialog import HgGraftDialog @@ -2735,7 +2822,8 @@ Public method to get the path to the .hgsub file containing the definitions of sub-repositories. - @return full path of the .hgsub file (string) + @return full path of the .hgsub file + @rtype str """ ppath = self.__projectHelper.getProject().getProjectPath() return os.path.join(ppath, ".hgsub") @@ -2744,7 +2832,8 @@ """ Public method to check, if the project might have sub-repositories. - @return flag indicating the existence of sub-repositories (boolean) + @return flag indicating the existence of sub-repositories + @rtype bool """ hgsub = self.getHgSubPath() return os.path.isfile(hgsub) and os.stat(hgsub).st_size > 0 @@ -2920,7 +3009,8 @@ """ Public method to check, if pull is possible. - @return flag indicating pull capability (boolean) + @return flag indicating pull capability + @rtype bool """ return self.__defaultConfigured @@ -2928,7 +3018,8 @@ """ Public method to check, if push is possible. - @return flag indicating push capability (boolean) + @return flag indicating push capability + @rtype bool """ return self.__defaultPushConfigured or self.__defaultConfigured @@ -2936,7 +3027,8 @@ """ Private slot to handle a change of the Mercurial configuration file. - @param path name of the changed file (string) + @param path name of the changed file + @type str """ if self.__client: ok, err = self.__client.restartServer() @@ -3001,8 +3093,10 @@ """ Public method to check, if an extension is active. - @param extensionName name of the extension to check for (string) - @return flag indicating an active extension (boolean) + @param extensionName name of the extension to check for + @type str + @return flag indicating an active extension + @rtype bool """ extensionName = extensionName.strip() isActive = extensionName in self.__activeExtensions @@ -3013,8 +3107,10 @@ """ Public method to get a reference to an extension object. - @param extensionName name of the extension (string) - @return reference to the extension object (boolean) + @param extensionName name of the extension + @type str + @return reference to the extension object + @rtype bool """ return self.__extensions[extensionName] @@ -3028,10 +3124,14 @@ project browsers. @param browser reference to the project browser object + @type ProjectBaseBrowser @param project reference to the project object + @type Project @param isTranslationsBrowser flag indicating, the helper is requested for the translations browser (this needs some special treatment) + @type bool @return the project browser helper object + @rtype HgProjectBrowserHelper """ from .ProjectBrowserHelper import HgProjectBrowserHelper @@ -3042,7 +3142,9 @@ Public method to instantiate a helper object for the project. @param project reference to the project object + @type Project @return the project helper object + @rtype HgProjectHelper """ # find the root of the repo repodir = project.getProjectPath() @@ -3091,7 +3193,8 @@ """ Public method to get a reference to the command server interface. - @return reference to the client (HgClient) + @return reference to the client + @rtype HgClient """ if self.__client is None: self.__createClient(self.__repoDir) @@ -3116,9 +3219,11 @@ thread. @param interval check interval for the monitor thread in seconds - (integer) - @param project reference to the project object (Project) - @return reference to the monitor thread (QThread) + @type int + @param project reference to the project object + @type Project + @return reference to the monitor thread + @rtype HgStatusMonitorThread """ from .HgStatusMonitorThread import HgStatusMonitorThread @@ -3146,7 +3251,8 @@ """ Public method to get the list of bookmarks. - @return list of bookmarks (list of string) + @return list of bookmarks + @rtype list of str """ args = self.initCommand("bookmarks") @@ -3170,8 +3276,10 @@ """ Public method to define a bookmark. - @param revision revision to set bookmark for (string) - @param bookmark name of the bookmark (string) + @param revision revision to set bookmark for + @type str + @param bookmark name of the bookmark + @type str """ from .HgBookmarkDialog import HgBookmarkDialog @@ -3206,7 +3314,8 @@ """ Public method to delete a bookmark. - @param bookmark name of the bookmark (string) + @param bookmark name of the bookmark + @type str """ if bookmark: ok = True @@ -3258,8 +3367,10 @@ """ Public method to move a bookmark. - @param revision revision to set bookmark for (string) - @param bookmark name of the bookmark (string) + @param revision revision to set bookmark for + @type str + @param bookmark name of the bookmark + @type str """ from .HgBookmarkDialog import HgBookmarkDialog @@ -3319,8 +3430,10 @@ """ Private method to get the list of incoming or outgoing bookmarks. - @param incoming flag indicating to get incoming bookmarks (boolean) - @return list of bookmarks (list of string) + @param incoming flag indicating to get incoming bookmarks + @type bool + @return list of bookmarks + @rtype list of str """ bookmarksList = []