VCS: Introduce configureable timeout to vcs,svn, p4.

as already present for git, mercurial.

Task-number: QTCREATORBUG-475
This commit is contained in:
Friedemann Kleint
2009-12-14 12:45:45 +01:00
parent e600c0ddba
commit dde46ec1eb
16 changed files with 159 additions and 54 deletions

View File

@@ -79,11 +79,6 @@ static inline QString msgLogParsingFailed()
return CVSPlugin::tr("Parsing of the log output failed");
}
// Timeout for normal output commands
enum { cvsShortTimeOut = 10000 };
// Timeout for submit, update
enum { cvsLongTimeOut = 120000 };
static const char * const CMD_ID_CVS_MENU = "CVS.Menu";
static const char * const CMD_ID_ADD = "CVS.Add";
static const char * const CMD_ID_DELETE_FILE = "CVS.Delete";
@@ -434,7 +429,7 @@ void CVSPlugin::cvsDiff(const QString &workingDir, const QStringList &files)
// CVS returns the diff exit code (1 if files differ), which is
// undistinguishable from a "file not found" error, unfortunately.
const CVSResponse response = runCVS(workingDir, args, cvsShortTimeOut, false, codec);
const CVSResponse response = runCVS(workingDir, args, m_settings.timeOutMS(), false, codec);
switch (response.result) {
case CVSResponse::NonNullExitCode:
case CVSResponse::Ok:
@@ -518,7 +513,7 @@ void CVSPlugin::revertCurrentFile()
QTC_ASSERT(state.hasFile(), return)
QStringList args;
args << QLatin1String("diff") << state.relativeCurrentFile();
const CVSResponse diffResponse = runCVS(state.currentFileTopLevel(), args, cvsShortTimeOut, false);
const CVSResponse diffResponse = runCVS(state.currentFileTopLevel(), args, m_settings.timeOutMS(), false);
switch (diffResponse.result) {
case CVSResponse::Ok:
return; // Not modified, diff exit code 0
@@ -539,7 +534,7 @@ void CVSPlugin::revertCurrentFile()
// revert
args.clear();
args << QLatin1String("update") << QLatin1String("-C") << state.relativeCurrentFile();
const CVSResponse revertResponse = runCVS(state.currentFileTopLevel(), args, cvsShortTimeOut, true);
const CVSResponse revertResponse = runCVS(state.currentFileTopLevel(), args, m_settings.timeOutMS(), true);
if (revertResponse.result == CVSResponse::Ok) {
fcb.setModifiedReload(true);
cvsVersionControl()->emitFilesChanged(QStringList(state.currentFile()));
@@ -589,7 +584,7 @@ void CVSPlugin::startCommit(const QString &workingDir, const QStringList &files)
// We need the "Examining <subdir>" stderr output to tell
// where we are, so, have stdout/stderr channels merged.
QStringList args = QStringList(QLatin1String("status"));
const CVSResponse response = runCVS(workingDir, args, cvsShortTimeOut, false, 0, true);
const CVSResponse response = runCVS(workingDir, args, m_settings.timeOutMS(), false, 0, true);
if (response.result != CVSResponse::Ok)
return;
// Get list of added/modified/deleted files and purge out undesired ones
@@ -638,7 +633,7 @@ bool CVSPlugin::commit(const QString &messageFile,
QStringList args = QStringList(QLatin1String("commit"));
args << QLatin1String("-F") << messageFile;
args.append(fileList);
const CVSResponse response = runCVS(m_commitRepository, args, cvsLongTimeOut, true);
const CVSResponse response = runCVS(m_commitRepository, args, m_settings.longTimeOutMS(), true);
return response.result == CVSResponse::Ok ;
}
@@ -658,7 +653,7 @@ void CVSPlugin::filelog(const QString &workingDir, const QStringList &files)
QStringList args;
args << QLatin1String("log");
args.append(files);
const CVSResponse response = runCVS(workingDir, args, cvsShortTimeOut, false, codec);
const CVSResponse response = runCVS(workingDir, args, m_settings.timeOutMS(), false, codec);
if (response.result != CVSResponse::Ok)
return;
@@ -683,7 +678,7 @@ void CVSPlugin::updateProject()
QStringList args(QLatin1String("update"));
args.push_back(QLatin1String("-dR"));
args.append(state.relativeCurrentProject());
const CVSResponse response = runCVS(state.currentProjectTopLevel(), args, cvsLongTimeOut, true);
const CVSResponse response = runCVS(state.currentProjectTopLevel(), args, m_settings.longTimeOutMS(), true);
if (response.result == CVSResponse::Ok)
cvsVersionControl()->emitRepositoryChanged(state.currentProjectTopLevel());
}
@@ -703,7 +698,7 @@ void CVSPlugin::annotate(const QString &workingDir, const QString &file)
const QString source = VCSBase::VCSBaseEditor::getSource(workingDir, file);
QStringList args;
args << QLatin1String("annotate") << file;
const CVSResponse response = runCVS(workingDir, args, cvsShortTimeOut, false, codec);
const CVSResponse response = runCVS(workingDir, args, m_settings.timeOutMS(), false, codec);
if (response.result != CVSResponse::Ok)
return;
@@ -729,7 +724,7 @@ void CVSPlugin::projectStatus()
QTC_ASSERT(state.hasProject(), return)
QStringList args;
args << QLatin1String("status") << state.relativeCurrentProject();
const CVSResponse response = runCVS(state.currentProjectTopLevel(), args, cvsShortTimeOut, false);
const CVSResponse response = runCVS(state.currentProjectTopLevel(), args, m_settings.timeOutMS(), false);
if (response.result == CVSResponse::Ok)
showOutputInEditor(tr("Project status"), response.stdOut, VCSBase::RegularCommandOutput, state.currentProjectTopLevel(), 0);
}
@@ -787,7 +782,7 @@ bool CVSPlugin::describe(const QString &toplevel, const QString &file, const
// Run log to obtain commit id and details
QStringList args;
args << QLatin1String("log") << (QLatin1String("-r") + changeNr) << file;
const CVSResponse logResponse = runCVS(toplevel, args, cvsShortTimeOut, false);
const CVSResponse logResponse = runCVS(toplevel, args, m_settings.timeOutMS(), false);
if (logResponse.result != CVSResponse::Ok) {
*errorMessage = logResponse.message;
return false;
@@ -808,7 +803,7 @@ bool CVSPlugin::describe(const QString &toplevel, const QString &file, const
args.clear();
args << QLatin1String("log") << QLatin1String("-d") << (dateS + QLatin1Char('<') + nextDayS);
const CVSResponse repoLogResponse = runCVS(toplevel, args, cvsLongTimeOut, false);
const CVSResponse repoLogResponse = runCVS(toplevel, args, m_settings.longTimeOutMS(), false);
if (repoLogResponse.result != CVSResponse::Ok) {
*errorMessage = repoLogResponse.message;
return false;
@@ -844,7 +839,7 @@ bool CVSPlugin::describe(const QString &repositoryPath,
// Run log
QStringList args(QLatin1String("log"));
args << (QLatin1String("-r") + it->revisions.front().revision) << it->file;
const CVSResponse logResponse = runCVS(repositoryPath, args, cvsShortTimeOut, false);
const CVSResponse logResponse = runCVS(repositoryPath, args, m_settings.timeOutMS(), false);
if (logResponse.result != CVSResponse::Ok) {
*errorMessage = logResponse.message;
return false;
@@ -860,7 +855,7 @@ bool CVSPlugin::describe(const QString &repositoryPath,
args << m_settings.cvsDiffOptions << QLatin1String("-r") << previousRev
<< QLatin1String("-r") << it->revisions.front().revision
<< it->file;
const CVSResponse diffResponse = runCVS(repositoryPath, args, cvsShortTimeOut, false, codec);
const CVSResponse diffResponse = runCVS(repositoryPath, args, m_settings.timeOutMS(), false, codec);
switch (diffResponse.result) {
case CVSResponse::Ok:
case CVSResponse::NonNullExitCode: // Diff exit code != 0
@@ -1037,7 +1032,7 @@ bool CVSPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
{
QStringList args;
args << QLatin1String("add") << rawFileName;
const CVSResponse response = runCVS(workingDir, args, cvsShortTimeOut, true);
const CVSResponse response = runCVS(workingDir, args, m_settings.timeOutMS(), true);
return response.result == CVSResponse::Ok;
}
@@ -1045,7 +1040,7 @@ bool CVSPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName)
{
QStringList args;
args << QLatin1String("remove") << QLatin1String("-f") << rawFileName;
const CVSResponse response = runCVS(workingDir, args, cvsShortTimeOut, true);
const CVSResponse response = runCVS(workingDir, args, m_settings.timeOutMS(), true);
return response.result == CVSResponse::Ok;
}

View File

@@ -39,6 +39,9 @@ static const char *promptToSubmitKeyC = "PromptForSubmit";
static const char *diffOptionsKeyC = "DiffOptions";
static const char *describeByCommitIdKeyC = "DescribeByCommitId";
static const char *defaultDiffOptions = "-du";
static const char *timeOutKeyC = "TimeOut";
enum { defaultTimeOutS = 30 };
static QString defaultCommand()
{
@@ -56,6 +59,7 @@ namespace CVS {
CVSSettings::CVSSettings() :
cvsCommand(defaultCommand()),
cvsDiffOptions(QLatin1String(defaultDiffOptions)),
timeOutS(defaultTimeOutS),
promptToSubmit(true),
describeByCommitId(true)
{
@@ -69,6 +73,7 @@ void CVSSettings::fromSettings(QSettings *settings)
cvsRoot = settings->value(QLatin1String(rootC), QString()).toString();
cvsDiffOptions = settings->value(QLatin1String(diffOptionsKeyC), QLatin1String(defaultDiffOptions)).toString();
describeByCommitId = settings->value(QLatin1String(describeByCommitIdKeyC), true).toBool();
timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
settings->endGroup();
}
@@ -79,6 +84,7 @@ void CVSSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
settings->setValue(QLatin1String(rootC), cvsRoot);
settings->setValue(QLatin1String(diffOptionsKeyC), cvsDiffOptions);
settings->setValue(QLatin1String(timeOutKeyC), timeOutS);
settings->setValue(QLatin1String(describeByCommitIdKeyC), describeByCommitId);
settings->endGroup();
}
@@ -89,6 +95,7 @@ bool CVSSettings::equals(const CVSSettings &s) const
&& describeByCommitId == s.describeByCommitId
&& cvsCommand == s.cvsCommand
&& cvsRoot == s.cvsRoot
&& timeOutS == s.timeOutS
&& cvsDiffOptions == s.cvsDiffOptions;
}

View File

@@ -46,6 +46,9 @@ struct CVSSettings
void fromSettings(QSettings *);
void toSettings(QSettings *) const;
inline int timeOutMS() const { return timeOutS * 10000; }
inline int longTimeOutMS() const { return timeOutS * 100000; }
// Add common options to the command line
QStringList addOptions(const QStringList &args) const;
@@ -54,6 +57,7 @@ struct CVSSettings
QString cvsCommand;
QString cvsRoot;
QString cvsDiffOptions;
int timeOutS;
bool promptToSubmit;
bool describeByCommitId;
};

View File

@@ -57,6 +57,7 @@ CVSSettings SettingsPageWidget::settings() const
rc.cvsCommand = m_ui.commandPathChooser->path();
rc.cvsRoot = m_ui.rootLineEdit->text();
rc.cvsDiffOptions = m_ui.diffOptionsLineEdit->text();
rc.timeOutS = m_ui.timeOutSpinBox->value();
rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
rc.describeByCommitId = m_ui.describeByCommitIdCheckBox->isChecked();
return rc;
@@ -67,6 +68,7 @@ void SettingsPageWidget::setSettings(const CVSSettings &s)
m_ui.commandPathChooser->setPath(s.cvsCommand);
m_ui.rootLineEdit->setText(s.cvsRoot);
m_ui.diffOptionsLineEdit->setText(s.cvsDiffOptions);
m_ui.timeOutSpinBox->setValue(s.timeOutS);
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
m_ui.describeByCommitIdCheckBox->setChecked(s.describeByCommitId);
}

View File

@@ -2,6 +2,14 @@
<ui version="4.0">
<class>CVS::Internal::SettingsPage</class>
<widget class="QWidget" name="CVS::Internal::SettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>447</width>
<height>281</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="miscGroupBox">
@@ -38,24 +46,24 @@
<string>Miscellaneous</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="diffOptionsLabel">
<property name="text">
<string>Diff Options:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QLineEdit" name="diffOptionsLineEdit"/>
</item>
<item row="1" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="promptToSubmitCheckBox">
<property name="text">
<string>Prompt on submit</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="describeByCommitIdCheckBox">
<property name="toolTip">
<string>When checked, all files touched by a commit will be displayed when clicking on a revision number in the annotation view (retrieved via commit id). Otherwise, only the respective file will be displayed.</string>
@@ -65,6 +73,26 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="timeOutLabel">
<property name="text">
<string>Timeout:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="timeOutSpinBox">
<property name="suffix">
<string>s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>360</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -91,12 +91,15 @@
<item row="1" column="0">
<widget class="QLabel" name="timeoutLabel">
<property name="text">
<string>Timeout (seconds):</string>
<string>Timeout:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="timeoutSpinBox">
<property name="suffix">
<string>s</string>
</property>
<property name="minimum">
<number>10</number>
</property>

View File

@@ -68,9 +68,6 @@
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
enum { p4Timeout = 20000 };
enum { longTimeoutFactor = 4 };
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
@@ -895,7 +892,7 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
VCSBase::VCSBaseOutputWindow *outputWindow = VCSBase::VCSBaseOutputWindow::instance();
// Run, connect stderr to the output window
Utils::SynchronousProcess process;
const int timeOut = (flags & LongTimeOut) ? longTimeoutFactor * p4Timeout : p4Timeout;
const int timeOut = (flags & LongTimeOut) ? m_settings.longTimeOutMS() : m_settings.timeOutMS();
process.setTimeout(timeOut);
process.setStdOutCodec(outputCodec);
if (flags & OverrideDiffEnvironment)
@@ -983,7 +980,7 @@ PerforceResponse PerforcePlugin::fullySynchronousProcess(const QString &workingD
process.closeWriteChannel();
}
const int timeOut = (flags & LongTimeOut) ? longTimeoutFactor * p4Timeout : p4Timeout;
const int timeOut = (flags & LongTimeOut) ? m_settings.longTimeOutMS() : m_settings.timeOutMS();
if (!process.waitForFinished(timeOut)) {
PerforceChecker::ensureProcessStopped(process);
response.error = true;

View File

@@ -46,6 +46,9 @@ static const char *portKeyC = "Port";
static const char *clientKeyC = "Client";
static const char *userKeyC = "User";
static const char *promptToSubmitKeyC = "PromptForSubmit";
static const char *timeOutKeyC = "TimeOut";
enum { defaultTimeOutS = 30 };
static QString defaultCommand()
{
@@ -62,6 +65,7 @@ namespace Internal {
Settings::Settings() :
defaultEnv(true),
timeOutS(defaultTimeOutS),
promptToSubmit(true)
{
}
@@ -71,7 +75,7 @@ bool Settings::equals(const Settings &rhs) const
return defaultEnv == rhs.defaultEnv
&& p4Command == rhs.p4Command && p4Port == rhs.p4Port
&& p4Client == rhs.p4Client && p4User == rhs.p4User
&& promptToSubmit == rhs.promptToSubmit;
&& timeOutS == rhs.timeOutS && promptToSubmit == rhs.promptToSubmit;
};
QStringList Settings::commonP4Arguments() const
@@ -105,6 +109,7 @@ void PerforceSettings::fromSettings(QSettings *settings)
m_settings.p4Port = settings->value(QLatin1String(portKeyC), QString()).toString();
m_settings.p4Client = settings->value(QLatin1String(clientKeyC), QString()).toString();
m_settings.p4User = settings->value(QLatin1String(userKeyC), QString()).toString();
m_settings.timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
m_settings.promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
settings->endGroup();
}
@@ -117,6 +122,7 @@ void PerforceSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(portKeyC), m_settings.p4Port);
settings->setValue(QLatin1String(clientKeyC), m_settings.p4Client);
settings->setValue(QLatin1String(userKeyC), m_settings.p4User);
settings->setValue(QLatin1String(timeOutKeyC), m_settings.timeOutS);
settings->setValue(QLatin1String(promptToSubmitKeyC), m_settings.promptToSubmit);
settings->endGroup();
}

View File

@@ -58,6 +58,7 @@ struct Settings {
QString p4User;
QString errorString;
bool defaultEnv;
int timeOutS;
bool promptToSubmit;
};
@@ -92,6 +93,10 @@ public:
void setSettings(const Settings &s);
Settings settings() const;
inline int timeOutS() const { return m_settings.timeOutS; }
inline int timeOutMS() const { return m_settings.timeOutS * 10000; }
inline int longTimeOutMS() const { return m_settings.timeOutS * 100000; }
QString topLevel() const;
QString topLevelSymLinkTarget() const;

View File

@@ -81,6 +81,7 @@ Settings SettingsPageWidget::settings() const
settings.p4Port = m_ui.portLineEdit->text();
settings.p4User = m_ui.userLineEdit->text();
settings.p4Client= m_ui.clientLineEdit->text();
settings.timeOutS = m_ui.timeOutSpinBox->value();
settings.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
return settings;
}
@@ -92,6 +93,7 @@ void SettingsPageWidget::setSettings(const PerforceSettings &s)
m_ui.portLineEdit->setText(s.p4Port());
m_ui.clientLineEdit->setText(s.p4Client());
m_ui.userLineEdit->setText(s.p4User());
m_ui.timeOutSpinBox->setValue(s.timeOutS());
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit());
}

View File

@@ -2,6 +2,14 @@
<ui version="4.0">
<class>Perforce::Internal::SettingsPage</class>
<widget class="QWidget" name="Perforce::Internal::SettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>407</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="configGroupBox">
@@ -82,13 +90,33 @@
<string>Miscellaneous</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0" colspan="2">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="promptToSubmitCheckBox">
<property name="text">
<string>Prompt on submit</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="timeOutLabel">
<property name="text">
<string>Timeout:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="timeOutSpinBox">
<property name="suffix">
<string>s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>360</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -58,6 +58,7 @@ SubversionSettings SettingsPageWidget::settings() const
rc.useAuthentication = m_ui.userGroupBox->isChecked();
rc.user = m_ui.usernameLineEdit->text();
rc.password = m_ui.passwordLineEdit->text();
rc.timeOutS = m_ui.timeOutSpinBox->value();
if (rc.user.isEmpty())
rc.useAuthentication = false;
rc.promptToSubmit = m_ui.promptToSubmitCheckBox->isChecked();
@@ -70,6 +71,7 @@ void SettingsPageWidget::setSettings(const SubversionSettings &s)
m_ui.usernameLineEdit->setText(s.user);
m_ui.passwordLineEdit->setText(s.password);
m_ui.userGroupBox->setChecked(s.useAuthentication);
m_ui.timeOutSpinBox->setValue(s.timeOutS);
m_ui.promptToSubmitCheckBox->setChecked(s.promptToSubmit);
}

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>473</width>
<width>496</width>
<height>295</height>
</rect>
</property>
@@ -72,13 +72,33 @@
<string>Miscellaneous</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0" colspan="2">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="promptToSubmitCheckBox">
<property name="text">
<string>Prompt on submit</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="timeOutLabel">
<property name="text">
<string>Timeout:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="timeOutSpinBox">
<property name="suffix">
<string>s</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>360</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -71,11 +71,6 @@
using namespace Subversion::Internal;
// Timeout for normal output commands
enum { subversionShortTimeOut = 10000 };
// Timeout for submit, update
enum { subversionLongTimeOut = 120000 };
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";
@@ -470,7 +465,7 @@ void SubversionPlugin::svnDiff(const QString &workingDir, const QStringList &fil
QStringList args(QLatin1String("diff"));
args << files;
const SubversionResponse response = runSvn(workingDir, args, subversionShortTimeOut, false, codec);
const SubversionResponse response = runSvn(workingDir, args, m_settings.timeOutMS(), false, codec);
if (response.error)
return;
@@ -551,7 +546,7 @@ void SubversionPlugin::revertCurrentFile()
QStringList args(QLatin1String("diff"));
args.push_back(state.relativeCurrentFile());
const SubversionResponse diffResponse = runSvn(state.currentFileTopLevel(), args, subversionShortTimeOut, false);
const SubversionResponse diffResponse = runSvn(state.currentFileTopLevel(), args, m_settings.timeOutMS(), false);
if (diffResponse.error)
return;
@@ -568,7 +563,7 @@ void SubversionPlugin::revertCurrentFile()
args.clear();
args << QLatin1String("revert") << state.relativeCurrentFile();
const SubversionResponse revertResponse = runSvn(state.currentFileTopLevel(), args, subversionShortTimeOut, true);
const SubversionResponse revertResponse = runSvn(state.currentFileTopLevel(), args, m_settings.timeOutMS(), true);
if (!revertResponse.error) {
fcb.setModifiedReload(true);
subVersionControl()->emitFilesChanged(QStringList(state.currentFile()));
@@ -618,7 +613,7 @@ void SubversionPlugin::startCommit(const QString &workingDir, const QStringList
QStringList args(QLatin1String("status"));
args += files;
const SubversionResponse response = runSvn(workingDir, args, subversionShortTimeOut, false);
const SubversionResponse response = runSvn(workingDir, args, m_settings.timeOutMS(), false);
if (response.error)
return;
@@ -659,7 +654,7 @@ bool SubversionPlugin::commit(const QString &messageFile,
QStringList args = QStringList(QLatin1String("commit"));
args << QLatin1String(nonInteractiveOptionC) << QLatin1String("--file") << messageFile;
args.append(subVersionFileList);
const SubversionResponse response = runSvn(m_commitRepository, args, subversionLongTimeOut, true);
const SubversionResponse response = runSvn(m_commitRepository, args, m_settings.longTimeOutMS(), true);
return !response.error ;
}
@@ -678,7 +673,7 @@ void SubversionPlugin::filelog(const QString &workingDir, const QStringList &fil
foreach(const QString &file, files)
args.append(QDir::toNativeSeparators(file));
const SubversionResponse response = runSvn(workingDir, args, subversionShortTimeOut, false, codec);
const SubversionResponse response = runSvn(workingDir, args, m_settings.timeOutMS(), false, codec);
if (response.error)
return;
@@ -705,7 +700,7 @@ void SubversionPlugin::updateProject()
QStringList args(QLatin1String("update"));
args.push_back(QLatin1String(nonInteractiveOptionC));
args.append(state.relativeCurrentProject());
const SubversionResponse response = runSvn(state.currentProjectTopLevel(), args, subversionLongTimeOut, true);
const SubversionResponse response = runSvn(state.currentProjectTopLevel(), args, m_settings.longTimeOutMS(), true);
if (!response.error)
subVersionControl()->emitRepositoryChanged(state.currentProjectTopLevel());
}
@@ -725,7 +720,7 @@ void SubversionPlugin::annotate(const QString &workingDir, const QString &file)
args.push_back(QLatin1String("-v"));
args.append(QDir::toNativeSeparators(file));
const SubversionResponse response = runSvn(workingDir, args, subversionShortTimeOut, false, codec);
const SubversionResponse response = runSvn(workingDir, args, m_settings.timeOutMS(), false, codec);
if (response.error)
return;
@@ -753,7 +748,7 @@ void SubversionPlugin::projectStatus()
QTC_ASSERT(state.hasProject(), return);
QStringList args(QLatin1String("status"));
args += state.relativeCurrentProject();
runSvn(state.currentProjectTopLevel(), args, subversionShortTimeOut, true);
runSvn(state.currentProjectTopLevel(), args, m_settings.timeOutMS(), true);
}
void SubversionPlugin::describe(const QString &source, const QString &changeNr)
@@ -776,7 +771,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
QStringList args(QLatin1String("log"));
args.push_back(QLatin1String("-r"));
args.push_back(changeNr);
const SubversionResponse logResponse = runSvn(topLevel, args, subversionShortTimeOut, false);
const SubversionResponse logResponse = runSvn(topLevel, args, m_settings.timeOutMS(), false);
if (logResponse.error)
return;
description = logResponse.stdOut;
@@ -790,7 +785,7 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr)
args.push_back(diffArg);
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(source);
const SubversionResponse response = runSvn(topLevel, args, subversionShortTimeOut, false, codec);
const SubversionResponse response = runSvn(topLevel, args, m_settings.timeOutMS(), false, codec);
if (response.error)
return;
description += response.stdOut;
@@ -963,7 +958,7 @@ bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileN
QStringList args(QLatin1String("add"));
args.push_back(file);
const SubversionResponse response = runSvn(workingDir, args, subversionShortTimeOut, true);
const SubversionResponse response = runSvn(workingDir, args, m_settings.timeOutMS(), true);
return !response.error;
}
@@ -974,7 +969,7 @@ bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFi
QStringList args(QLatin1String("delete"));
args.push_back(file);
const SubversionResponse response = runSvn(workingDir, args, subversionShortTimeOut, true);
const SubversionResponse response = runSvn(workingDir, args, m_settings.timeOutMS(), true);
return !response.error;
}

