Commit afcb9b2c authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Git: Show active branch next to command in progress



Revised topic is "master (MERGING)" instead of MERGING

This should also fix topic getting stuck as REBASING

Change-Id: I934643f5b4e632318495f141536c666f775bd15d
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 969f9628
......@@ -1714,20 +1714,6 @@ QString GitClient::synchronousTopic(const QString &workingDirectory)
if (!branch.isEmpty())
return data.topic = branch;
switch (checkCommandInProgressInGitDir(gitDir)) {
case Rebase:
case RebaseMerge:
return data.topic = tr("REBASING");
case Revert:
return data.topic = tr("REVERTING");
case CherryPick:
return data.topic = tr("CHERRY-PICKING");
case Merge:
return data.topic = tr("MERGING");
default:
break;
}
// Detached HEAD, try a tag or remote branch
QStringList references;
if (!synchronousHeadRefs(workingDirectory, &references))
......@@ -2451,8 +2437,27 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory, St
return StatusUnchanged;
}
GitClient::CommandInProgress GitClient::checkCommandInProgressInGitDir(const QString &gitDir)
QString GitClient::commandInProgressDescription(const QString &workingDirectory)
{
switch (checkCommandInProgress(workingDirectory)) {
case NoCommand:
break;
case Rebase:
case RebaseMerge:
return tr("REBASING");
case Revert:
return tr("REVERTING");
case CherryPick:
return tr("CHERRY-PICKING");
case Merge:
return tr("MERGING");
}
return QString();
}
GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &workingDirectory)
{
const QString gitDir = findGitDirForRepository(workingDirectory);
if (QFile::exists(gitDir + QLatin1String("/MERGE_HEAD")))
return Merge;
else if (QFile::exists(gitDir + QLatin1String("/rebase-apply/rebasing")))
......@@ -2467,11 +2472,6 @@ GitClient::CommandInProgress GitClient::checkCommandInProgressInGitDir(const QSt
return NoCommand;
}
GitClient::CommandInProgress GitClient::checkCommandInProgress(const QString &workingDirectory)
{
return checkCommandInProgressInGitDir(findGitDirForRepository(workingDirectory));
}
void GitClient::continueCommandIfNeeded(const QString &workingDirectory)
{
CommandInProgress command = checkCommandInProgress(workingDirectory);
......
......@@ -294,7 +294,7 @@ public:
QString *errorMessage = 0);
CommandInProgress checkCommandInProgress(const QString &workingDirectory);
CommandInProgress checkCommandInProgressInGitDir(const QString &gitDir);
QString commandInProgressDescription(const QString &workingDirectory);
void continueCommandIfNeeded(const QString &workingDirectory);
void continuePreviousGitCommand(const QString &workingDirectory, const QString &msgBoxTitle, QString msgBoxText,
......
......@@ -124,7 +124,11 @@ QString GitVersionControl::vcsGetRepositoryURL(const QString &directory)
QString GitVersionControl::vcsTopic(const QString &directory)
{
return m_client->synchronousTopic(directory);
QString topic = m_client->synchronousTopic(directory);
const QString commandInProgress = m_client->commandInProgressDescription(directory);
if (!commandInProgress.isEmpty())
topic += QLatin1String(" (") + commandInProgress + QLatin1Char(')');
return topic;
}
/* Snapshots are implemented using stashes, relying on stash messages for
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment