subversionplugin.cpp 54.5 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2 3 4
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
8
**
9
** Commercial Usage
10
**
11 12 13 14
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
15
**
16
** GNU Lesser General Public License Usage
17
**
18 19 20 21 22 23
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
**
25
** If you are unsure which license is appropriate for your use, please
hjk's avatar
hjk committed
26
** contact the sales department at http://qt.nokia.com/contact.
con's avatar
con committed
27
**
28
**************************************************************************/
hjk's avatar
hjk committed
29

con's avatar
con committed
30 31 32 33 34 35 36 37
#include "subversionplugin.h"

#include "settingspage.h"
#include "subversioneditor.h"

#include "subversionsubmiteditor.h"
#include "subversionconstants.h"
#include "subversioncontrol.h"
38
#include "checkoutwizard.h"
con's avatar
con committed
39 40 41 42

#include <vcsbase/basevcseditorfactory.h>
#include <vcsbase/vcsbaseeditor.h>
#include <vcsbase/basevcssubmiteditorfactory.h>
43
#include <vcsbase/vcsbaseoutputwindow.h>
con's avatar
con committed
44
#include <utils/synchronousprocess.h>
45
#include <utils/parameteraction.h>
con's avatar
con committed
46 47 48 49 50 51

#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/filemanager.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/mimedatabase.h>
52
#include <coreplugin/actionmanager/actionmanager.h>
53 54
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
55
#include <coreplugin/uniqueidmanager.h>
con's avatar
con committed
56
#include <coreplugin/editormanager/editormanager.h>
Friedemann Kleint's avatar
Friedemann Kleint committed
57 58 59

#include <locator/commandlocator.h>

hjk's avatar
hjk committed
60
#include <utils/qtcassert.h>
con's avatar
con committed
61 62

#include <QtCore/QDebug>
63
#include <QtCore/QDir>
con's avatar
con committed
64 65
#include <QtCore/QFileInfo>
#include <QtCore/QTemporaryFile>
66 67
#include <QtCore/QTextCodec>
#include <QtCore/QtPlugin>
68
#include <QtCore/QProcessEnvironment>
69
#include <QtCore/QUrl>
con's avatar
con committed
70
#include <QtGui/QAction>
71 72
#include <QtGui/QFileDialog>
#include <QtGui/QMainWindow>
con's avatar
con committed
73 74
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
75
#include <QtGui/QInputDialog>
76
#include <QtXml/QXmlStreamReader>
77
#include <limits.h>
con's avatar
con committed
78 79 80

using namespace Subversion::Internal;

81 82 83 84 85 86 87 88 89
static const char * const CMD_ID_SUBVERSION_MENU    = "Subversion.Menu";
static const char * const CMD_ID_ADD                = "Subversion.Add";
static const char * const CMD_ID_DELETE_FILE        = "Subversion.Delete";
static const char * const CMD_ID_REVERT             = "Subversion.Revert";
static const char * const CMD_ID_SEPARATOR0         = "Subversion.Separator0";
static const char * const CMD_ID_DIFF_PROJECT       = "Subversion.DiffAll";
static const char * const CMD_ID_DIFF_CURRENT       = "Subversion.DiffCurrent";
static const char * const CMD_ID_SEPARATOR1         = "Subversion.Separator1";
static const char * const CMD_ID_COMMIT_ALL         = "Subversion.CommitAll";
90
static const char * const CMD_ID_REVERT_ALL         = "Subversion.RevertAll";
91 92 93 94 95
static const char * const CMD_ID_COMMIT_CURRENT     = "Subversion.CommitCurrent";
static const char * const CMD_ID_SEPARATOR2         = "Subversion.Separator2";
static const char * const CMD_ID_FILELOG_CURRENT    = "Subversion.FilelogCurrent";
static const char * const CMD_ID_ANNOTATE_CURRENT   = "Subversion.AnnotateCurrent";
static const char * const CMD_ID_SEPARATOR3         = "Subversion.Separator3";
96
static const char * const CMD_ID_SEPARATOR4         = "Subversion.Separator4";
97
static const char * const CMD_ID_STATUS             = "Subversion.Status";
98 99
static const char * const CMD_ID_PROJECTLOG         = "Subversion.ProjectLog";
static const char * const CMD_ID_REPOSITORYLOG      = "Subversion.RepositoryLog";
100 101 102
static const char * const CMD_ID_REPOSITORYUPDATE   = "Subversion.RepositoryUpdate";
static const char * const CMD_ID_REPOSITORYDIFF     = "Subversion.RepositoryDiff";
static const char * const CMD_ID_REPOSITORYSTATUS   = "Subversion.RepositoryStatus";
103
static const char * const CMD_ID_UPDATE             = "Subversion.Update";
104
static const char * const CMD_ID_COMMIT_PROJECT     = "Subversion.CommitProject";
105
static const char * const CMD_ID_DESCRIBE           = "Subversion.Describe";
con's avatar
con committed
106

107 108
static const char *nonInteractiveOptionC = "--non-interactive";

