Wrapped "add" and "remove"
FossilOrigin-Name: 1284b0abf55c359e79d4953a00da1de2cebb6a31
This commit is contained in:
@ -196,6 +196,39 @@ bool Bridge::commitFiles(const QStringList& fileList, const QString& comment)
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::addFiles(const QStringList& fileList)
|
||||
{
|
||||
if(fileList.empty())
|
||||
return false;
|
||||
|
||||
// Do Add
|
||||
return runFossil(QStringList() << "add" << QuotePaths(fileList));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::removeFiles(const QStringList& fileList, bool deleteLocal)
|
||||
{
|
||||
if(fileList.empty())
|
||||
return false;
|
||||
|
||||
// Do Delete
|
||||
if(!runFossil(QStringList() << "delete" << QuotePaths(fileList)))
|
||||
return false;
|
||||
|
||||
if(deleteLocal)
|
||||
{
|
||||
for(int i=0; i<fileList.size(); ++i)
|
||||
{
|
||||
QFileInfo fi(getCurrentWorkspace() + QDir::separator() + fileList[i]);
|
||||
if(fi.exists())
|
||||
QFile::remove(fi.filePath());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::stashList(stashmap_t& stashes)
|
||||
{
|
||||
|
@ -98,9 +98,8 @@ public:
|
||||
bool stashList(stashmap_t &stashes);
|
||||
bool diffFile(const QString &repoFile);
|
||||
bool commitFiles(const QStringList &fileList, const QString &comment);
|
||||
|
||||
|
||||
|
||||
bool addFiles(const QStringList& fileList);
|
||||
bool removeFiles(const QStringList& fileList, bool deleteLocal);
|
||||
private:
|
||||
void log(const QString &text, bool isHTML=false)
|
||||
{
|
||||
|
@ -2039,7 +2039,11 @@ void MainWindow::on_actionAdd_triggered()
|
||||
return;
|
||||
|
||||
// Do Add
|
||||
#ifndef BRIDGE_ENABLED
|
||||
runFossil(QStringList() << "add" << QuotePaths(selection) );
|
||||
#else
|
||||
bridge.addFiles(selection);
|
||||
#endif
|
||||
|
||||
refresh();
|
||||
}
|
||||
@ -2063,6 +2067,7 @@ void MainWindow::on_actionDelete_triggered()
|
||||
if(!FileActionDialog::run(this, tr("Remove files"), tr("The following files will be removed from the repository.")+"\n"+tr("Are you sure?"), all_files, tr("Also delete the local files"), &remove_local ))
|
||||
return;
|
||||
|
||||
#ifndef BRIDGE_ENABLED
|
||||
if(!repo_files.empty())
|
||||
{
|
||||
// Do Delete
|
||||
@ -2079,6 +2084,22 @@ void MainWindow::on_actionDelete_triggered()
|
||||
QFile::remove(fi.filePath());
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Remove repository files
|
||||
if(!repo_files.empty())
|
||||
bridge.removeFiles(repo_files, remove_local);
|
||||
|
||||
// Remove unknown local files if selected
|
||||
if(remove_local)
|
||||
{
|
||||
for(int i=0; i<unknown_files.size(); ++i)
|
||||
{
|
||||
QFileInfo fi(getCurrentWorkspace() + QDir::separator() + unknown_files[i]);
|
||||
if(fi.exists())
|
||||
QFile::remove(fi.filePath());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
Reference in New Issue
Block a user