diff options
author | Friedemann Kleint <[email protected]> | 2010-03-12 15:54:09 +0100 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2010-03-12 15:54:09 +0100 |
commit | 93b156e58539f49b30f535bc9942d0c7fad0c097 (patch) | |
tree | edae91c62c9036a5faeb1898dd08be52e84daf51 /src/plugins/git/gitclient.cpp | |
parent | 37c042703f779b654227bf04623ac718b3819d7c (diff) |
VCS[git]: Add support for cleaning a repository.
Present user with a checkable list of files to be cleaned (add reusable
dialog to VCSBase module).
Diffstat (limited to 'src/plugins/git/gitclient.cpp')
-rw-r--r-- | src/plugins/git/gitclient.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 97460f867dd..b7ad77b1d53 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -949,6 +949,30 @@ bool GitClient::synchronousShow(const QString &workingDirectory, const QString & return true; } +// Retrieve list of files to be cleaned +bool GitClient::synchronousCleanList(const QString &workingDirectory, + QStringList *files, QString *errorMessage) +{ + if (Git::Constants::debug) + qDebug() << Q_FUNC_INFO << workingDirectory; + files->clear(); + QStringList args; + args << QLatin1String("clean") << QLatin1String("--dry-run") << QLatin1String("-dxf"); + QByteArray outputText; + QByteArray errorText; + const bool rc = synchronousGit(workingDirectory, args, &outputText, &errorText); + if (!rc) { + *errorMessage = tr("Unable to run clean --dry-run: %1: %2").arg(workingDirectory, commandOutputFromLocal8Bit(errorText)); + return false; + } + // Filter files that git would remove + const QString prefix = QLatin1String("Would remove "); + foreach(const QString &line, commandOutputLinesFromLocal8Bit(outputText)) + if (line.startsWith(prefix)) + files->push_back(line.mid(prefix.size())); + return true; +} + // Factory function to create an asynchronous command GitCommand *GitClient::createCommand(const QString &workingDirectory, VCSBase::VCSBaseEditor* editor, |