109 110


con's avatar
con committed
111 112 113
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
    VCSBase::RegularCommandOutput,
114 115
    "Subversion Command Log Editor", // id
    QT_TRANSLATE_NOOP("VCS", "Subversion Command Log Editor"), // display name
116
    "Subversion Command Log Editor", // context
con's avatar
con committed
117 118 119
    "application/vnd.nokia.text.scs_svn_commandlog",
    "scslog"},
{   VCSBase::LogOutput,
120 121
    "Subversion File Log Editor",   // id
    QT_TRANSLATE_NOOP("VCS", "Subversion File Log Editor"),   // display_name
122
    "Subversion File Log Editor",   // context
con's avatar
con committed
123 124 125
    "application/vnd.nokia.text.scs_svn_filelog",
    "scsfilelog"},
{    VCSBase::AnnotateOutput,
126 127
    "Subversion Annotation Editor",  // id
    QT_TRANSLATE_NOOP("VCS", "Subversion Annotation Editor"),   // display_name
128
    "Subversion Annotation Editor",  // context
con's avatar
con committed
129 130 131
    "application/vnd.nokia.text.scs_svn_annotation",
    "scsannotate"},
{   VCSBase::DiffOutput,
132 133
    "Subversion Diff Editor",  // id
    QT_TRANSLATE_NOOP("VCS", "Subversion Diff Editor"),   // display_name
134
    "Subversion Diff Editor",  // context
con's avatar
con committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
    "text/x-patch","diff"}
};

// Utility to find a parameter set by type
static inline const VCSBase::VCSBaseEditorParameters *findType(int ie)
{
    const VCSBase::EditorContentType et = static_cast<VCSBase::EditorContentType>(ie);
    return  VCSBase::VCSBaseEditor::findType(editorParameters, sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters), et);
}

static inline QString debugCodec(const QTextCodec *c)
{
    return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
}

hjk's avatar
hjk committed
150
Core::IEditor* locateEditor(const char *property, const QString &entry)
con's avatar
con committed
151
{
152
    foreach (Core::IEditor *ed, Core::EditorManager::instance()->openedEditors())
con's avatar
con committed
153 154 155 156 157
        if (ed->property(property).toString() == entry)
            return ed;
    return 0;
}

158 159 160 161 162 163 164 165 166 167 168 169 170 171
// Parse "svn status" output for added/modified/deleted files
// "M<7blanks>file"
typedef QList<SubversionSubmitEditor::StatusFilePair> StatusList;

StatusList parseStatusOutput(const QString &output)
{
    StatusList changeSet;
    const QString newLine = QString(QLatin1Char('\n'));
    const QStringList list = output.split(newLine, QString::SkipEmptyParts);
    foreach (const QString &l, list) {
        const QString line =l.trimmed();
        if (line.size() > 8) {
            const QChar state = line.at(0);
            if (state == QLatin1Char('A') || state == QLatin1Char('D') || state == QLatin1Char('M')) {
172 173
                const QString fileName = line.mid(7); // Column 8 starting from svn 1.6
                changeSet.push_back(SubversionSubmitEditor::StatusFilePair(QString(state), fileName.trimmed()));
174 175 176 177 178 179 180
            }

        }
    }
    return changeSet;
}

181 182 183 184 185 186 187 188 189 190 191
// Return a list of names for the internal svn directories
static inline QStringList svnDirectories()
{
    QStringList rc(QLatin1String(".svn"));
#ifdef Q_OS_WIN
    // Option on Windows systems to avoid hassle with some IDEs
    rc.push_back(QLatin1String("_svn"));
#endif
    return rc;
}

con's avatar
con committed
192 193 194 195
// ------------- SubversionPlugin
SubversionPlugin *SubversionPlugin::m_subversionPluginInstance = 0;

SubversionPlugin::SubversionPlugin() :
196
    VCSBase::VCSBasePlugin(QLatin1String(Subversion::Constants::SUBVERSIONCOMMITEDITOR_ID)),
197
    m_svnDirectories(svnDirectories()),
Friedemann Kleint's avatar
Friedemann Kleint committed
198
    m_commandLocator(0),
con's avatar
con committed
199 200 201 202 203
    m_addAction(0),
    m_deleteAction(0),
    m_revertAction(0),
    m_diffProjectAction(0),
    m_diffCurrentAction(0),
204 205
    m_logProjectAction(0),
    m_logRepositoryAction(0),
con's avatar
con committed
206
    m_commitAllAction(0),
207
    m_revertRepositoryAction(0),
208 209 210
    m_diffRepositoryAction(0),
    m_statusRepositoryAction(0),
    m_updateRepositoryAction(0),
con's avatar
con committed
211 212 213
    m_commitCurrentAction(0),
    m_filelogCurrentAction(0),
    m_annotateCurrentAction(0),
214
    m_statusProjectAction(0),
con's avatar
con committed
215
    m_updateProjectAction(0),
216
    m_commitProjectAction(0),
217
    m_describeAction(0),
