forked from qt-creator/qt-creator
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: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
969f9628db
commit
afcb9b2c41
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user