View File

@@ -41,6 +41,9 @@ static const char *authenticationKeyC = "Authentication";
static const char *userNameOptionC = "--username";
static const char *passwordOptionC = "--password";
static const char *promptToSubmitKeyC = "PromptForSubmit";
static const char *timeOutKeyC = "TimeOut";
enum { defaultTimeOutS = 30 };
static QString defaultCommand()
{
@@ -57,6 +60,7 @@ using namespace Subversion::Internal;
SubversionSettings::SubversionSettings() :
svnCommand(defaultCommand()),
useAuthentication(false),
timeOutS(defaultTimeOutS),
promptToSubmit(true)
{
}
@@ -68,6 +72,7 @@ void SubversionSettings::fromSettings(QSettings *settings)
useAuthentication = settings->value(QLatin1String(authenticationKeyC), QVariant(false)).toBool();
user = settings->value(QLatin1String(userKeyC), QString()).toString();
password = settings->value(QLatin1String(passwordKeyC), QString()).toString();
timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
promptToSubmit = settings->value(QLatin1String(promptToSubmitKeyC), true).toBool();
settings->endGroup();
}
@@ -80,6 +85,7 @@ void SubversionSettings::toSettings(QSettings *settings) const
settings->setValue(QLatin1String(userKeyC), user);
settings->setValue(QLatin1String(passwordKeyC), password);
settings->setValue(QLatin1String(promptToSubmitKeyC), promptToSubmit);
settings->setValue(QLatin1String(timeOutKeyC), timeOutS);
settings->endGroup();
}
@@ -89,6 +95,7 @@ bool SubversionSettings::equals(const SubversionSettings &s) const
&& useAuthentication == s.useAuthentication
&& user == s.user
&& password == s.password
&& timeOutS == s.timeOutS
&& promptToSubmit == s.promptToSubmit;
}

View File

@@ -47,6 +47,9 @@ struct SubversionSettings
void fromSettings(QSettings *);
void toSettings(QSettings *) const;
inline int timeOutMS() const { return timeOutS * 10000; }
inline int longTimeOutMS() const { return timeOutS * 100000; }
// Add authentication and (maybe future) options to the
// command line
QStringList addOptions(const QStringList &args) const;
@@ -59,6 +62,7 @@ struct SubversionSettings
bool useAuthentication;
QString user;
QString password;
int timeOutS;
bool promptToSubmit;
};