forked from qt-creator/qt-creator
git: coding style fixes
Change-Id: I554e46cc5e3c1b55bc245f20f7f9541103afb8c5 Reviewed-on: http://codereview.qt-project.org/6070 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -418,8 +418,8 @@ static inline QString msgParseFilesFailed()
|
|||||||
|
|
||||||
const char *GitClient::stashNamePrefix = "stash@{";
|
const char *GitClient::stashNamePrefix = "stash@{";
|
||||||
|
|
||||||
GitClient::GitClient(GitPlugin* plugin)
|
GitClient::GitClient(GitPlugin* plugin) :
|
||||||
: m_msgWait(tr("Waiting for data...")),
|
m_msgWait(tr("Waiting for data...")),
|
||||||
m_plugin(plugin),
|
m_plugin(plugin),
|
||||||
m_core(Core::ICore::instance()),
|
m_core(Core::ICore::instance()),
|
||||||
m_repositoryChangedSignalMapper(0),
|
m_repositoryChangedSignalMapper(0),
|
||||||
@@ -735,8 +735,8 @@ void GitClient::slotBlameRevisionRequested(const QString &source, QString change
|
|||||||
void GitClient::blame(const QString &workingDirectory,
|
void GitClient::blame(const QString &workingDirectory,
|
||||||
const QStringList &args,
|
const QStringList &args,
|
||||||
const QString &fileName,
|
const QString &fileName,
|
||||||
const QString &revision /* = QString() */,
|
const QString &revision,
|
||||||
int lineNumber /* = -1 */)
|
int lineNumber)
|
||||||
{
|
{
|
||||||
const QString editorId = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_ID);
|
const QString editorId = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_ID);
|
||||||
const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDirectory, QStringList(fileName), revision);
|
const QString id = VCSBase::VCSBaseEditorWidget::getTitleId(workingDirectory, QStringList(fileName), revision);
|
||||||
@@ -1085,10 +1085,8 @@ static inline QString msgCannotDetermineBranch(const QString &workingDirectory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve head revision/branch
|
// Retrieve head revision/branch
|
||||||
bool GitClient::synchronousTopRevision(const QString &workingDirectory,
|
bool GitClient::synchronousTopRevision(const QString &workingDirectory, QString *revision,
|
||||||
QString *revision /* = 0 */,
|
QString *branch, QString *errorMessageIn)
|
||||||
QString *branch /* = 0 */,
|
|
||||||
QString *errorMessageIn /* = 0 */)
|
|
||||||
{
|
{
|
||||||
QByteArray outputTextData;
|
QByteArray outputTextData;
|
||||||
QByteArray errorText;
|
QByteArray errorText;
|
||||||
@@ -1147,10 +1145,8 @@ bool GitClient::synchronousTopRevision(const QString &workingDirectory,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Format an entry in a one-liner for selection list using git log.
|
// Format an entry in a one-liner for selection list using git log.
|
||||||
bool GitClient::synchronousShortDescription(const QString &workingDirectory,
|
bool GitClient::synchronousShortDescription(const QString &workingDirectory, const QString &revision,
|
||||||
const QString &revision,
|
const QString &format, QString *description,
|
||||||
const QString &format,
|
|
||||||
QString *description,
|
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
QByteArray outputTextData;
|
QByteArray outputTextData;
|
||||||
@@ -1189,10 +1185,8 @@ static inline QString creatorStashMessage(const QString &keyword = QString())
|
|||||||
* StashImmediateRestore: Immediately re-apply this stash (used for snapshots), user keeps on working
|
* StashImmediateRestore: Immediately re-apply this stash (used for snapshots), user keeps on working
|
||||||
* StashIgnoreUnchanged: Be quiet about unchanged repositories (used for IVersionControl's snapshots). */
|
* StashIgnoreUnchanged: Be quiet about unchanged repositories (used for IVersionControl's snapshots). */
|
||||||
|
|
||||||
QString GitClient::synchronousStash(const QString &workingDirectory,
|
QString GitClient::synchronousStash(const QString &workingDirectory, const QString &messageKeyword,
|
||||||
const QString &messageKeyword /* = QString() */,
|
unsigned flags, bool *unchanged)
|
||||||
unsigned flags,
|
|
||||||
bool *unchanged /* =0 */)
|
|
||||||
{
|
{
|
||||||
if (unchanged)
|
if (unchanged)
|
||||||
*unchanged = false;
|
*unchanged = false;
|
||||||
@@ -1235,7 +1229,7 @@ QString GitClient::synchronousStash(const QString &workingDirectory,
|
|||||||
|
|
||||||
bool GitClient::executeSynchronousStash(const QString &workingDirectory,
|
bool GitClient::executeSynchronousStash(const QString &workingDirectory,
|
||||||
const QString &message,
|
const QString &message,
|
||||||
QString *errorMessage /* = 0*/)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
QByteArray outputText;
|
QByteArray outputText;
|
||||||
QByteArray errorText;
|
QByteArray errorText;
|
||||||
@@ -1261,7 +1255,7 @@ bool GitClient::executeSynchronousStash(const QString &workingDirectory,
|
|||||||
// Resolve a stash name from message
|
// Resolve a stash name from message
|
||||||
bool GitClient::stashNameFromMessage(const QString &workingDirectory,
|
bool GitClient::stashNameFromMessage(const QString &workingDirectory,
|
||||||
const QString &message, QString *name,
|
const QString &message, QString *name,
|
||||||
QString *errorMessage /* = 0 */)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
// All happy
|
// All happy
|
||||||
if (message.startsWith(QLatin1String(stashNamePrefix))) {
|
if (message.startsWith(QLatin1String(stashNamePrefix))) {
|
||||||
@@ -1459,8 +1453,7 @@ QProcessEnvironment GitClient::processEnvironment() const
|
|||||||
|
|
||||||
// Synchronous git execution using Utils::SynchronousProcess, with
|
// Synchronous git execution using Utils::SynchronousProcess, with
|
||||||
// log windows updating.
|
// log windows updating.
|
||||||
Utils::SynchronousProcessResponse
|
Utils::SynchronousProcessResponse GitClient::synchronousGit(const QString &workingDirectory,
|
||||||
GitClient::synchronousGit(const QString &workingDirectory,
|
|
||||||
const QStringList &gitArguments,
|
const QStringList &gitArguments,
|
||||||
unsigned flags,
|
unsigned flags,
|
||||||
QTextCodec *stdOutCodec)
|
QTextCodec *stdOutCodec)
|
||||||
@@ -1505,8 +1498,7 @@ bool GitClient::fullySynchronousGit(const QString &workingDirectory,
|
|||||||
return process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0;
|
return process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int askWithDetailedText(QWidget *parent,
|
||||||
askWithDetailedText(QWidget *parent,
|
|
||||||
const QString &title, const QString &msg,
|
const QString &title, const QString &msg,
|
||||||
const QString &inf,
|
const QString &inf,
|
||||||
QMessageBox::StandardButton defaultButton,
|
QMessageBox::StandardButton defaultButton,
|
||||||
@@ -1698,11 +1690,10 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
|||||||
process->setProcessEnvironment(env);
|
process->setProcessEnvironment(env);
|
||||||
process->start(binary, arguments);
|
process->start(binary, arguments);
|
||||||
success = process->waitForStarted();
|
success = process->waitForStarted();
|
||||||
if (success) {
|
if (success)
|
||||||
connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
|
connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
|
||||||
} else {
|
else
|
||||||
delete process;
|
delete process;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
success = QProcess::startDetached(binary, arguments, workingDirectory);
|
success = QProcess::startDetached(binary, arguments, workingDirectory);
|
||||||
}
|
}
|
||||||
@@ -2132,11 +2123,10 @@ bool GitClient::synchronousStashRestore(const QString &workingDirectory,
|
|||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
QStringList arguments(QLatin1String("stash"));
|
QStringList arguments(QLatin1String("stash"));
|
||||||
if (branch.isEmpty()) {
|
if (branch.isEmpty())
|
||||||
arguments << QLatin1String("apply") << stash;
|
arguments << QLatin1String("apply") << stash;
|
||||||
} else {
|
else
|
||||||
arguments << QLatin1String("branch") << branch << stash;
|
arguments << QLatin1String("branch") << branch << stash;
|
||||||
}
|
|
||||||
QByteArray outputText;
|
QByteArray outputText;
|
||||||
QByteArray errorText;
|
QByteArray errorText;
|
||||||
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
const bool rc = fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
||||||
@@ -2148,11 +2138,10 @@ bool GitClient::synchronousStashRestore(const QString &workingDirectory,
|
|||||||
arg(nativeWorkingDir, stdErr) :
|
arg(nativeWorkingDir, stdErr) :
|
||||||
tr("Cannot restore stash \"%1\" to branch \"%2\": %3").
|
tr("Cannot restore stash \"%1\" to branch \"%2\": %3").
|
||||||
arg(nativeWorkingDir, branch, stdErr);
|
arg(nativeWorkingDir, branch, stdErr);
|
||||||
if (errorMessage) {
|
if (errorMessage)
|
||||||
*errorMessage = msg;
|
*errorMessage = msg;
|
||||||
} else {
|
else
|
||||||
outputWindow()->append(msg);
|
outputWindow()->append(msg);
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QString output = commandOutputFromLocal8Bit(outputText);
|
QString output = commandOutputFromLocal8Bit(outputText);
|
||||||
@@ -2183,11 +2172,10 @@ bool GitClient::synchronousStashRemove(const QString &workingDirectory,
|
|||||||
arg(nativeWorkingDir, stdErr) :
|
arg(nativeWorkingDir, stdErr) :
|
||||||
tr("Cannot remove stash \"%1\" of \"%2\": %3").
|
tr("Cannot remove stash \"%1\" of \"%2\": %3").
|
||||||
arg(stash, nativeWorkingDir, stdErr);
|
arg(stash, nativeWorkingDir, stdErr);
|
||||||
if (errorMessage) {
|
if (errorMessage)
|
||||||
*errorMessage = msg;
|
*errorMessage = msg;
|
||||||
} else {
|
else
|
||||||
outputWindow()->append(msg);
|
outputWindow()->append(msg);
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QString output = commandOutputFromLocal8Bit(outputText);
|
QString output = commandOutputFromLocal8Bit(outputText);
|
||||||
@@ -2314,9 +2302,8 @@ QString GitClient::vcsGetRepositoryURL(const QString &directory)
|
|||||||
|
|
||||||
arguments << QLatin1String("remote.origin.url");
|
arguments << QLatin1String("remote.origin.url");
|
||||||
|
|
||||||
if (fullySynchronousGit(directory, arguments, &outputText, 0, false)) {
|
if (fullySynchronousGit(directory, arguments, &outputText, 0, false))
|
||||||
return commandOutputFromLocal8Bit(outputText);
|
return commandOutputFromLocal8Bit(outputText);
|
||||||
}
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2352,7 +2339,7 @@ void GitClient::connectRepositoryChanged(const QString & repository, GitCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
||||||
unsigned GitClient::gitVersion(bool silent, QString *errorMessage /* = 0 */)
|
unsigned GitClient::gitVersion(bool silent, QString *errorMessage)
|
||||||
{
|
{
|
||||||
if (!m_hasCachedGitVersion) {
|
if (!m_hasCachedGitVersion) {
|
||||||
// Do not execute repeatedly if that fails (due to git
|
// Do not execute repeatedly if that fails (due to git
|
||||||
@@ -2376,7 +2363,7 @@ QString GitClient::gitVersionString(bool silent, QString *errorMessage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
|
||||||
unsigned GitClient::synchronousGitVersion(bool silent, QString *errorMessage /* = 0 */)
|
unsigned GitClient::synchronousGitVersion(bool silent, QString *errorMessage)
|
||||||
{
|
{
|
||||||
// run git --version
|
// run git --version
|
||||||
QByteArray outputText;
|
QByteArray outputText;
|
||||||
|
|||||||
Reference in New Issue
Block a user