con's avatar
con committed
218 219 220
    m_submitCurrentLogAction(0),
    m_submitDiffAction(0),
    m_submitUndoAction(0),
221
    m_submitRedoAction(0),
222
    m_menuAction(0),
223
    m_submitActionTriggered(false)
con's avatar
con committed
224 225 226 227 228
{
}

SubversionPlugin::~SubversionPlugin()
{
229
    cleanCommitMessageFile();
con's avatar
con committed
230 231
}

232
void SubversionPlugin::cleanCommitMessageFile()
con's avatar
con committed
233
{
234 235 236
    if (!m_commitMessageFileName.isEmpty()) {
        QFile::remove(m_commitMessageFileName);
        m_commitMessageFileName.clear();
237
        m_commitRepository.clear();
con's avatar
con committed
238 239 240
    }
}

241 242 243 244 245
bool SubversionPlugin::isCommitEditorOpen() const
{
    return !m_commitMessageFileName.isEmpty();
}

con's avatar
con committed
246 247
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
    Subversion::Constants::SUBVERSION_SUBMIT_MIMETYPE,
248 249
    Subversion::Constants::SUBVERSIONCOMMITEDITOR_ID,
    Subversion::Constants::SUBVERSIONCOMMITEDITOR_DISPLAY_NAME,
250
    Subversion::Constants::SUBVERSIONCOMMITEDITOR
con's avatar
con committed
251 252
};

253 254 255
static inline Core::Command *createSeparator(QObject *parent,
                                             Core::ActionManager *ami,
                                             const char*id,
256
                                             const Core::Context &globalcontext)
257 258 259 260 261 262
{
    QAction *tmpaction = new QAction(parent);
    tmpaction->setSeparator(true);
    return ami->registerAction(tmpaction, id, globalcontext);
}

263
bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
con's avatar
con committed
264 265 266 267 268 269 270 271
{
    typedef VCSBase::VCSSubmitEditorFactory<SubversionSubmitEditor> SubversionSubmitEditorFactory;
    typedef VCSBase::VCSEditorFactory<SubversionEditor> SubversionEditorFactory;
    using namespace Constants;

    using namespace Core::Constants;
    using namespace ExtensionSystem;

272 273
    VCSBase::VCSBasePlugin::initialize(new SubversionControl(this));

con's avatar
con committed
274
    m_subversionPluginInstance = this;
hjk's avatar
hjk committed
275
    Core::ICore *core = Core::ICore::instance();
con's avatar
con committed
276

hjk's avatar
hjk committed
277
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage))
con's avatar
con committed
278 279
        return false;

hjk's avatar
hjk committed
280
    if (QSettings *settings = core->settings())
con's avatar
con committed
281 282
        m_settings.fromSettings(settings);

283
    addAutoReleasedObject(new SettingsPage);
con's avatar
con committed
284

285
    addAutoReleasedObject(new SubversionSubmitEditorFactory(&submitParameters));
con's avatar
con committed
286 287 288

    static const char *describeSlot = SLOT(describe(QString,QString));
    const int editorCount = sizeof(editorParameters)/sizeof(VCSBase::VCSBaseEditorParameters);
289 290
    for (int i = 0; i < editorCount; i++)
        addAutoReleasedObject(new SubversionEditorFactory(editorParameters + i, this, describeSlot));
con's avatar
con committed
291

292 293
    addAutoReleasedObject(new CheckoutWizard);

Friedemann Kleint's avatar
Friedemann Kleint committed
294 295 296 297 298
    const QString description = QLatin1String("Subversion");
    const QString prefix = QLatin1String("svn");
    m_commandLocator = new Locator::CommandLocator(description, prefix, prefix);
    addAutoReleasedObject(m_commandLocator);

con's avatar
con committed
299
    //register actions
hjk's avatar
hjk committed
300
    Core::ActionManager *ami = core->actionManager();
301
    Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS);
con's avatar
con committed
302

303
    Core::ActionContainer *subversionMenu =
hjk's avatar
hjk committed
304
        ami->createMenu(Core::Id(CMD_ID_SUBVERSION_MENU));
con's avatar
con committed
305 306
    subversionMenu->menu()->setTitle(tr("&Subversion"));
    toolsContainer->addMenu(subversionMenu);
307
    m_menuAction = subversionMenu->menu()->menuAction();
308
    Core::Context globalcontext(C_GLOBAL);
con's avatar
con committed
309
    Core::Command *command;
310 311 312 313

    m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_diffCurrentAction,
        CMD_ID_DIFF_CURRENT, globalcontext);
con's avatar
con committed
314
    command->setAttribute(Core::Command::CA_UpdateText);
315 316
    command->setDefaultKeySequence(QKeySequence(tr("Alt+S,Alt+D")));
    connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
con's avatar
con committed
317
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
318
    m_commandLocator->appendCommand(command);
con's avatar
con committed
319

320 321 322
    m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_filelogCurrentAction,
        CMD_ID_FILELOG_CURRENT, globalcontext);
