summaryrefslogtreecommitdiff
path: root/src/plugins/git/gitclient.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2013-08-26 23:14:44 +0300
committerOrgad Shaneh <orgads@gmail.com>2013-08-30 12:19:25 +0200
commitfc6ff05472b1196edbd8c7744e9386d7770e6e70 (patch)
treeba4d1e367cce2cdc0dae95e297b78b77d53964d7 /src/plugins/git/gitclient.cpp
parent6c582e0180b7c1bce243e4ac88bcdc7983bdb4ec (diff)
downloadqt-creator-fc6ff05472b1196edbd8c7744e9386d7770e6e70.tar.gz
VCS: Update progress bar for commands that output progress
Change-Id: I643df94c72068259817092d7d48f71984288fdb5 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins/git/gitclient.cpp')
-rw-r--r--src/plugins/git/gitclient.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index eb9d562005..c9ce5894ea 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -829,6 +829,26 @@ private:
QStringList m_files;
};
+class ProgressParser : public VcsBase::ProgressParser
+{
+public:
+ ProgressParser() :
+ m_progressExp(QLatin1String("\\((\\d+)/(\\d+)\\)")) // e.g. Rebasing (7/42)
+ {
+ }
+
+protected:
+ void parseProgress(const QString &text)
+ {
+ if (m_progressExp.lastIndexIn(text) != -1)
+ setProgressAndMaximum(m_progressExp.cap(1).toInt(), m_progressExp.cap(2).toInt());
+ }
+
+private:
+ QRegExp m_progressExp;
+};
+
+
Core::IEditor *locateEditor(const char *property, const QString &entry)
{
@@ -3487,6 +3507,7 @@ void GitClient::rebase(const QString &workingDirectory, const QString &baseBranc
arguments);
VcsBase::Command *command = createCommand(workingDirectory, 0, true);
new ConflictHandler(command, workingDirectory, gitCommand);
+ command->setProgressParser(new ProgressParser);
command->addJob(arguments, -1);
command->execute();
}
@@ -3532,6 +3553,7 @@ void GitClient::interactiveRebase(const QString &workingDirectory, const QString
m_disableEditor = true;
VcsBase::Command *command = createCommand(workingDirectory, 0, true);
new ConflictHandler(command, workingDirectory, QLatin1String("rebase"));
+ command->setProgressParser(new ProgressParser);
command->addJob(arguments, -1);
command->execute();
command->setCookie(workingDirectory);