Sat, 10 Oct 2015 12:07:41 +0200
Fixed an issue with the Mercurial commit command when amending a commit but not given a commit message.
--- a/APIs/Python3/eric6.api Thu Oct 01 19:05:11 2015 +0200 +++ b/APIs/Python3/eric6.api Sat Oct 10 12:07:41 2015 +0200 @@ -9083,6 +9083,7 @@ eric6.install.main?4(argv) eric6.install.modDir?7 eric6.install.platBinDir?7 +eric6.install.platBinDirOld?7 eric6.install.prepareInfoFile?4(fileName) eric6.install.progLanguages?7 eric6.install.progName?7
--- a/Documentation/Help/source.qhp Thu Oct 01 19:05:11 2015 +0200 +++ b/Documentation/Help/source.qhp Sat Oct 10 12:07:41 2015 +0200 @@ -5586,6 +5586,7 @@ <keyword name="Hg.__checkDefaults" id="Hg.__checkDefaults" ref="eric6.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.__checkDefaults" /> <keyword name="Hg.__getExtensionsInfo" id="Hg.__getExtensionsInfo" ref="eric6.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.__getExtensionsInfo" /> <keyword name="Hg.__getInOutBookmarks" id="Hg.__getInOutBookmarks" ref="eric6.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.__getInOutBookmarks" /> + <keyword name="Hg.__getMostRecentCommitMessage" id="Hg.__getMostRecentCommitMessage" ref="eric6.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.__getMostRecentCommitMessage" /> <keyword name="Hg.__hgGetFileForRevision" id="Hg.__hgGetFileForRevision" ref="eric6.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.__hgGetFileForRevision" /> <keyword name="Hg.__hgURL" id="Hg.__hgURL" ref="eric6.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.__hgURL" /> <keyword name="Hg.__iniFileChanged" id="Hg.__iniFileChanged" ref="eric6.Plugins.VcsPlugins.vcsMercurial.hg.html#Hg.__iniFileChanged" />
--- a/Documentation/Source/eric6.Plugins.VcsPlugins.vcsMercurial.hg.html Thu Oct 01 19:05:11 2015 +0200 +++ b/Documentation/Source/eric6.Plugins.VcsPlugins.vcsMercurial.hg.html Sat Oct 10 12:07:41 2015 +0200 @@ -83,6 +83,9 @@ <td><a href="#Hg.__getInOutBookmarks">__getInOutBookmarks</a></td> <td>Private method to get the list of incoming or outgoing bookmarks.</td> </tr><tr> +<td><a href="#Hg.__getMostRecentCommitMessage">__getMostRecentCommitMessage</a></td> +<td>Private method to get the most recent commit message.</td> +</tr><tr> <td><a href="#Hg.__hgGetFileForRevision">__hgGetFileForRevision</a></td> <td>Private method to get a file for a specific revision from the repository.</td> </tr><tr> @@ -448,6 +451,24 @@ <dd> list of bookmarks (list of string) </dd> +</dl><a NAME="Hg.__getMostRecentCommitMessage" ID="Hg.__getMostRecentCommitMessage"></a> +<h4>Hg.__getMostRecentCommitMessage</h4> +<b>__getMostRecentCommitMessage</b>(<i>repodir</i>) +<p> + Private method to get the most recent commit message. +</p><p> + Note: This message is extracted from the parent commit of the + working directory. +</p><dl> +<dt><i>repodir</i></dt> +<dd> +path containing the repository (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +most recent commit message (string) +</dd> </dl><a NAME="Hg.__hgGetFileForRevision" ID="Hg.__hgGetFileForRevision"></a> <h4>Hg.__hgGetFileForRevision</h4> <b>__hgGetFileForRevision</b>(<i>name, rev=""</i>)
--- a/Documentation/Source/eric6.install.html Thu Oct 01 19:05:11 2015 +0200 +++ b/Documentation/Source/eric6.install.html Sat Oct 10 12:07:41 2015 +0200 @@ -25,7 +25,7 @@ </p> <h3>Global Attributes</h3> <table> -<tr><td>BlackLists</td></tr><tr><td>PlatformsBlackLists</td></tr><tr><td>PythonMarkers</td></tr><tr><td>PythonTextMarkers</td></tr><tr><td>apisDir</td></tr><tr><td>cfg</td></tr><tr><td>configLength</td></tr><tr><td>configName</td></tr><tr><td>currDir</td></tr><tr><td>defaultMacAppBundleName</td></tr><tr><td>defaultMacAppBundlePath</td></tr><tr><td>defaultMacPythonExe</td></tr><tr><td>distDir</td></tr><tr><td>doCleanup</td></tr><tr><td>doCompile</td></tr><tr><td>includePythonVariant</td></tr><tr><td>installApis</td></tr><tr><td>macAppBundleName</td></tr><tr><td>macAppBundlePath</td></tr><tr><td>macPythonExe</td></tr><tr><td>modDir</td></tr><tr><td>platBinDir</td></tr><tr><td>progLanguages</td></tr><tr><td>progName</td></tr><tr><td>pyModDir</td></tr><tr><td>pyqtOverride</td></tr><tr><td>pyqtVariant</td></tr><tr><td>sourceDir</td></tr> +<tr><td>BlackLists</td></tr><tr><td>PlatformsBlackLists</td></tr><tr><td>PythonMarkers</td></tr><tr><td>PythonTextMarkers</td></tr><tr><td>apisDir</td></tr><tr><td>cfg</td></tr><tr><td>configLength</td></tr><tr><td>configName</td></tr><tr><td>currDir</td></tr><tr><td>defaultMacAppBundleName</td></tr><tr><td>defaultMacAppBundlePath</td></tr><tr><td>defaultMacPythonExe</td></tr><tr><td>distDir</td></tr><tr><td>doCleanup</td></tr><tr><td>doCompile</td></tr><tr><td>includePythonVariant</td></tr><tr><td>installApis</td></tr><tr><td>macAppBundleName</td></tr><tr><td>macAppBundlePath</td></tr><tr><td>macPythonExe</td></tr><tr><td>modDir</td></tr><tr><td>platBinDir</td></tr><tr><td>platBinDirOld</td></tr><tr><td>progLanguages</td></tr><tr><td>progName</td></tr><tr><td>pyModDir</td></tr><tr><td>pyqtOverride</td></tr><tr><td>pyqtVariant</td></tr><tr><td>sourceDir</td></tr> </table> <h3>Classes</h3> <table>
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py Thu Oct 01 19:05:11 2015 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/hg.py Sat Oct 10 12:07:41 2015 +0200 @@ -510,12 +510,26 @@ if not res: return + if isinstance(name, list): + dname, fnames = self.splitPathList(name) + else: + dname, fname = self.splitPath(name) + + # find the root of the repo + repodir = dname + 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 + if self.__commitDialog is not None: msg = self.__commitDialog.logMessage() amend = self.__commitDialog.amend() commitSubrepositories = self.__commitDialog.commitSubrepositories() self.__commitDialog.deleteLater() self.__commitDialog = None + if amend and not msg: + msg = self.__getMostRecentCommitMessage(repodir) else: amend = False commitSubrepositories = False @@ -537,18 +551,6 @@ if msg: args.append("--message") args.append(msg) - if isinstance(name, list): - dname, fnames = self.splitPathList(name) - else: - dname, fname = self.splitPath(name) - - # find the root of the repo - repodir = dname - 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 - if self.__client: if isinstance(name, list): self.addArguments(args, name) @@ -579,6 +581,38 @@ self.__forgotNames = [] self.checkVCSStatus() + def __getMostRecentCommitMessage(self, repodir): + """ + Private method to get the most recent commit message. + + Note: This message is extracted from the parent commit of the + working directory. + + @param repodir path containing the repository (string) + @return most recent commit message (string) + """ + args = self.initCommand("log") + args.append("--rev") + args.append(".") + args.append('--template') + args.append('{desc}') + + output = "" + if self.__client is None: + process = QProcess() + process.setWorkingDirectory(repodir) + process.start('hg', args) + procStarted = process.waitForStarted(5000) + if procStarted: + finished = process.waitForFinished(30000) + if finished and process.exitCode() == 0: + output = str(process.readAllStandardOutput(), + self.getEncoding(), 'replace') + else: + output, error = self.__client.runcommand(args) + + return output + def vcsUpdate(self, name, noDialog=False, revision=None): """ Public method used to update a file/directory with the Mercurial