con's avatar
con committed
323
    command->setAttribute(Core::Command::CA_UpdateText);
324 325
    connect(m_filelogCurrentAction, SIGNAL(triggered()), this,
        SLOT(filelogCurrentFile()));
con's avatar
con committed
326
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
327
    m_commandLocator->appendCommand(command);
con's avatar
con committed
328

329 330 331
    m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_annotateCurrentAction,
        CMD_ID_ANNOTATE_CURRENT, globalcontext);
con's avatar
con committed
332
    command->setAttribute(Core::Command::CA_UpdateText);
333 334
    connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
        SLOT(annotateCurrentFile()));
con's avatar
con committed
335
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
336
    m_commandLocator->appendCommand(command);
con's avatar
con committed
337

338
    subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR0, globalcontext));
con's avatar
con committed
339

340 341
    m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_addAction, CMD_ID_ADD,
con's avatar
con committed
342
        globalcontext);
343
    command->setAttribute(Core::Command::CA_UpdateText);
344 345
    command->setDefaultKeySequence(QKeySequence(tr("Alt+S,Alt+A")));
    connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
con's avatar
con committed
346
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
347
    m_commandLocator->appendCommand(command);
con's avatar
con committed
348

349
    m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
con's avatar
con committed
350
    command = ami->registerAction(m_commitCurrentAction,
351
        CMD_ID_COMMIT_CURRENT, globalcontext);
con's avatar
con committed
352
    command->setAttribute(Core::Command::CA_UpdateText);
con's avatar
con committed
353 354 355
    command->setDefaultKeySequence(QKeySequence(tr("Alt+S,Alt+C")));
    connect(m_commitCurrentAction, SIGNAL(triggered()), this, SLOT(startCommitCurrentFile()));
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
356
    m_commandLocator->appendCommand(command);
con's avatar
con committed
357

358 359 360
    m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
        globalcontext);
con's avatar
con committed
361
    command->setAttribute(Core::Command::CA_UpdateText);
362
    connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
con's avatar
con committed
363
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
364
    m_commandLocator->appendCommand(command);
con's avatar
con committed
365

366 367 368
    m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_revertAction, CMD_ID_REVERT,
        globalcontext);
con's avatar
con committed
369
    command->setAttribute(Core::Command::CA_UpdateText);
370
    connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
con's avatar
con committed
371
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
372
    m_commandLocator->appendCommand(command);
con's avatar
con committed
373

374
    subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR1, globalcontext));
375

376 377 378 379 380 381
    m_diffProjectAction = new Utils::ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
        globalcontext);
    command->setAttribute(Core::Command::CA_UpdateText);
    connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject()));
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
382
    m_commandLocator->appendCommand(command);
con's avatar
con committed
383

384 385
    m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_statusProjectAction, CMD_ID_STATUS,
con's avatar
con committed
386
        globalcontext);
387 388
    command->setAttribute(Core::Command::CA_UpdateText);
    connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus()));
con's avatar
con committed
389
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
390
    m_commandLocator->appendCommand(command);
con's avatar
con committed
391

Friedemann Kleint's avatar
Friedemann Kleint committed
392
    m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
393 394 395 396
    command = ami->registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
    command->setAttribute(Core::Command::CA_UpdateText);
    connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
397
    m_commandLocator->appendCommand(command);
398

399
    m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
400
    command = ami->registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext);
con's avatar
con committed
401
    connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject()));
402
    command->setAttribute(Core::Command::CA_UpdateText);
con's avatar
con committed
403
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
404
    m_commandLocator->appendCommand(command);
con's avatar
con committed
405

406 407 408 409 410 411 412
    m_commitProjectAction = new Utils::ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
    command = ami->registerAction(m_commitProjectAction, CMD_ID_COMMIT_PROJECT, globalcontext);
    connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(startCommitProject()));
    command->setAttribute(Core::Command::CA_UpdateText);
    subversionMenu->addAction(command);
    m_commandLocator->appendCommand(command);

413 414
    subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext));

415 416 417 418 419 420 421 422 423 424 425 426 427
    m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
    command = ami->registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext);
    connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository()));
    subversionMenu->addAction(command);
    m_commandLocator->appendCommand(command);

    m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
    command = ami->registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext);
    connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
    subversionMenu->addAction(command);
    m_commandLocator->appendCommand(command);

    m_logRepositoryAction = new QAction(tr("Log Repository"), this);
428 429 430
    command = ami->registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
    connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
431
    m_commandLocator->appendCommand(command);
432

433 434 435
    m_updateRepositoryAction = new QAction(tr("Update Repository"), this);
    command = ami->registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext);
    connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository()));
436
    subversionMenu->addAction(command);
437
    m_commandLocator->appendCommand(command);
438 439 440 441 442 443

    m_commitAllAction = new QAction(tr("Commit All Files"), this);
    command = ami->registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
        globalcontext);
    connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll()));
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
444
    m_commandLocator->appendCommand(command);
445

