Commit 8335a06e authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Code model: Update on changes from the versioning system.

Add changed signals to IVersionControl and
VCSManager and wire them to the update methods. Add a menu action for
manually updating. Improved version of reverted
7aa24116

.
Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent 4d45ad00
...@@ -106,6 +106,10 @@ public: ...@@ -106,6 +106,10 @@ public:
*/ */
virtual bool vcsDelete(const QString &filename) = 0; virtual bool vcsDelete(const QString &filename) = 0;
signals:
void repositoryChanged(const QString &repository);
void filesChanged(const QStringList &files);
// TODO: ADD A WAY TO DETECT WHETHER A FILE IS MANAGED, e.g // TODO: ADD A WAY TO DETECT WHETHER A FILE IS MANAGED, e.g
// virtual bool sccManaged(const QString &filename) = 0; // virtual bool sccManaged(const QString &filename) = 0;
}; };
......
...@@ -126,7 +126,7 @@ MainWindow::MainWindow() : ...@@ -126,7 +126,7 @@ MainWindow::MainWindow() :
m_progressManager(new ProgressManagerPrivate()), m_progressManager(new ProgressManagerPrivate()),
m_scriptManager(new ScriptManagerPrivate(this)), m_scriptManager(new ScriptManagerPrivate(this)),
m_variableManager(new VariableManager(this)), m_variableManager(new VariableManager(this)),
m_vcsManager(new VCSManager()), m_vcsManager(new VCSManager),
m_viewManager(0), m_viewManager(0),
m_modeManager(0), m_modeManager(0),
m_mimeDatabase(new MimeDatabase), m_mimeDatabase(new MimeDatabase),
...@@ -346,6 +346,7 @@ void MainWindow::extensionsInitialized() ...@@ -346,6 +346,7 @@ void MainWindow::extensionsInitialized()
OutputPaneManager::instance()->init(); OutputPaneManager::instance()->init();
m_actionManager->initialize(); m_actionManager->initialize();
m_vcsManager->extensionsInitialized();
readSettings(); readSettings();
updateContext(); updateContext();
......
...@@ -57,7 +57,8 @@ struct VCSManagerPrivate { ...@@ -57,7 +57,8 @@ struct VCSManagerPrivate {
QMap<QString, IVersionControl *> m_cachedMatches; QMap<QString, IVersionControl *> m_cachedMatches;
}; };
VCSManager::VCSManager() : VCSManager::VCSManager(QObject *parent) :
QObject(parent),
m_d(new VCSManagerPrivate) m_d(new VCSManagerPrivate)
{ {
} }
...@@ -67,6 +68,17 @@ VCSManager::~VCSManager() ...@@ -67,6 +68,17 @@ VCSManager::~VCSManager()
delete m_d; delete m_d;
} }
void VCSManager::extensionsInitialized()
{
// Change signal connections
foreach (IVersionControl *versionControl, allVersionControls()) {
connect(versionControl, SIGNAL(filesChanged(QStringList)),
this, SIGNAL(filesChanged(QStringList)));
connect(versionControl, SIGNAL(repositoryChanged(QString)),
this, SIGNAL(repositoryChanged(QString)));
}
}
void VCSManager::setVCSEnabled(const QString &directory) void VCSManager::setVCSEnabled(const QString &directory)
{ {
if (debug) if (debug)
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "core_global.h" #include "core_global.h"
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QObject>
namespace Core { namespace Core {
...@@ -49,13 +50,16 @@ class IVersionControl; ...@@ -49,13 +50,16 @@ class IVersionControl;
// for the topmost directory it manages. This information is cached and // for the topmost directory it manages. This information is cached and
// VCSManager thus knows pretty fast which IVersionControl * is responsible. // VCSManager thus knows pretty fast which IVersionControl * is responsible.
class CORE_EXPORT VCSManager class CORE_EXPORT VCSManager : public QObject
{ {
Q_OBJECT
Q_DISABLE_COPY(VCSManager) Q_DISABLE_COPY(VCSManager)
public: public:
VCSManager(); explicit VCSManager(QObject *parent = 0);
virtual ~VCSManager(); virtual ~VCSManager();
void extensionsInitialized();
IVersionControl *findVersionControlForDirectory(const QString &directory); IVersionControl *findVersionControlForDirectory(const QString &directory);
// Enable the VCS managing a certain directory only. This should // Enable the VCS managing a certain directory only. This should
...@@ -69,6 +73,10 @@ public: ...@@ -69,6 +73,10 @@ public:
// if a failure occurs // if a failure occurs
bool showDeleteDialog(const QString &fileName); bool showDeleteDialog(const QString &fileName);
signals:
void repositoryChanged(const QString &repository);
void filesChanged(const QStringList &files);
private: private:
VCSManagerPrivate *m_d; VCSManagerPrivate *m_d;
}; };
......
...@@ -41,8 +41,10 @@ const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationD ...@@ -41,8 +41,10 @@ const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationD
const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor"; const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor";
const char * const FIND_USAGES = "CppEditor.FindUsages"; const char * const FIND_USAGES = "CppEditor.FindUsages";
const char * const SEPARATOR = "CppEditor.Separator"; const char * const SEPARATOR = "CppEditor.Separator";
const char * const SEPARATOR2 = "CppEditor.Separator2";
const char * const FIND_REFERENCES = "CppEditor.FindReferences"; const char * const FIND_REFERENCES = "CppEditor.FindReferences";
const char * const JUMP_TO_DEFINITION = "CppEditor.JumpToDefinition"; const char * const JUMP_TO_DEFINITION = "CppEditor.JumpToDefinition";
const char * const UPDATE_CODEMODEL = "CppEditor.UpdateCodeModel";
const char * const HEADER_FILE_TYPE = "CppHeaderFiles"; const char * const HEADER_FILE_TYPE = "CppHeaderFiles";
const char * const SOURCE_FILE_TYPE = "CppSourceFiles"; const char * const SOURCE_FILE_TYPE = "CppSourceFiles";
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
#include <cpptools/cpptoolsconstants.h> #include <cpptools/cpptoolsconstants.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QSettings> #include <QtCore/QSettings>
...@@ -108,11 +109,26 @@ QStringList CppEditorFactory::mimeTypes() const ...@@ -108,11 +109,26 @@ QStringList CppEditorFactory::mimeTypes() const
///////////////////////////////// CppPlugin ////////////////////////////////// ///////////////////////////////// CppPlugin //////////////////////////////////
static inline
Core::Command *createSeparator(Core::ActionManager *am,
QObject *parent,
const QList<int> &context,
const char *id)
{
QAction *separator = new QAction(parent);
separator->setSeparator(true);
return am->registerAction(separator, QLatin1String(id), context);
}
CppPlugin *CppPlugin::m_instance = 0; CppPlugin *CppPlugin::m_instance = 0;
CppPlugin::CppPlugin() : CppPlugin::CppPlugin() :
m_actionHandler(0), m_actionHandler(0),
m_sortedMethodOverview(false) m_sortedMethodOverview(false),
m_renameSymbolUnderCursorAction(0),
m_findUsagesAction(0),
m_updateCodeModelAction(0)
{ {
m_instance = this; m_instance = this;
} }
...@@ -192,6 +208,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess ...@@ -192,6 +208,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT); Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT);
Core::Command *cmd; Core::Command *cmd;
Core::ActionContainer *cppToolsMenu = am->actionContainer(QLatin1String(CppTools::Constants::M_TOOLS_CPP));
QAction *jumpToDefinition = new QAction(tr("Follow Symbol under Cursor"), this); QAction *jumpToDefinition = new QAction(tr("Follow Symbol under Cursor"), this);
cmd = am->registerAction(jumpToDefinition, cmd = am->registerAction(jumpToDefinition,
...@@ -200,7 +217,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess ...@@ -200,7 +217,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
connect(jumpToDefinition, SIGNAL(triggered()), connect(jumpToDefinition, SIGNAL(triggered()),
this, SLOT(jumpToDefinition())); this, SLOT(jumpToDefinition()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); cppToolsMenu->addAction(cmd);
QAction *switchDeclarationDefinition = new QAction(tr("Switch between Method Declaration/Definition"), this); QAction *switchDeclarationDefinition = new QAction(tr("Switch between Method Declaration/Definition"), this);
cmd = am->registerAction(switchDeclarationDefinition, cmd = am->registerAction(switchDeclarationDefinition,
...@@ -209,14 +226,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess ...@@ -209,14 +226,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
connect(switchDeclarationDefinition, SIGNAL(triggered()), connect(switchDeclarationDefinition, SIGNAL(triggered()),
this, SLOT(switchDeclarationDefinition())); this, SLOT(switchDeclarationDefinition()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); cppToolsMenu->addAction(cmd);
m_findUsagesAction = new QAction(tr("Find Usages"), this); m_findUsagesAction = new QAction(tr("Find Usages"), this);
cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); cppToolsMenu->addAction(cmd);
m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol under Cursor"), this); m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol under Cursor"), this);
cmd = am->registerAction(m_renameSymbolUnderCursorAction, cmd = am->registerAction(m_renameSymbolUnderCursorAction,
...@@ -224,7 +241,17 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess ...@@ -224,7 +241,17 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R")); cmd->setDefaultKeySequence(QKeySequence("CTRL+SHIFT+R"));
connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor())); connect(m_renameSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(renameSymbolUnderCursor()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); cppToolsMenu->addAction(cmd);
// Update context in global context
QList<int> globalContext;
globalContext.append(Core::Constants::C_GLOBAL_ID);
cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR2));
m_updateCodeModelAction = new QAction(tr("Update code model"), this);
cmd = am->registerAction(m_updateCodeModelAction, QLatin1String(Constants::UPDATE_CODEMODEL), globalContext);
CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance();
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
cppToolsMenu->addAction(cmd);
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR, m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
TextEditor::TextEditorActionHandler::Format TextEditor::TextEditorActionHandler::Format
...@@ -233,10 +260,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess ...@@ -233,10 +260,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
m_actionHandler->initializeActions(); m_actionHandler->initializeActions();
QAction *separator = new QAction(this); contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR));
separator->setSeparator(true);
cmd = am->registerAction(separator, CppEditor::Constants::SEPARATOR, context);
contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
...@@ -308,6 +332,7 @@ void CppPlugin::onTaskStarted(const QString &type) ...@@ -308,6 +332,7 @@ void CppPlugin::onTaskStarted(const QString &type)
if (type == CppTools::Constants::TASK_INDEX) { if (type == CppTools::Constants::TASK_INDEX) {
m_renameSymbolUnderCursorAction->setEnabled(false); m_renameSymbolUnderCursorAction->setEnabled(false);
m_findUsagesAction->setEnabled(false); m_findUsagesAction->setEnabled(false);
m_updateCodeModelAction->setEnabled(false);
} }
} }
...@@ -316,6 +341,7 @@ void CppPlugin::onAllTasksFinished(const QString &type) ...@@ -316,6 +341,7 @@ void CppPlugin::onAllTasksFinished(const QString &type)
if (type == CppTools::Constants::TASK_INDEX) { if (type == CppTools::Constants::TASK_INDEX) {
m_renameSymbolUnderCursorAction->setEnabled(true); m_renameSymbolUnderCursorAction->setEnabled(true);
m_findUsagesAction->setEnabled(true); m_findUsagesAction->setEnabled(true);
m_updateCodeModelAction->setEnabled(true);
} }
} }
......
...@@ -90,6 +90,7 @@ private: ...@@ -90,6 +90,7 @@ private:
bool m_sortedMethodOverview; bool m_sortedMethodOverview;
QAction *m_renameSymbolUnderCursorAction; QAction *m_renameSymbolUnderCursorAction;
QAction *m_findUsagesAction; QAction *m_findUsagesAction;
QAction *m_updateCodeModelAction;
}; };
class CppEditorFactory : public Core::IEditorFactory class CppEditorFactory : public Core::IEditorFactory
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/vcsmanager.h>
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
#include <QtCore/QtConcurrentRun> #include <QtCore/QtConcurrentRun>
...@@ -97,6 +98,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -97,6 +98,11 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Objects // Objects
m_modelManager = new CppModelManager(this); m_modelManager = new CppModelManager(this);
Core::VCSManager *vcsManager = core->vcsManager();
connect(vcsManager, SIGNAL(repositoryChanged(QString)),
m_modelManager, SLOT(updateModifiedSourceFiles()));
connect(vcsManager, SIGNAL(filesChanged(QStringList)),
m_modelManager, SLOT(updateModifiedSourceFiles()));
addAutoReleasedObject(m_modelManager); addAutoReleasedObject(m_modelManager);
m_completion = new CppCodeCompletion(m_modelManager); m_completion = new CppCodeCompletion(m_modelManager);
......
...@@ -96,3 +96,14 @@ QString CVSControl::findTopLevelForDirectory(const QString &directory) const ...@@ -96,3 +96,14 @@ QString CVSControl::findTopLevelForDirectory(const QString &directory) const
{ {
return m_plugin->findTopLevelForDirectory(directory); return m_plugin->findTopLevelForDirectory(directory);
} }
void CVSControl::emitRepositoryChanged(const QString &s)
{
emit repositoryChanged(s);
}
void CVSControl::emitFilesChanged(const QStringList &l)
{
emit filesChanged(l);
}
...@@ -56,6 +56,9 @@ public: ...@@ -56,6 +56,9 @@ public:
virtual bool vcsAdd(const QString &fileName); virtual bool vcsAdd(const QString &fileName);
virtual bool vcsDelete(const QString &filename); virtual bool vcsDelete(const QString &filename);
void emitRepositoryChanged(const QString &s);
void emitFilesChanged(const QStringList &l);
signals: signals:
void enabledChanged(bool); void enabledChanged(bool);
......
...@@ -551,9 +551,11 @@ void CVSPlugin::revertCurrentFile() ...@@ -551,9 +551,11 @@ void CVSPlugin::revertCurrentFile()
QStringList args(QLatin1String("update")); QStringList args(QLatin1String("update"));
args.push_back(QLatin1String("-C")); args.push_back(QLatin1String("-C"));
const CVSResponse revertResponse = runCVS(args, QStringList(file), cvsShortTimeOut, true); const QStringList files = QStringList(file);
const CVSResponse revertResponse = runCVS(args, files, cvsShortTimeOut, true);
if (revertResponse.result == CVSResponse::Ok) { if (revertResponse.result == CVSResponse::Ok) {
fcb.setModifiedReload(true); fcb.setModifiedReload(true);
m_versionControl->emitFilesChanged(files);
} }
} }
...@@ -734,7 +736,10 @@ void CVSPlugin::updateProject() ...@@ -734,7 +736,10 @@ void CVSPlugin::updateProject()
if (!topLevels.empty()) { if (!topLevels.empty()) {
QStringList args(QLatin1String("update")); QStringList args(QLatin1String("update"));
args.push_back(QLatin1String("-dR")); args.push_back(QLatin1String("-dR"));
runCVS(args, topLevels, cvsLongTimeOut, true); const CVSResponse response = runCVS(args, topLevels, cvsLongTimeOut, true);
if (response.result == CVSResponse::Ok)
foreach(const QString &topLevel, topLevels)
m_versionControl->emitRepositoryChanged(topLevel);
} }
} }
......
...@@ -59,6 +59,7 @@ namespace CVS { ...@@ -59,6 +59,7 @@ namespace CVS {
namespace Internal { namespace Internal {
class CVSSubmitEditor; class CVSSubmitEditor;
class CVSControl;
struct CVSResponse struct CVSResponse
{ {
...@@ -153,7 +154,7 @@ private: ...@@ -153,7 +154,7 @@ private:
void cleanCommitMessageFile(); void cleanCommitMessageFile();
CVSSettings m_settings; CVSSettings m_settings;
Core::IVersionControl *m_versionControl; CVSControl *m_versionControl;
QString m_commitMessageFileName; QString m_commitMessageFileName;
ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "gitconstants.h" #include "gitconstants.h"
#include "gitplugin.h" #include "gitplugin.h"
#include "gitsubmiteditor.h" #include "gitsubmiteditor.h"
#include "gitversioncontrol.h"
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
...@@ -43,6 +44,9 @@ ...@@ -43,6 +44,9 @@
#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/filemanager.h> #include <coreplugin/filemanager.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/iversioncontrol.h>
#include <texteditor/itexteditor.h> #include <texteditor/itexteditor.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <vcsbase/vcsbaseeditor.h> #include <vcsbase/vcsbaseeditor.h>
...@@ -55,6 +59,7 @@ ...@@ -55,6 +59,7 @@
#include <QtCore/QTime> #include <QtCore/QTime>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QSignalMapper>
#include <QtGui/QMainWindow> // for msg box parent #include <QtGui/QMainWindow> // for msg box parent
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
...@@ -102,7 +107,8 @@ static QString formatCommand(const QString &binary, const QStringList &args) ...@@ -102,7 +107,8 @@ static QString formatCommand(const QString &binary, const QStringList &args)
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)
{ {
if (QSettings *s = m_core->settings()) { if (QSettings *s = m_core->settings()) {
m_settings.fromSettings(s); m_settings.fromSettings(s);
...@@ -317,7 +323,8 @@ void GitClient::checkoutBranch(const QString &workingDirectory, const QString &b ...@@ -317,7 +323,8 @@ void GitClient::checkoutBranch(const QString &workingDirectory, const QString &b
{ {
QStringList arguments(QLatin1String("checkout")); QStringList arguments(QLatin1String("checkout"));
arguments << branch; arguments << branch;
executeGit(workingDirectory, arguments, 0, true); GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true);
connectRepositoryChanged(workingDirectory, cmd);
} }
void GitClient::checkout(const QString &workingDirectory, const QString &fileName) void GitClient::checkout(const QString &workingDirectory, const QString &fileName)
...@@ -341,7 +348,8 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit ...@@ -341,7 +348,8 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit
if (!commit.isEmpty()) if (!commit.isEmpty())
arguments << commit; arguments << commit;
executeGit(workingDirectory, arguments, 0, true); GitCommand *cmd = executeGit(workingDirectory, arguments, 0, true);
connectRepositoryChanged(workingDirectory, cmd);
} }
void GitClient::addFile(const QString &workingDirectory, const QString &fileName) void GitClient::addFile(const QString &workingDirectory, const QString &fileName)
...@@ -500,18 +508,19 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory, ...@@ -500,18 +508,19 @@ GitCommand *GitClient::createCommand(const QString &workingDirectory,
} }
// Execute a single command // Execute a single command
void GitClient::executeGit(const QString &workingDirectory, GitCommand *GitClient::executeGit(const QString &workingDirectory,
const QStringList &arguments, const QStringList &arguments,
VCSBase::VCSBaseEditor* editor, VCSBase::VCSBaseEditor* editor,
bool outputToWindow, bool outputToWindow,
GitCommand::TerminationReportMode tm, GitCommand::TerminationReportMode tm,
int editorLineNumber) int editorLineNumber)
{ {
VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments)); VCSBase::VCSBaseOutputWindow::instance()->appendCommand(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments));
GitCommand *command = createCommand(workingDirectory, editor, outputToWindow, editorLineNumber); GitCommand *command = createCommand(workingDirectory, editor, outputToWindow, editorLineNumber);
command->addJob(arguments, m_settings.timeout); command->addJob(arguments, m_settings.timeout);
command->setTerminationReportMode(tm); command->setTerminationReportMode(tm);
command->execute(); command->execute();
return command;
} }
// Return fixed arguments required to run // Return fixed arguments required to run
...@@ -903,6 +912,8 @@ void GitClient::revert(const QStringList &files) ...@@ -903,6 +912,8 @@ void GitClient::revert(const QStringList &files)
QString errorMessage; QString errorMessage;
switch (revertI(files, &isDirectory, &errorMessage)) { switch (revertI(files, &isDirectory, &errorMessage)) {
case RevertOk: case RevertOk:
m_plugin->versionControl()->emitFilesChanged(files);
break;
case RevertCanceled: case RevertCanceled:
break; break;
case RevertUnchanged: { case RevertUnchanged: {
...@@ -918,7 +929,8 @@ void GitClient::revert(const QStringList &files) ...@@ -918,7 +929,8 @@ void GitClient::revert(const QStringList &files)
void GitClient::pull(const QString &workingDirectory) void GitClient::pull(const QString &workingDirectory)
{ {
executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCommand::ReportStderr); GitCommand *cmd = executeGit(workingDirectory, QStringList(QLatin1String("pull")), 0, true, GitCo