diff --git a/manifest b/manifest index e3dddfb..a558046 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fixed\sissue\swhere\sthe\sRemoteDialog\swas\sdisplaying\slocal\spaths\sas\sUrls\swhen\sediting\sexisting\sremotes\n -D 2015-09-12T18:34:26.565 +C All\sgeneric\sFossil\soperations\sare\snow\sencapsulated\sin\sWorkspace\n +D 2015-09-14T15:46:16.231 F .fossil-settings/manifest a09a968bf05a50058f3ad50132730b719bc39e76 F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35 F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b @@ -232,7 +232,7 @@ F src/FslSettingsDialog.cpp e00907d493fba469e48a008aecda88426350b5ac F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7 F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261 -F src/MainWindow.cpp d5adcea39c5cdad6acbf9557a6f6ef7e6bf19901 +F src/MainWindow.cpp 4268a41085afaa2bc0bb08b580e99e201b00234f F src/MainWindow.h fd8bb12f0bf49a6cb5ce9b875ad5277426380e3f F src/RemoteDialog.cpp 1a57a15465f689057d5354a29ad3015e54582343 F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d @@ -246,8 +246,8 @@ F src/SettingsDialog.cpp fa0c70eaf0fa7edb15de302d041cdb552fe523d5 F src/SettingsDialog.h 5eb3ae2cbb00ab5544e1889860f5376f69fe47cd F src/Utils.cpp fb9fe1caeef47dca310079f8f10b41c838defaa5 F src/Utils.h c52be757cd0045e34ab14c51f35a61af8f8870a4 -F src/Workspace.cpp 16684d586ee64ac6176debc06ee01012cd7ac5df -F src/Workspace.h 408ae0d52d5c17420a0add9b6fd5e0a7db3dc948 +F src/Workspace.cpp 88ec8258920d7d450c3bb6110085fb07b30ee01a +F src/Workspace.h 12646718c49441e7160e231d0e8681d51a601d4e F src/main.cpp d8c65ea5e54102e4989fef9fd8cfd4f13ef8a8f0 F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x @@ -261,7 +261,7 @@ F ui/MainWindow.ui ad04643d071fe513b46ef413749a493909a90ad1 F ui/RemoteDialog.ui 424b2d4a3d0162f84fdccf6af02c1cfce07a06f5 F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd F ui/SettingsDialog.ui 2e1b6ce7a49100088c5649292c1319e62e0302e1 -P 6850f2915d4dfb3760de45d7bdb3f8d1c5658dc6 -R d7fa0057ae23e4534aea0daf38489c8a +P 96e4a4d8642ec96578155bb8762a1772b9351e3c +R 784c02219b7ef58afdd4d5fd40274aec U Kostas -Z 622c72220b0e85085ac47a3fed4228ae +Z 80978a3c0bcc7673709be80a4e657974 diff --git a/manifest.uuid b/manifest.uuid index a085e2d..a7f6646 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -96e4a4d8642ec96578155bb8762a1772b9351e3c \ No newline at end of file +b29c19caa92280f7378e78f0febb56fc4fec7b03 \ No newline at end of file diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 9a65515..73a0123 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -322,7 +322,7 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP uiCallback.init(this); // Need to be before applySettings which sets the last workspace - getWorkspace().fossil().Init(&uiCallback, settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString()); + getWorkspace().Init(&uiCallback, settings.GetValue(FUEL_SETTING_FOSSIL_PATH).toString()); applySettings(); @@ -405,7 +405,7 @@ bool MainWindow::openWorkspace(const QString &path) } // Ok open the repository file - if(!getWorkspace().fossil().createWorkspace(fi.absoluteFilePath(), wkspace)) + if(!getWorkspace().createWorkspace(fi.absoluteFilePath(), wkspace)) { QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok ); return false; @@ -511,13 +511,13 @@ void MainWindow::on_actionNewRepository_triggered() // Create repository QString repo_abs_path = repo_path_info.absoluteFilePath(); - if(!getWorkspace().fossil().createRepository(repo_abs_path)) + if(!getWorkspace().createRepository(repo_abs_path)) { QMessageBox::critical(this, tr("Error"), tr("Could not create repository."), QMessageBox::Ok ); return; } - if(!getWorkspace().fossil().createWorkspace(repo_abs_path, wkdir)) + if(!getWorkspace().createWorkspace(repo_abs_path, wkdir)) { QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok ); return; @@ -533,14 +533,14 @@ void MainWindow::on_actionNewRepository_triggered() //------------------------------------------------------------------------------ void MainWindow::on_actionCloseRepository_triggered() { - if(getWorkspace().fossil().getWorkspaceState()!=Fossil::WORKSPACE_STATE_OK) + if(getWorkspace().getWorkspaceState()!=Fossil::WORKSPACE_STATE_OK) return; if(QMessageBox::Yes !=DialogQuery(this, tr("Close Workspace"), tr("Are you sure you want to close this workspace?"))) return; // Close Repo - if(!getWorkspace().fossil().closeWorkspace()) + if(!getWorkspace().closeWorkspace()) { QMessageBox::critical(this, tr("Error"), tr("Cannot close the workspace.\nAre there still uncommitted changes available?"), QMessageBox::Ok ); return; @@ -562,7 +562,7 @@ void MainWindow::on_actionCloneRepository_triggered() stopUI(); - if(!getWorkspace().fossil().cloneRepository(repository, url, url_proxy)) + if(!getWorkspace().cloneRepository(repository, url, url_proxy)) { QMessageBox::critical(this, tr("Error"), tr("Could not clone the repository"), QMessageBox::Ok); return; @@ -693,7 +693,7 @@ bool MainWindow::scanWorkspace() bool valid = true; // Load repository info - Fossil::WorkspaceState st = getWorkspace().fossil().getWorkspaceState(); + Fossil::WorkspaceState st = getWorkspace().getWorkspaceState(); QString status; if(st==Fossil::WORKSPACE_STATE_NOTFOUND) @@ -1456,9 +1456,9 @@ bool MainWindow::diffFile(const QString &repoFile) { const QString &gdiff = settings.GetFossilValue(FOSSIL_SETTING_GDIFF_CMD).toString(); if(!gdiff.isEmpty()) - return getWorkspace().fossil().diffFile(repoFile, true); + return getWorkspace().diffFile(repoFile, true); else - return getWorkspace().fossil().diffFile(repoFile, false); + return getWorkspace().diffFile(repoFile, false); } //------------------------------------------------------------------------------ @@ -1597,7 +1597,7 @@ void MainWindow::on_actionCommit_triggered() if(commit_files.size() != all_modified_files.size()) files = commit_files; - if(!getWorkspace().fossil().commitFiles(files, msg, branch_name, private_branch)) + if(!getWorkspace().commitFiles(files, msg, branch_name, private_branch)) QMessageBox::critical(this, tr("Error"), tr("Could not commit changes."), QMessageBox::Ok); refresh(); @@ -1617,7 +1617,7 @@ void MainWindow::on_actionAdd_triggered() return; // Do Add - if(!getWorkspace().fossil().addFiles(selection)) + if(!getWorkspace().addFiles(selection)) QMessageBox::critical(this, tr("Error"), tr("Could not add files."), QMessageBox::Ok); refresh(); @@ -1645,7 +1645,7 @@ void MainWindow::on_actionDelete_triggered() // Remove repository files if(!repo_files.empty()) { - if(!getWorkspace().fossil().removeFiles(repo_files, remove_local)) + if(!getWorkspace().removeFiles(repo_files, remove_local)) QMessageBox::critical(this, tr("Error"), tr("Could not remove files."), QMessageBox::Ok); } @@ -1676,7 +1676,7 @@ void MainWindow::on_actionRevert_triggered() return; // Do Revert - if(!getWorkspace().fossil().revertFiles(modified_files)) + if(!getWorkspace().revertFiles(modified_files)) QMessageBox::critical(this, tr("Error"), tr("Could not revert files."), QMessageBox::Ok); refresh(); @@ -1707,7 +1707,7 @@ void MainWindow::on_actionRename_triggered() } // Do Rename - if(!getWorkspace().fossil().renameFile(fi_before.filePath(), fi_after.filePath(), true)) + if(!getWorkspace().renameFile(fi_before.filePath(), fi_after.filePath(), true)) QMessageBox::critical(this, tr("Error"), tr("Could not rename file '%0' to '%1'").arg(fi_before.filePath(), fi_after.filePath()), QMessageBox::Ok); refresh(); @@ -1740,7 +1740,7 @@ void MainWindow::on_actionUndo_triggered() QStringList res; // Do test Undo - if(!getWorkspace().fossil().undoWorkspace(res, true)) + if(!getWorkspace().undoWorkspace(res, true)) QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok); if(res.length()>0 && res[0]=="No undo or redo is available") @@ -1750,7 +1750,7 @@ void MainWindow::on_actionUndo_triggered() return; // Do Undo - if(!getWorkspace().fossil().undoWorkspace(res, false)) + if(!getWorkspace().undoWorkspace(res, false)) QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok); refresh(); @@ -1759,10 +1759,10 @@ void MainWindow::on_actionUndo_triggered() //------------------------------------------------------------------------------ void MainWindow::on_actionAbout_triggered() { - QString fossil_ver; - getWorkspace().fossil().getExeVersion(fossil_ver); + QString version; + getWorkspace().getInterfaceVersion(version); - AboutDialog dlg(this, fossil_ver); + AboutDialog dlg(this, version); dlg.exec(); } @@ -2067,7 +2067,7 @@ void MainWindow::on_actionRenameFolder_triggered() WorkspaceFile *r = files_to_move[i]; const QString &new_file_path = new_paths[i] + PATH_SEPARATOR + r->getFilename(); - if(!getWorkspace().fossil().renameFile(r->getFilePath(), new_file_path, false)) + if(!getWorkspace().renameFile(r->getFilePath(), new_file_path, false)) { log(tr("Move aborted due to errors")+"\n"); goto _exit; @@ -2207,7 +2207,7 @@ void MainWindow::on_actionCreateStash_triggered() } // Do Stash - if(!getWorkspace().fossil().stashNew(stashed_files, stash_name, revert)) + if(!getWorkspace().stashNew(stashed_files, stash_name, revert)) QMessageBox::critical(this, tr("Error"), tr("Could not create stash."), QMessageBox::Ok); refresh(); @@ -2232,7 +2232,7 @@ void MainWindow::on_actionApplyStash_triggered() stashmap_t::iterator id_it = getWorkspace().getStashes().find(*it); Q_ASSERT(id_it!=getWorkspace().getStashes().end()); - if(!getWorkspace().fossil().stashApply(*id_it)) + if(!getWorkspace().stashApply(*id_it)) { log(tr("Stash application aborted due to errors")+"\n"); QMessageBox::critical(this, tr("Error"), tr("Could not apply stash."), QMessageBox::Ok); @@ -2246,7 +2246,7 @@ void MainWindow::on_actionApplyStash_triggered() stashmap_t::iterator id_it = getWorkspace().getStashes().find(*it); Q_ASSERT(id_it!=getWorkspace().getStashes().end()); - if(!getWorkspace().fossil().stashDrop(*id_it)) + if(!getWorkspace().stashDrop(*id_it)) { log(tr("Stash deletion aborted due to errors")+"\n"); QMessageBox::critical(this, tr("Error"), tr("Could not delete stash."), QMessageBox::Ok); @@ -2275,7 +2275,7 @@ void MainWindow::on_actionDeleteStash_triggered() stashmap_t::iterator id_it = getWorkspace().getStashes().find(*it); Q_ASSERT(id_it!=getWorkspace().getStashes().end()); - if(!getWorkspace().fossil().stashDrop(*id_it)) + if(!getWorkspace().stashDrop(*id_it)) { log(tr("Stash deletion aborted due to errors")+"\n"); QMessageBox::critical(this, tr("Error"), tr("Could not delete stash."), QMessageBox::Ok); @@ -2299,7 +2299,7 @@ void MainWindow::on_actionDiffStash_triggered() Q_ASSERT(id_it!=getWorkspace().getStashes().end()); // Run diff - if(!getWorkspace().fossil().stashDiff(*id_it)) + if(!getWorkspace().stashDiff(*id_it)) QMessageBox::critical(this, tr("Error"), tr("Could not diff stash."), QMessageBox::Ok); } @@ -2459,7 +2459,7 @@ void MainWindow::dropEvent(QDropEvent *event) return; // Do Add - if(!getWorkspace().fossil().addFiles(newfiles)) + if(!getWorkspace().addFiles(newfiles)) QMessageBox::critical(this, tr("Error"), tr("Could not add files."), QMessageBox::Ok); refresh(); @@ -2568,7 +2568,7 @@ void MainWindow::updateRevision(const QString &revision) QStringList res; // Do test update - if(!getWorkspace().fossil().updateWorkspace(res, selected_revision, true)) + if(!getWorkspace().updateWorkspace(res, selected_revision, true)) { QMessageBox::critical(this, tr("Error"), tr("Could not update the repository."), QMessageBox::Ok); return; @@ -2588,7 +2588,7 @@ void MainWindow::updateRevision(const QString &revision) return; // Do update - if(!getWorkspace().fossil().updateWorkspace(res, selected_revision, false)) + if(!getWorkspace().updateWorkspace(res, selected_revision, false)) QMessageBox::critical(this, tr("Error"), tr("Could not update the repository."), QMessageBox::Ok); refresh(); @@ -2610,7 +2610,7 @@ void MainWindow::on_actionCreateTag_triggered() return; } - if(!getWorkspace().fossil().tagNew(name, revision)) + if(!getWorkspace().tagNew(name, revision)) QMessageBox::critical(this, tr("Error"), tr("Could not create tag."), QMessageBox::Ok); refresh(); @@ -2631,7 +2631,7 @@ void MainWindow::on_actionDeleteTag_triggered() const QString &revision = getWorkspace().getTags()[tagname]; - if(!getWorkspace().fossil().tagDelete(tagname, revision)) + if(!getWorkspace().tagDelete(tagname, revision)) QMessageBox::critical(this, tr("Error"), tr("Could not delete tag."), QMessageBox::Ok); refresh(); @@ -2653,7 +2653,7 @@ void MainWindow::on_actionCreateBranch_triggered() return; } - if(!getWorkspace().fossil().branchNew(branch_name, revision, false)) + if(!getWorkspace().branchNew(branch_name, revision, false)) { QMessageBox::critical(this, tr("Error"), tr("Could not create branch."), QMessageBox::Ok); return; @@ -2676,7 +2676,7 @@ void MainWindow::mergeRevision(const QString &defaultRevision) return; // Do test merge - if(!getWorkspace().fossil().branchMerge(res, revision, integrate, force, true)) + if(!getWorkspace().branchMerge(res, revision, integrate, force, true)) { QMessageBox::critical(this, tr("Error"), tr("Merge failed."), QMessageBox::Ok); return; @@ -2686,7 +2686,7 @@ void MainWindow::mergeRevision(const QString &defaultRevision) return; // Do update - if(!getWorkspace().fossil().branchMerge(res, revision, integrate, force, false)) + if(!getWorkspace().branchMerge(res, revision, integrate, force, false)) QMessageBox::critical(this, tr("Error"), tr("Merge failed."), QMessageBox::Ok); else log(tr("Merge completed. Don't forget to commit!")+"\n"); @@ -2776,7 +2776,7 @@ void MainWindow::on_actionPushRemote_triggered() if(!url.isLocalFile()) KeychainGet(this, url, *settings.GetStore()); - if(!getWorkspace().fossil().pushWorkspace(url)) + if(!getWorkspace().pushWorkspace(url)) QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok); } @@ -2794,7 +2794,7 @@ void MainWindow::on_actionPullRemote_triggered() if(!url.isLocalFile()) KeychainGet(this, url, *settings.GetStore()); - if(!getWorkspace().fossil().pullWorkspace(url)) + if(!getWorkspace().pullWorkspace(url)) QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok); } @@ -2813,7 +2813,7 @@ void MainWindow::on_actionPush_triggered() if(!url.isLocalFile()) KeychainGet(this, url, *settings.GetStore()); - if(!getWorkspace().fossil().pushWorkspace(url)) + if(!getWorkspace().pushWorkspace(url)) QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok); } @@ -2832,7 +2832,7 @@ void MainWindow::on_actionPull_triggered() if(!url.isLocalFile()) KeychainGet(this, url, *settings.GetStore()); - if(!getWorkspace().fossil().pullWorkspace(url)) + if(!getWorkspace().pullWorkspace(url)) QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok); } @@ -2856,7 +2856,7 @@ void MainWindow::on_actionSetDefaultRemote_triggered() // so only set the remote url when there is no password set if(url.password().isEmpty()) { - if(!getWorkspace().fossil().setRemoteUrl(url)) + if(!getWorkspace().setDefaultRemoteUrl(url)) QMessageBox::critical(this, tr("Error"), tr("Could not set the remote repository."), QMessageBox::Ok); } } diff --git a/src/Workspace.cpp b/src/Workspace.cpp index b5cae22..cf2bcf4 100644 --- a/src/Workspace.cpp +++ b/src/Workspace.cpp @@ -24,7 +24,7 @@ void Workspace::clearState() getPaths().clear(); pathState.clear(); stashMap.clear(); - branchList.clear(); + branchNames.clear(); tags.clear(); isIntegrated = false; } @@ -351,12 +351,12 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie // Load the stashes, branches and tags fossil().stashList(getStashes()); - fossil().branchList(branchList, branchList); + fossil().branchList(branchNames, branchNames); fossil().tagList(tags); // Fossil includes the branches in the tag list // So remove them - foreach(const QString &name, branchList) + foreach(const QString &name, branchNames) tags.remove(name); _done: diff --git a/src/Workspace.h b/src/Workspace.h index f4f6870..c18579e 100644 --- a/src/Workspace.h +++ b/src/Workspace.h @@ -144,7 +144,7 @@ public: pathstate_map_t &getPathState() { return pathState; } stashmap_t &getStashes() { return stashMap; } QStringMap &getTags() { return tags; } - QStringList &getBranches() { return branchList; } + QStringList &getBranches() { return branchNames; } bool otherChanges() const { return isIntegrated; } const QString &getCurrentRevision() const { return fossil().getCurrentRevision(); } const QStringList &getActiveTags() const { return fossil().getActiveTags(); } @@ -159,6 +159,157 @@ public: Remote * findRemote(const QUrl& url); void storeWorkspace(QSettings &store); + + // Fossil Wrappers + void Init(UICallback *callback, const QString &exePath) + { + fossil().Init(callback, exePath); + } + + bool createWorkspace(const QString &repositoryPath, const QString& workspacePath) + { + return fossil().createWorkspace(repositoryPath, workspacePath); + } + + bool createRepository(const QString &repositoryPath) + { + return fossil().createRepository(repositoryPath); + } + + Fossil::WorkspaceState getWorkspaceState() + { + return fossil().getWorkspaceState(); + } + + bool closeWorkspace() + { + return fossil().closeWorkspace(); + } + + bool cloneRepository(const QString &repository, const QUrl &url, const QUrl &proxyUrl) + { + return fossil().cloneRepository(repository, url, proxyUrl); + } + + bool pushWorkspace(const QUrl& url) + { + return fossil().pushWorkspace(url); + } + + bool pullWorkspace(const QUrl& url) + { + return fossil().pullWorkspace(url); + } + + bool updateWorkspace(QStringList& result, const QString& revision, bool explainOnly) + { + return fossil().updateWorkspace(result, revision, explainOnly); + } + + bool undoWorkspace(QStringList& result, bool explainOnly) + { + return fossil().undoWorkspace(result, explainOnly); + } + + bool diffFile(const QString &repoFile, bool graphical) + { + return fossil().diffFile(repoFile, graphical); + } + + bool commitFiles(const QStringList &fileList, const QString &comment, const QString& newBranchName, bool isPrivateBranch) + { + return fossil().commitFiles(fileList, comment, newBranchName, isPrivateBranch); + } + + bool addFiles(const QStringList& fileList) + { + return fossil().addFiles(fileList); + } + + bool removeFiles(const QStringList& fileList, bool deleteLocal) + { + return fossil().removeFiles(fileList, deleteLocal); + } + + bool revertFiles(const QStringList& fileList) + { + return fossil().revertFiles(fileList); + } + + bool renameFile(const QString& beforePath, const QString& afterPath, bool renameLocal) + { + return fossil().renameFile(beforePath, afterPath, renameLocal); + } + + // Stashes + bool stashNew(const QStringList& fileList, const QString& name, bool revert) + { + return fossil().stashNew(fileList, name, revert); + } + + bool stashList(stashmap_t &stashes) + { + return fossil().stashList(stashes); + } + + bool stashApply(const QString& name) + { + return fossil().stashApply(name); + } + + bool stashDrop(const QString& name) + { + return fossil().stashDrop(name); + } + + bool stashDiff(const QString& name) + { + return fossil().stashDiff(name); + } + + // Tags + bool tagList(QStringMap& tags) + { + return fossil().tagList(tags); + } + + bool tagNew(const QString& name, const QString& revision) + { + return fossil().tagNew(name, revision); + } + + bool tagDelete(const QString& name, const QString& revision) + { + return fossil().tagDelete(name, revision); + } + + // Branches + bool branchList(QStringList& branches, QStringList& activeBranches) + { + return fossil().branchList(branches, activeBranches); + } + + bool branchNew(const QString& name, const QString& revisionBasis, bool isPrivate=false) + { + return fossil().branchNew(name, revisionBasis, isPrivate); + } + + bool branchMerge(QStringList& res, const QString& revision, bool integrate, bool force, bool testOnly) + { + return fossil().branchMerge(res, revision, integrate, force, testOnly); + } + + // Remotes + bool setDefaultRemoteUrl(const QUrl& url) + { + return fossil().setRemoteUrl(url); + } + + bool getInterfaceVersion(QString &version) + { + return fossil().getExeVersion(version); + } + private: static bool scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QStringList& ignorePatterns, UICallback &uiCallback); @@ -168,7 +319,7 @@ private: stringset_t pathSet; pathstate_map_t pathState; stashmap_t stashMap; - QStringList branchList; + QStringList branchNames; QStringMap tags; remote_map_t remotes; bool isIntegrated;