446 447 448 449 450
    m_describeAction = new QAction(tr("Describe..."), this);
    command = ami->registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext);
    connect(m_describeAction, SIGNAL(triggered()), this, SLOT(slotDescribe()));
    subversionMenu->addAction(command);

451 452 453 454 455
    m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
    command = ami->registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
        globalcontext);
    connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll()));
    subversionMenu->addAction(command);
Friedemann Kleint's avatar
Friedemann Kleint committed
456
    m_commandLocator->appendCommand(command);
457

con's avatar
con committed
458
    // Actions of the submit editor
459
    Core::Context svncommitcontext(Constants::SUBVERSIONCOMMITEDITOR);
con's avatar
con committed
460

461
    m_submitCurrentLogAction = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this);
con's avatar
con committed
462
    command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext);
463
    command->setAttribute(Core::Command::CA_UpdateText);
con's avatar
con committed
464 465
    connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));

466
    m_submitDiffAction = new QAction(VCSBase::VCSBaseSubmitEditor::diffIcon(), tr("Diff Selected Files"), this);
con's avatar
con committed
467 468 469 470 471 472 473 474 475 476 477
    command = ami->registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, svncommitcontext);

    m_submitUndoAction = new QAction(tr("&Undo"), this);
    command = ami->registerAction(m_submitUndoAction, Core::Constants::UNDO, svncommitcontext);

    m_submitRedoAction = new QAction(tr("&Redo"), this);
    command = ami->registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext);

    return true;
}

478
bool SubversionPlugin::submitEditorAboutToClose(VCSBase::VCSBaseSubmitEditor *submitEditor)
con's avatar
con committed
479
{
480
    if (!isCommitEditorOpen())
con's avatar
con committed
481 482
        return true;

483 484
    Core::IFile *fileIFace = submitEditor->file();
    const SubversionSubmitEditor *editor = qobject_cast<SubversionSubmitEditor *>(submitEditor);
con's avatar
con committed
485 486 487 488 489 490
    if (!fileIFace || !editor)
        return true;

    // Submit editor closing. Make it write out the commit message
    // and retrieve files
    const QFileInfo editorFile(fileIFace->fileName());
491
    const QFileInfo changeFile(m_commitMessageFileName);
con's avatar
con committed
492 493 494
    if (editorFile.absoluteFilePath() != changeFile.absoluteFilePath())
        return true; // Oops?!

495 496
    // Prompt user. Force a prompt unless submit was actually invoked (that
    // is, the editor was closed or shutdown).
497
    SubversionSettings newSettings = m_settings;
498 499 500
    const VCSBase::VCSBaseSubmitEditor::PromptSubmitResult answer =
            editor->promptSubmit(tr("Closing Subversion Editor"),
                                 tr("Do you want to commit the change?"),
501
                                 tr("The commit message check failed. Do you want to commit the change?"),
502
                                 &newSettings.promptToSubmit, !m_submitActionTriggered);
503
    m_submitActionTriggered = false;
con's avatar
con committed
504
    switch (answer) {
505
    case VCSBase::VCSBaseSubmitEditor::SubmitCanceled:
con's avatar
con committed
506
        return false; // Keep editing and change file
507
    case VCSBase::VCSBaseSubmitEditor::SubmitDiscarded:
508
        cleanCommitMessageFile();
con's avatar
con committed
509 510 511 512
        return true; // Cancel all
    default:
        break;
    }
513
    setSettings(newSettings); // in case someone turned prompting off
con's avatar
con committed
514
    const QStringList fileList = editor->checkedFiles();
515
    bool closeEditor = true;
con's avatar
con committed
516 517
    if (!fileList.empty()) {
        // get message & commit
hjk's avatar
hjk committed
518
        Core::ICore::instance()->fileManager()->blockFileChange(fileIFace);
con's avatar
con committed
519
        fileIFace->save();
hjk's avatar
hjk committed
520
        Core::ICore::instance()->fileManager()->unblockFileChange(fileIFace);
521
        closeEditor= commit(m_commitMessageFileName, fileList);
con's avatar
con committed
522
    }
523
    if (closeEditor)
524
        cleanCommitMessageFile();
525
    return closeEditor;
con's avatar
con committed
526 527
}

528
void SubversionPlugin::diffCommitFiles(const QStringList &files)
con's avatar
con committed
529
{
530
    svnDiff(m_commitRepository, files);
con's avatar
con committed
531 532
}

533 534 535 536 537 538
static inline void setDiffBaseDirectory(Core::IEditor *editor, const QString &db)
{
    if (VCSBase::VCSBaseEditor *ve = qobject_cast<VCSBase::VCSBaseEditor*>(editor->widget()))
        ve->setDiffBaseDirectory(db);
}

539
void SubversionPlugin::svnDiff(const QString &workingDir, const QStringList &files, QString diffname)
con's avatar
con committed
540 541 542
{
    if (Subversion::Constants::debug)
        qDebug() << Q_FUNC_INFO << files << diffname;
543
    const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files);
