forked from qt-creator/qt-creator
		
	Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
		@@ -207,20 +207,20 @@ void GitClient::diff(const QString &workingDirectory,
 | 
			
		||||
       QStringList arguments;
 | 
			
		||||
       arguments << QLatin1String("diff") << diffArgs;
 | 
			
		||||
       m_plugin->outputWindow()->append(formatCommand(binary, arguments));
 | 
			
		||||
       command->addJob(arguments);
 | 
			
		||||
       command->addJob(arguments, m_settings.timeout);
 | 
			
		||||
    } else {
 | 
			
		||||
        // Files diff.
 | 
			
		||||
        if (!unstagedFileNames.empty()) {
 | 
			
		||||
           QStringList arguments;
 | 
			
		||||
           arguments << QLatin1String("diff") << diffArgs << QLatin1String("--") << unstagedFileNames;
 | 
			
		||||
           m_plugin->outputWindow()->append(formatCommand(binary, arguments));
 | 
			
		||||
           command->addJob(arguments);
 | 
			
		||||
           command->addJob(arguments, m_settings.timeout);
 | 
			
		||||
        }
 | 
			
		||||
        if (!stagedFileNames.empty()) {
 | 
			
		||||
           QStringList arguments;
 | 
			
		||||
           arguments << QLatin1String("diff") << QLatin1String("--cached") << diffArgs << QLatin1String("--") << stagedFileNames;
 | 
			
		||||
           m_plugin->outputWindow()->append(formatCommand(binary, arguments));
 | 
			
		||||
           command->addJob(arguments);
 | 
			
		||||
           command->addJob(arguments, m_settings.timeout);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    command->execute();
 | 
			
		||||
@@ -503,7 +503,7 @@ void GitClient::executeGit(const QString &workingDirectory,
 | 
			
		||||
{
 | 
			
		||||
    m_plugin->outputWindow()->append(formatCommand(QLatin1String(Constants::GIT_BINARY), arguments));
 | 
			
		||||
    GitCommand *command = createCommand(workingDirectory, editor, outputToWindow);
 | 
			
		||||
    command->addJob(arguments);
 | 
			
		||||
    command->addJob(arguments, m_settings.timeout);
 | 
			
		||||
    command->execute();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -55,8 +55,9 @@ static inline QStringList environmentToList(const ProjectExplorer::Environment &
 | 
			
		||||
    return ProjectExplorer::Environment::systemEnvironment().toStringList();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GitCommand::Job::Job(const QStringList &a) :
 | 
			
		||||
    arguments(a)
 | 
			
		||||
GitCommand::Job::Job(const QStringList &a, int t) :
 | 
			
		||||
    arguments(a),
 | 
			
		||||
    timeout(t)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -67,9 +68,9 @@ GitCommand::GitCommand(const QString &workingDirectory,
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitCommand::addJob(const QStringList &arguments)
 | 
			
		||||
void GitCommand::addJob(const QStringList &arguments, int timeout)
 | 
			
		||||
{
 | 
			
		||||
    m_jobs.push_back(Job(arguments));
 | 
			
		||||
    m_jobs.push_back(Job(arguments, timeout));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitCommand::execute()
 | 
			
		||||
@@ -109,7 +110,7 @@ void GitCommand::run()
 | 
			
		||||
            qDebug() << "GitCommand::run" << j << '/' << count << m_jobs.at(j).arguments;
 | 
			
		||||
 | 
			
		||||
        process.start(QLatin1String(Constants::GIT_BINARY), m_jobs.at(j).arguments);
 | 
			
		||||
        if (!process.waitForFinished()) {
 | 
			
		||||
        if (!process.waitForFinished(m_jobs.at(j).timeout * 1000)) {
 | 
			
		||||
            ok = false;
 | 
			
		||||
            error += QLatin1String("Error: Git timed out");
 | 
			
		||||
            break;
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ public:
 | 
			
		||||
                        ProjectExplorer::Environment &environment);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    void addJob(const QStringList &arguments);
 | 
			
		||||
    void addJob(const QStringList &arguments, int timeout);
 | 
			
		||||
    void execute();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
@@ -61,9 +61,10 @@ Q_SIGNALS:
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    struct Job {
 | 
			
		||||
        explicit Job(const QStringList &a);
 | 
			
		||||
        explicit Job(const QStringList &a, int t);
 | 
			
		||||
 | 
			
		||||
        QStringList arguments;
 | 
			
		||||
        int timeout;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    QStringList environment() const;
 | 
			
		||||
 
 | 
			
		||||
@@ -40,15 +40,17 @@ static const char *groupC = "Git";
 | 
			
		||||
static const char *sysEnvKeyC = "SysEnv";
 | 
			
		||||
static const char *pathKeyC = "Path";
 | 
			
		||||
static const char *logCountKeyC = "LogCount";
 | 
			
		||||
static const char *timeoutKeyC = "TimeOut";
 | 
			
		||||
 | 
			
		||||
enum { defaultLogCount =  10 };
 | 
			
		||||
enum { defaultLogCount =  10 , defaultTimeOut = 30};
 | 
			
		||||
 | 
			
		||||
namespace Git {
 | 
			
		||||
namespace Internal {
 | 
			
		||||
 | 
			
		||||
GitSettings::GitSettings() :
 | 
			
		||||
    adoptPath(false),
 | 
			
		||||
    logCount(defaultLogCount)
 | 
			
		||||
    logCount(defaultLogCount),
 | 
			
		||||
    timeout(defaultTimeOut)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -58,6 +60,7 @@ void GitSettings::fromSettings(QSettings *settings)
 | 
			
		||||
    adoptPath = settings->value(QLatin1String(sysEnvKeyC), false).toBool();
 | 
			
		||||
    path = settings->value(QLatin1String(pathKeyC), QString()).toString();
 | 
			
		||||
    logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt();
 | 
			
		||||
    timeout = settings->value(QLatin1String(timeoutKeyC), defaultTimeOut).toInt();
 | 
			
		||||
    settings->endGroup();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -67,12 +70,13 @@ void GitSettings::toSettings(QSettings *settings) const
 | 
			
		||||
    settings->setValue(QLatin1String(sysEnvKeyC), adoptPath);
 | 
			
		||||
    settings->setValue(QLatin1String(pathKeyC), path);
 | 
			
		||||
    settings->setValue(QLatin1String(logCountKeyC), logCount);
 | 
			
		||||
    settings->setValue(QLatin1String(timeoutKeyC), timeout);
 | 
			
		||||
    settings->endGroup();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool GitSettings::equals(const GitSettings &s) const
 | 
			
		||||
{
 | 
			
		||||
    return adoptPath == s.adoptPath  && path == s.path && logCount == s.logCount;
 | 
			
		||||
    return adoptPath == s.adoptPath && path == s.path && logCount == s.logCount && timeout == s.timeout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -56,6 +56,7 @@ struct GitSettings
 | 
			
		||||
    bool adoptPath;
 | 
			
		||||
    QString path;
 | 
			
		||||
    int logCount;
 | 
			
		||||
    int timeout;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline bool operator==(const GitSettings &p1, const GitSettings &p2)
 | 
			
		||||
 
 | 
			
		||||
@@ -52,6 +52,7 @@ GitSettings SettingsPageWidget::settings() const
 | 
			
		||||
    rc.path = m_ui.pathLineEdit->text();
 | 
			
		||||
    rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty();
 | 
			
		||||
    rc.logCount = m_ui.logCountSpinBox->value();
 | 
			
		||||
    rc.timeout = m_ui.timeoutSpinBox->value();
 | 
			
		||||
    return rc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -60,6 +61,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
 | 
			
		||||
    m_ui.environmentGroupBox->setChecked(s.adoptPath);
 | 
			
		||||
    m_ui.pathLineEdit->setText(s.path);
 | 
			
		||||
    m_ui.logCountSpinBox->setValue(s.logCount);
 | 
			
		||||
    m_ui.timeoutSpinBox->setValue(s.timeout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsPageWidget::setSystemPath()
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>403</width>
 | 
			
		||||
    <height>183</height>
 | 
			
		||||
    <height>251</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
@@ -69,10 +69,14 @@
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QFormLayout" name="logFormLayout">
 | 
			
		||||
     <property name="fieldGrowthPolicy">
 | 
			
		||||
      <enum>QFormLayout::ExpandingFieldsGrow</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
    <layout class="QFormLayout" name="formLayout">
 | 
			
		||||
     <item row="0" column="0">
 | 
			
		||||
      <widget class="QLabel" name="logCountLabel">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Log commit display count:</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="0" column="1">
 | 
			
		||||
      <widget class="QSpinBox" name="logCountSpinBox">
 | 
			
		||||
       <property name="toolTip">
 | 
			
		||||
@@ -83,10 +87,23 @@
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="0" column="0">
 | 
			
		||||
      <widget class="QLabel" name="logCountLabel">
 | 
			
		||||
     <item row="1" column="0">
 | 
			
		||||
      <widget class="QLabel" name="timeoutLabel">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Log commit display count:</string>
 | 
			
		||||
        <string>Timeout (seconds):</string>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item row="1" column="1">
 | 
			
		||||
      <widget class="QSpinBox" name="timeoutSpinBox">
 | 
			
		||||
       <property name="minimum">
 | 
			
		||||
        <number>10</number>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="maximum">
 | 
			
		||||
        <number>300</number>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="value">
 | 
			
		||||
        <number>30</number>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user