Fall back to textual diff when gdiff fails

Fossil Exe path needs to be set before applySettings

FossilOrigin-Name: a9115a3369a7897bfc665f2a9614f61dbec80493
This commit is contained in:
Kostas
2015-07-29 09:09:14 +00:00
parent 45db311f63
commit 387cbb57e8
5 changed files with 25 additions and 18 deletions

View File

@@ -229,10 +229,15 @@ bool Fossil::getFossilVersion(QString& version)
}
//------------------------------------------------------------------------------
bool Fossil::diffFile(const QString &repoFile)
bool Fossil::diffFile(const QString &repoFile, bool graphical)
{
// Run the diff detached
return runFossil(QStringList() << "gdiff" << QuotePath(repoFile), 0, RUNFLAGS_DETACHED);
if(graphical)
{
// Run the diff detached
return runFossil(QStringList() << "gdiff" << QuotePath(repoFile), 0, RUNFLAGS_DETACHED);
}
else
return runFossil(QStringList() << "diff" << QuotePath(repoFile));
}
//------------------------------------------------------------------------------

View File

@@ -93,7 +93,7 @@ public:
bool listFiles(QStringList &files);
bool status(QStringList& result);
bool diffFile(const QString &repoFile);
bool diffFile(const QString &repoFile, bool graphical);
bool commitFiles(const QStringList &fileList, const QString &comment, const QString& newBranchName, bool isPrivateBranch);
bool addFiles(const QStringList& fileList);
bool removeFiles(const QStringList& fileList, bool deleteLocal);
@@ -126,7 +126,7 @@ public:
const QString &getUIHttpPort() const { return fossilUIPort; }
QString getUIHttpAddress() const;
void setFossilPath(const QString &path) { fossilPath = path; }
void setExecutablePath(const QString &path) { fossilPath = path; }
private:
void log(const QString &text, bool isHTML=false)

View File

@@ -297,11 +297,10 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
uiCallback.init(this);
// Need to be before applySettings which sets the last workspace
fossil().Init(&uiCallback);
fossil().setExecutablePath(settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString());
applySettings();
fossil().setFossilPath(settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString());
// Apply any explicit workspace path if available
if(workspacePath && !workspacePath->isEmpty())
openWorkspace(*workspacePath);
@@ -1406,7 +1405,10 @@ void MainWindow::getSelectionRemotes(QStringList &remoteUrls)
//------------------------------------------------------------------------------
bool MainWindow::diffFile(const QString &repoFile)
{
return fossil().diffFile(repoFile);
if(fossil().diffFile(repoFile, true))
return true;
else
return fossil().diffFile(repoFile, false);
}
//------------------------------------------------------------------------------
@@ -1782,7 +1784,7 @@ void MainWindow::on_actionSettings_triggered()
if(!SettingsDialog::run(this, settings))
return;
fossil().setFossilPath(settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString());
fossil().setExecutablePath(settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString());
updateCustomActions();
}