544
    QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VCSBase::VCSBaseEditor::getCodec(source);
con's avatar
con committed
545 546 547 548 549 550 551

    if (files.count() == 1 && diffname.isEmpty())
        diffname = QFileInfo(files.front()).fileName();

    QStringList args(QLatin1String("diff"));
    args << files;

552
    const SubversionResponse response =
553
            runSvn(workingDir, args, m_settings.timeOutMS(), 0, codec);
con's avatar
con committed
554 555 556 557 558 559 560
    if (response.error)
        return;

    // diff of a single file? re-use an existing view if possible to support
    // the common usage pattern of continuously changing and diffing a file
    if (files.count() == 1) {
        // Show in the same editor if diff has been executed before
hjk's avatar
hjk committed
561
        if (Core::IEditor *editor = locateEditor("originalFileName", files.front())) {
con's avatar
con committed
562
            editor->createNew(response.stdOut);
563
            Core::EditorManager::instance()->activateEditor(editor, Core::EditorManager::ModeSwitch);
564
            setDiffBaseDirectory(editor, workingDir);
con's avatar
con committed
565 566 567
            return;
        }
    }
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
568
    const QString title = QString::fromLatin1("svn diff %1").arg(diffname);
con's avatar
con committed
569
    Core::IEditor *editor = showOutputInEditor(title, response.stdOut, VCSBase::DiffOutput, source, codec);
570
    setDiffBaseDirectory(editor, workingDir);
con's avatar
con committed
571 572 573 574 575 576
    if (files.count() == 1)
        editor->setProperty("originalFileName", files.front());
}

SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName)
{
577 578 579
    Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName,
                                                                        QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_ID),
                                                                        Core::EditorManager::ModeSwitch);
con's avatar
con committed
580
    SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
hjk's avatar
hjk committed
581
    QTC_ASSERT(submitEditor, /**/);
582
    submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
583
    connect(submitEditor, SIGNAL(diffSelectedFiles(QStringList)), this, SLOT(diffCommitFiles(QStringList)));
584
    submitEditor->setCheckScriptWorkingDirectory(m_commitRepository);
con's avatar
con committed
585 586 587
    return submitEditor;
}

588
void SubversionPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
con's avatar
con committed
589
{
Friedemann Kleint's avatar
Friedemann Kleint committed
590 591
    if (!enableMenuAction(as, m_menuAction)) {
        m_commandLocator->setEnabled(false);
592
        return;
Friedemann Kleint's avatar
Friedemann Kleint committed
593 594 595 596
    }
    const bool hasTopLevel = currentState().hasTopLevel();
    m_commandLocator->setEnabled(hasTopLevel);
    m_logRepositoryAction->setEnabled(hasTopLevel);
597

598 599 600 601
    const QString projectName = currentState().currentProjectName();
    m_diffProjectAction->setParameter(projectName);
    m_statusProjectAction->setParameter(projectName);
    m_updateProjectAction->setParameter(projectName);
602
    m_logProjectAction->setParameter(projectName);
603
    m_commitProjectAction->setParameter(projectName);
604 605 606 607

    const bool repoEnabled = currentState().hasTopLevel();
    m_commitAllAction->setEnabled(repoEnabled);
    m_describeAction->setEnabled(repoEnabled);
608
    m_revertRepositoryAction->setEnabled(repoEnabled);
609 610 611
    m_diffRepositoryAction->setEnabled(repoEnabled);
    m_statusRepositoryAction->setEnabled(repoEnabled);
    m_updateRepositoryAction->setEnabled(repoEnabled);
612 613 614 615 616 617 618 619 620 621

    const QString fileName = currentState().currentFileName();

    m_addAction->setParameter(fileName);
    m_deleteAction->setParameter(fileName);
    m_revertAction->setParameter(fileName);
    m_diffCurrentAction->setParameter(fileName);
    m_commitCurrentAction->setParameter(fileName);
    m_filelogCurrentAction->setParameter(fileName);
    m_annotateCurrentAction->setParameter(fileName);
con's avatar
con committed
622 623 624 625
}

void SubversionPlugin::addCurrentFile()
{
626 627 628
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasFile(), return)
    vcsAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
con's avatar
con committed
629 630
}

631 632 633 634 635
void SubversionPlugin::revertAll()
{
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasTopLevel(), return)
    const QString title = tr("Revert repository");
