Wrapped fossil "update"

FossilOrigin-Name: 11a0f979fc198ad134c95c139547baae81d90050
This commit is contained in:
kostas
2015-04-27 15:32:28 +00:00
parent fc8941b520
commit c4e96bea35
5 changed files with 43 additions and 14 deletions

View File

@ -275,7 +275,7 @@ bool Bridge::renameFile(const QString &beforePath, const QString &afterPath)
}
//------------------------------------------------------------------------------
bool Bridge::undo(QStringList &result, bool explainOnly)
bool Bridge::undoRepository(QStringList &result, bool explainOnly)
{
QStringList params;
params << "undo";
@ -283,6 +283,20 @@ bool Bridge::undo(QStringList &result, bool explainOnly)
if(explainOnly)
params << "--explain";
result.clear();
return runFossil(params, &result);
}
//------------------------------------------------------------------------------
bool Bridge::updateRepository(QStringList &result, bool explainOnly)
{
QStringList params;
params << "update";
if(explainOnly)
params << "--nochange";
result.clear();
return runFossil(params, &result);
}

View File

@ -104,7 +104,8 @@ public:
bool removeFiles(const QStringList& fileList, bool deleteLocal);
bool revertFiles(const QStringList& fileList);
bool renameFile(const QString& beforePath, const QString& afterPath);
bool undo(QStringList& result, bool explainOnly);
bool undoRepository(QStringList& result, bool explainOnly);
bool updateRepository(QStringList& result, bool explainOnly);
private:
void log(const QString &text, bool isHTML=false)
{

View File

@ -2204,7 +2204,7 @@ void MainWindow::on_actionUndo_triggered()
// Do Undo
runFossil(QStringList() << "undo" );
#else
bridge.undo(res, true);
bridge.undoRepository(res, true);
if(res.length()>0 && res[0]=="No undo or redo is available")
return;
@ -2213,7 +2213,7 @@ void MainWindow::on_actionUndo_triggered()
return;
// Do Undo
bridge.undo(res, false);
bridge.undoRepository(res, false);
#endif
refresh();
@ -2261,7 +2261,7 @@ void MainWindow::on_actionAbout_triggered()
void MainWindow::on_actionUpdate_triggered()
{
QStringList res;
#ifndef BRIDGE_ENABLED
if(!runFossil(QStringList() << "update" << "--nochange", &res, RUNFLAGS_SILENT_ALL))
return;
@ -2273,6 +2273,20 @@ void MainWindow::on_actionUpdate_triggered()
// Do Update
runFossil(QStringList() << "update" );
#else
if(!bridge.updateRepository(res, true))
return;
// Fixme: parse "changes: None. Already up-to-date" and avoid dialog
if(res.length()==0)
return;
if(!FileActionDialog::run(this, tr("Update"), tr("The following files will be updated.")+"\n"+tr("Are you sure?"), res))
return;
bridge.updateRepository(res, false);
#endif
refresh();
}