--- a/Plugins/VcsPlugins/vcsGit/GitStatusMonitorThread.py Wed Oct 03 14:31:58 2018 +0200 +++ b/Plugins/VcsPlugins/vcsGit/GitStatusMonitorThread.py Wed Oct 03 17:33:40 2018 +0200 @@ -130,6 +130,46 @@ return True, \ self.tr("Git status checked successfully") + def _getInfo(self): + """ + Protected method implementing the real info action. + + This method should be overridden and create a short info message to be + shown in the main window status bar right next to the status indicator. + + @return short info message + @rtype str + """ + args = self.vcs.initCommand("show") + args.append("--abbrev-commit") + args.append("--format=%h %D") + args.append("--no-patch") + + output = "" + process = QProcess() + process.setWorkingDirectory(self.projectDir) + process.start('git', args) + procStarted = process.waitForStarted(5000) + if procStarted: + finished = process.waitForFinished(30000) + if finished and process.exitCode() == 0: + output = str(process.readAllStandardOutput(), + Preferences.getSystem("IOEncoding"), + 'replace') + + if output: + commitId, refs = output.splitlines()[0].strip().split(None, 1) + ref = refs.split(",", 1)[0] + if "->" in ref: + branch = ref.split("->", 1)[1].strip() + else: + branch = self.tr("<detached>") + + return self.tr("{0} / {1}", "branch, commit").format( + branch, commitId) + else: + return "" + def _shutdown(self): """ Protected method performing shutdown actions.