Git: Add m_ prefix to StashGuard members

Change-Id: Ice9f33e986688e8d2c5250435a30cd7cb1ac3b28
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2013-05-26 20:31:07 +03:00
committed by Orgad Shaneh
parent 405dbcb9ca
commit 5d558c141c
2 changed files with 35 additions and 35 deletions

View File

@@ -3301,48 +3301,49 @@ unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
GitClient::StashGuard::StashGuard(const QString &workingDirectory, const QString &keyword, GitClient::StashGuard::StashGuard(const QString &workingDirectory, const QString &keyword,
StashFlag flag) : StashFlag flag) :
pop(true), m_pop(true),
workingDir(workingDirectory), m_workingDir(workingDirectory),
flags(flag) m_flags(flag)
{ {
client = GitPlugin::instance()->gitClient(); m_client = GitPlugin::instance()->gitClient();
QString errorMessage; QString errorMessage;
if (flags & NoPrompt) if (m_flags & NoPrompt)
executeStash(keyword, &errorMessage); executeStash(keyword, &errorMessage);
else else
stashPrompt(keyword, &errorMessage); stashPrompt(keyword, &errorMessage);
if (stashResult == StashFailed) if (m_stashResult == StashFailed)
VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage); VcsBase::VcsBaseOutputWindow::instance()->appendError(errorMessage);
} }
GitClient::StashGuard::~StashGuard() GitClient::StashGuard::~StashGuard()
{ {
if (pop && stashResult == Stashed) { if (m_pop && m_stashResult == Stashed) {
QString stashName; QString stashName;
if (client->stashNameFromMessage(workingDir, message, &stashName)) if (m_client->stashNameFromMessage(m_workingDir, m_message, &stashName))
client->stashPop(workingDir, stashName); m_client->stashPop(m_workingDir, stashName);
} }
} }
void GitClient::StashGuard::stashPrompt(const QString &keyword, QString *errorMessage) void GitClient::StashGuard::stashPrompt(const QString &keyword, QString *errorMessage)
{ {
QString statusOutput; QString statusOutput;
switch (client->gitStatus(workingDir, StatusMode(NoUntracked | NoSubmodules), switch (m_client->gitStatus(m_workingDir, StatusMode(NoUntracked | NoSubmodules),
&statusOutput, errorMessage)) { &statusOutput, errorMessage)) {
case GitClient::StatusChanged: case GitClient::StatusChanged:
break; break;
case GitClient::StatusUnchanged: case GitClient::StatusUnchanged:
stashResult = StashUnchanged; m_stashResult = StashUnchanged;
return; return;
case GitClient::StatusFailed: case GitClient::StatusFailed:
stashResult = StashFailed; m_stashResult = StashFailed;
return; return;
} }
QMessageBox msgBox(QMessageBox::Question, tr("Uncommitted Changes Found"), QMessageBox msgBox(QMessageBox::Question, tr("Uncommitted Changes Found"),
tr("What would you like to do with local changes in:") tr("What would you like to do with local changes in:")
+ QLatin1String("\n\n\"") + workingDir + QLatin1Char('\"'), + QLatin1String("\n\n\"") + m_workingDir + QLatin1Char('\"'),
QMessageBox::NoButton, Core::ICore::mainWindow()); QMessageBox::NoButton, Core::ICore::mainWindow());
msgBox.setDetailedText(statusOutput); msgBox.setDetailedText(statusOutput);
@@ -3354,7 +3355,7 @@ void GitClient::StashGuard::stashPrompt(const QString &keyword, QString *errorMe
discardButton->setToolTip(tr("Discard (reset) local changes and continue.")); discardButton->setToolTip(tr("Discard (reset) local changes and continue."));
QPushButton *ignoreButton = 0; QPushButton *ignoreButton = 0;
if (flags & AllowUnstashed) { if (m_flags & AllowUnstashed) {
ignoreButton = msgBox.addButton(QMessageBox::Ignore); ignoreButton = msgBox.addButton(QMessageBox::Ignore);
ignoreButton->setToolTip(tr("Continue with local changes in working directory.")); ignoreButton->setToolTip(tr("Continue with local changes in working directory."));
} }
@@ -3365,14 +3366,14 @@ void GitClient::StashGuard::stashPrompt(const QString &keyword, QString *errorMe
msgBox.exec(); msgBox.exec();
if (msgBox.clickedButton() == discardButton) { if (msgBox.clickedButton() == discardButton) {
if (!client->synchronousReset(workingDir, QStringList(), errorMessage)) if (!m_client->synchronousReset(m_workingDir, QStringList(), errorMessage))
stashResult = StashFailed; m_stashResult = StashFailed;
else else
stashResult = StashUnchanged; m_stashResult = StashUnchanged;
} else if (msgBox.clickedButton() == ignoreButton) { // At your own risk, so. } else if (msgBox.clickedButton() == ignoreButton) { // At your own risk, so.
stashResult = NotStashed; m_stashResult = NotStashed;
} else if (msgBox.clickedButton() == cancelButton) { } else if (msgBox.clickedButton() == cancelButton) {
stashResult = StashCanceled; m_stashResult = StashCanceled;
} else if (msgBox.clickedButton() == stashButton) { } else if (msgBox.clickedButton() == stashButton) {
executeStash(keyword, errorMessage); executeStash(keyword, errorMessage);
} }
@@ -3380,31 +3381,30 @@ void GitClient::StashGuard::stashPrompt(const QString &keyword, QString *errorMe
void GitClient::StashGuard::executeStash(const QString &keyword, QString *errorMessage) void GitClient::StashGuard::executeStash(const QString &keyword, QString *errorMessage)
{ {
message = creatorStashMessage(keyword); m_message = creatorStashMessage(keyword);
if (!client->executeSynchronousStash(workingDir, message, errorMessage)) if (!m_client->executeSynchronousStash(m_workingDir, m_message, errorMessage))
stashResult = StashFailed; m_stashResult = StashFailed;
else else
stashResult = Stashed; m_stashResult = Stashed;
} }
void GitClient::StashGuard::preventPop() void GitClient::StashGuard::preventPop()
{ {
pop = false; m_pop = false;
} }
bool GitClient::StashGuard::stashingFailed() const bool GitClient::StashGuard::stashingFailed() const
{ {
switch (stashResult) { switch (m_stashResult) {
case StashCanceled: case StashCanceled:
case StashFailed: case StashFailed:
return true; return true;
case NotStashed: case NotStashed:
return !(flags & AllowUnstashed); return !(m_flags & AllowUnstashed);
default: default:
return false; return false;
} }
} }
} // namespace Internal } // namespace Internal
} // namespace Git } // namespace Git

View File

@@ -106,19 +106,19 @@ public:
void preventPop(); void preventPop();
bool stashingFailed() const; bool stashingFailed() const;
StashResult result() const { return stashResult; } StashResult result() const { return m_stashResult; }
QString stashMessage() const { return message; } QString stashMessage() const { return m_message; }
private: private:
void stashPrompt(const QString &keyword, QString *errorMessage); void stashPrompt(const QString &keyword, QString *errorMessage);
void executeStash(const QString &keyword, QString *errorMessage); void executeStash(const QString &keyword, QString *errorMessage);
bool pop; bool m_pop;
StashResult stashResult; StashResult m_stashResult;
QString message; QString m_message;
QString workingDir; QString m_workingDir;
GitClient *client; GitClient *m_client;
StashFlag flags; StashFlag m_flags;
}; };
static const char *stashNamePrefix; static const char *stashNamePrefix;