Tobias Hunger's avatar
Tobias Hunger committed
636
    if (QMessageBox::warning(0, title, tr("Revert all pending changes to the repository?"),
637 638 639 640 641
                             QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
        return;
    // NoteL: Svn "revert ." doesn not work.
    QStringList args;
    args << QLatin1String("revert") << QLatin1String("--recursive") << state.topLevel();
642 643 644
    const SubversionResponse revertResponse =
            runSvn(state.topLevel(), args, m_settings.timeOutMS(),
                   SshPasswordPrompt|ShowStdOutInLogWindow);
645 646 647 648 649 650 651
    if (revertResponse.error) {
        QMessageBox::warning(0, title, tr("Revert failed: %1").arg(revertResponse.message), QMessageBox::Ok);
    } else {
        subVersionControl()->emitRepositoryChanged(state.topLevel());
    }
}

con's avatar
con committed
652 653
void SubversionPlugin::revertCurrentFile()
{
654 655
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasFile(), return)
con's avatar
con committed
656 657

    QStringList args(QLatin1String("diff"));
658
    args.push_back(state.relativeCurrentFile());
con's avatar
con committed
659

660 661
    const SubversionResponse diffResponse =
            runSvn(state.currentFileTopLevel(), args, m_settings.timeOutMS(), 0);
con's avatar
con committed
662 663 664 665 666
    if (diffResponse.error)
        return;

    if (diffResponse.stdOut.isEmpty())
        return;
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
667
    if (QMessageBox::warning(0, QLatin1String("svn revert"), tr("The file has been changed. Do you want to revert it?"),
con's avatar
con committed
668 669 670
                             QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
        return;

671

672
    Core::FileChangeBlocker fcb(state.currentFile());
con's avatar
con committed
673 674 675

    // revert
    args.clear();
676
    args << QLatin1String("revert") << state.relativeCurrentFile();
con's avatar
con committed
677

678 679 680 681
    const SubversionResponse revertResponse =
            runSvn(state.currentFileTopLevel(), args, m_settings.timeOutMS(),
                   SshPasswordPrompt|ShowStdOutInLogWindow);

682
    if (!revertResponse.error) {
683
        subVersionControl()->emitFilesChanged(QStringList(state.currentFile()));
con's avatar
con committed
684 685 686 687 688
    }
}

void SubversionPlugin::diffProject()
{
689 690 691
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasProject(), return)
    svnDiff(state.currentProjectTopLevel(), state.relativeCurrentProject(), state.currentProjectName());
con's avatar
con committed
692 693 694 695
}

void SubversionPlugin::diffCurrentFile()
{
696 697 698
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasFile(), return)
    svnDiff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
con's avatar
con committed
699 700 701 702
}

void SubversionPlugin::startCommitCurrentFile()
{
703 704 705
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasFile(), return)
    startCommit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
con's avatar
con committed
706 707 708 709
}

void SubversionPlugin::startCommitAll()
{
710 711 712
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasTopLevel(), return);
    startCommit(state.topLevel());
con's avatar
con committed
713 714
}

715 716 717 718 719 720 721
void SubversionPlugin::startCommitProject()
{
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasProject(), return);
    startCommit(state.currentProjectPath());
}

con's avatar
con committed
722 723 724
/* Start commit of files of a single repository by displaying
 * template and files in a submit editor. On closing, the real
 * commit will start. */
725
void SubversionPlugin::startCommit(const QString &workingDir, const QStringList &files)
con's avatar
con committed
726
{
727 728
    if (VCSBase::VCSBaseSubmitEditor::raiseSubmitEditor())
        return;
729
    if (isCommitEditorOpen()) {
730
        VCSBase::VCSBaseOutputWindow::instance()->appendWarning(tr("Another commit is currently being executed."));
con's avatar
con committed
731 732 733 734 735 736
        return;
    }

    QStringList args(QLatin1String("status"));
    args += files;

737 738
    const SubversionResponse response =
            runSvn(workingDir, args, m_settings.timeOutMS(), 0);
con's avatar
con committed
739 740
    if (response.error)
        return;
741

con's avatar
con committed
742
    // Get list of added/modified/deleted files
743
    const StatusList statusOutput = parseStatusOutput(response.stdOut);
con's avatar
con committed
744
    if (statusOutput.empty()) {
745
        VCSBase::VCSBaseOutputWindow::instance()->appendWarning(tr("There are no modified files."));
con's avatar
con committed
746 747
        return;
    }
748
    m_commitRepository = workingDir;
con's avatar
con committed
749
    // Create a new submit change file containing the submit template
750 751 752 753
    QTemporaryFile changeTmpFile;
    changeTmpFile.setAutoRemove(false);
    if (!changeTmpFile.open()) {
        VCSBase::VCSBaseOutputWindow::instance()->appendError(tr("Cannot create temporary file: %1").arg(changeTmpFile.errorString()));
con's avatar
con committed
754 755
        return;
    }
756
    m_commitMessageFileName = changeTmpFile.fileName();
757
    // TODO: Regitctrieve submit template from
con's avatar
con committed
758 759
    const QString submitTemplate;
    // Create a submit
760 761 762
    changeTmpFile.write(submitTemplate.toUtf8());
    changeTmpFile.flush();
    changeTmpFile.close();
con's avatar
con committed
763
    // Create a submit editor and set file list
764
    SubversionSubmitEditor *editor = openSubversionSubmitEditor(m_commitMessageFileName);
765
    editor->setStatusList(statusOutput);
con's avatar
con committed
766 767 768 769 770 771 772 773 774 775 776
}

bool SubversionPlugin::commit(const QString &messageFile,
                              const QStringList &subVersionFileList)
{
    if (Subversion::Constants::debug)
        qDebug() << Q_FUNC_INFO << messageFile << subVersionFileList;
    // Transform the status list which is sth
    // "[ADM]<blanks>file" into an args list. The files of the status log
    // can be relative or absolute depending on where the command was run.
    QStringList args = QStringList(QLatin1String("commit"));
777
    args << QLatin1String(nonInteractiveOptionC) << QLatin1String("--file") << messageFile;
con's avatar
con committed
778
    args.append(subVersionFileList);
779 780 781
    const SubversionResponse response =
            runSvn(m_commitRepository, args, m_settings.longTimeOutMS(),
                   SshPasswordPrompt|ShowStdOutInLogWindow);
con's avatar
con committed
782 783 784 785 786
    return !response.error ;
}

void SubversionPlugin::filelogCurrentFile()
{
787 788
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasFile(), return)
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803
   filelog(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), true);
}

void SubversionPlugin::logProject()
{
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasProject(), return)
    filelog(state.currentProjectTopLevel(), state.relativeCurrentProject());
}

void SubversionPlugin::logRepository()
{
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasTopLevel(), return)
    filelog(state.topLevel());
con's avatar
con committed
804 805
}

806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835
void SubversionPlugin::diffRepository()
{
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasTopLevel(), return)
    svnDiff(state.topLevel(), QStringList());
}

void SubversionPlugin::statusRepository()
{
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasTopLevel(), return)
    svnStatus(state.topLevel());
}

void SubversionPlugin::updateRepository()
{
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasTopLevel(), return)
    svnUpdate(state.topLevel());
}

void SubversionPlugin::svnStatus(const QString &workingDir, const QStringList &relativePaths)
{
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasTopLevel(), return)
    QStringList args(QLatin1String("status"));
    if (!relativePaths.isEmpty())
        args.append(relativePaths);
    VCSBase::VCSBaseOutputWindow *outwin = VCSBase::VCSBaseOutputWindow::instance();
    outwin->setRepository(workingDir);
836
    runSvn(workingDir, args, m_settings.timeOutMS(),
837
           ShowStdOutInLogWindow|ShowSuccessMessage);
838 839 840
    outwin->clearRepository();
}

841 842 843
void SubversionPlugin::filelog(const QString &workingDir,
                               const QStringList &files,
                               bool enableAnnotationContextMenu)
con's avatar
con committed
844
{
845
    QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(workingDir, files);
con's avatar
con committed
846 847
    // no need for temp file
    QStringList args(QLatin1String("log"));
848 849
    if (m_settings.logCount > 0)
        args << QLatin1String("-l") << QString::number(m_settings.logCount);
850 851
    foreach(const QString &file, files)
        args.append(QDir::toNativeSeparators(file));
con's avatar
con committed
852

853 854 855
    const SubversionResponse response =
            runSvn(workingDir, args, m_settings.timeOutMS(),
                   SshPasswordPrompt, codec);
con's avatar
con committed
856 857 858 859 860 861
    if (response.error)
        return;

    // Re-use an existing view if possible to support
    // the common usage pattern of continuously changing and diffing a file

862 863
    const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDir, files);
    if (Core::IEditor *editor = locateEditor("logFileName", id)) {
con's avatar
con committed
864
        editor->createNew(response.stdOut);
865
        Core::EditorManager::instance()->activateEditor(editor, Core::EditorManager::ModeSwitch);
con's avatar
con committed
866
    } else {
867 868 869 870
        const QString title = QString::fromLatin1("svn log %1").arg(id);
        const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, files);
        Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::LogOutput, source, codec);
        newEditor->setProperty("logFileName", id);
871 872
        if (enableAnnotationContextMenu)
            VCSBase::VCSBaseEditor::getVcsBaseEditor(newEditor)->setFileLogAnnotateEnabled(true);
con's avatar
con committed
873 874 875 876 877
    }
}

void SubversionPlugin::updateProject()
{
878 879
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasProject(), return);
880 881
    svnUpdate(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
con's avatar
con committed
882

883 884
void SubversionPlugin::svnUpdate(const QString &workingDir, const QStringList &relativePaths)
{
con's avatar
con committed
885
    QStringList args(QLatin1String("update"));
886
    args.push_back(QLatin1String(nonInteractiveOptionC));
887 888
    if (!relativePaths.isEmpty())
        args.append(relativePaths);
889 890 891
        const SubversionResponse response =
                runSvn(workingDir, args, m_settings.longTimeOutMS(),
                       SshPasswordPrompt|ShowStdOutInLogWindow);
892
    if (!response.error)
893
        subVersionControl()->emitRepositoryChanged(workingDir);
con's avatar
con committed
894 895 896 897
}

void SubversionPlugin::annotateCurrentFile()
{
898 899
    const VCSBase::VCSBasePluginState state = currentState();
    QTC_ASSERT(state.hasFile(), return);
900
    vcsAnnotate(state.currentFileTopLevel(), state.relativeCurrentFile());
con's avatar
con committed