Support for deleting tags

When parsing tags, also keep track of the checkin uuid
Fixed key-value parsing
Prevent apply stash when nothing is selected

FossilOrigin-Name: 72ac541c4c28f83c94c371f2d81e116b8f3cf261
This commit is contained in:
kostas 2015-05-03 10:05:46 +00:00
parent 8e21224a5e
commit 9777e1e2da
9 changed files with 84 additions and 33 deletions

View File

@ -1,5 +1,5 @@
C Prevent\sunnecessary\sdialog\swhen\supdating\swith\sno\snew\schanges
D 2015-05-03T09:22:18.712
C Support\sfor\sdeleting\stags\nWhen\sparsing\stags,\salso\skeep\strack\sof\sthe\scheckin\suuid\nFixed\skey-value\sparsing\nPrevent\sapply\sstash\swhen\snothing\sis\sselected
D 2015-05-03T10:05:46.143
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
@ -196,20 +196,20 @@ F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8
F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
F src/Fossil.cpp 8abdf4c95dfd2728fb11a2a07ea5c05eabba27d6
F src/Fossil.h 7954818fa3168d56901f8549ca5ae56987f48a6a
F src/Fossil.cpp 46edbf48a7f09c0673136c726f62cf3e95e92f1e
F src/Fossil.h 7e45c12f80c06af78bf7a13cce75e0b105e0b99a
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
F src/MainWindow.cpp b7d4d636adeb84fece029e234c5eae89576c2dcf
F src/MainWindow.h e8b8be6b33e68a894d6ed84597f4767c83daf750
F src/MainWindow.cpp b671fe2af7eb0c0abfecfde6840e1871d81b8b2e
F src/MainWindow.h dffe67ceb1d7a51b858ce8a0fb688bfa7e90c5be
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
F src/UpdateDialog.cpp 5f9ff02aeed08ab3a69d0a9a3b3efeefbc38f3d4
F src/UpdateDialog.h 93c6ad9bd814f23e431c67bcd01928f33e10a80b
F src/Utils.cpp 0a95368bb776a5c34c5baa94e490795ac28085db
F src/Utils.cpp 748a58f19187aff7f3b867894129291cbe091678
F src/Utils.h 9cc125f59b8d46ff47bbde4c2cf9bc77f8e2553b
F src/Workspace.cpp fca14549ff85125a9fb7fd8a2722198055ea9f9a
F src/Workspace.h 8c965e73a966432e45ce80f4a223167eeafc3abe
F src/Workspace.cpp 329b9ecd8363089b5fb230c0fd3606f2e9dab73a
F src/Workspace.h 890fdb5f6b768809bc962374d22422dbfb6e89a1
F src/main.cpp 2ac8badc2a63fa123ceae53382ce24cfe1b5a54b
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
@ -220,7 +220,7 @@ F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
F ui/MainWindow.ui 90bbd2df0afd46e82d4a850882a22f30d3bffe38
F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b
F ui/UpdateDialog.ui 636fd495d481ade1f20a65f79b538b9a49bbf1fa
P 579a9a1fb06478cd37359eb106dcabc9c9c5fa5c
R 30503d6fb517411a767917fc163e9df3
P f718ab845eb859700e230090f2fcbc7ddb068e62
R 197606d9fc8722007f17afea79985f5b
U kostas
Z 75fb60e450053acd43b176a1071af21e
Z ca089f166e60a5d33f43d6190be818dc

View File

@ -1 +1 @@
f718ab845eb859700e230090f2fcbc7ddb068e62
72ac541c4c28f83c94c371f2d81e116b8f3cf261

View File

@ -439,23 +439,38 @@ bool Fossil::stashDiff(const QString& name)
}
//------------------------------------------------------------------------------
bool Fossil::tagList(QStringList& tags)
bool Fossil::tagList(QStringMap& tags)
{
tags.clear();
QStringList res;
QStringList tagnames;
if(!runFossil(QStringList() << "tag" << "ls", &res, RUNFLAGS_SILENT_ALL))
if(!runFossil(QStringList() << "tag" << "ls", &tagnames, RUNFLAGS_SILENT_ALL))
return false;
foreach(const QString &line, res)
QStringList info;
foreach(const QString &line, tagnames)
{
QString tag = line.trimmed();
if(tag.isEmpty())
continue;
tags.append(tag);
info.clear();
if(!runFossil(QStringList() << "info" << tag, &info, RUNFLAGS_SILENT_ALL))
return false;
QStringMap props;
ParseProperties(props, info, ':');
Q_ASSERT(props.contains("uuid"));
// uuid: 0e29a46f036d2e0cc89727190ad34c2dfdc5737c 2015-04-27 15:41:45 UTC
QStringList uuid = props["uuid"].trimmed().split(' ');
Q_ASSERT(uuid.length()>0);
QString revision = uuid[0].trimmed();
tags.insert(tag, revision);
}
tags.sort();
return true;
}
@ -464,11 +479,22 @@ bool Fossil::tagNew(const QString& name, const QString& revision)
{
QStringList res;
if(!runFossil(QStringList() << "tag" << "add" << name << revision, &res, RUNFLAGS_SILENT_ALL))
if(!runFossil(QStringList() << "tag" << "add" << name << revision, &res))
return false;
return true;
}
//------------------------------------------------------------------------------
bool Fossil::tagDelete(const QString& name, const QString &revision)
{
QStringList res;
if(!runFossil(QStringList() << "tag" << "cancel" << name << revision, &res))
return false;
return true;
}
//------------------------------------------------------------------------------
bool Fossil::branchList(QStringList& branches, QStringList& activeBranches)
{

View File

@ -111,9 +111,9 @@ public:
void abortOperation() { operationAborted = true; }
bool tagList(QStringList& tags);
bool tagList(QStringMap& tags);
bool tagNew(const QString& name, const QString& revision);
bool tagDelete(const QString& name);
bool tagDelete(const QString& name, const QString& revision);
bool branchList(QStringList& branches, QStringList& activeBranches);

View File

@ -591,7 +591,10 @@ void MainWindow::scanWorkspace()
versionList.clear();
versionList.append(latest);
versionList += getWorkspace().getBranches();
versionList += getWorkspace().getTags();
versionList += getWorkspace().getTags().keys();
selectedTags.clear();
selectedBranches.clear();
setBusy(false);
setStatus("");
@ -677,8 +680,9 @@ void MainWindow::updateWorkspaceView()
tags->setData(TreeViewItem(TreeViewItem::TYPE_TAGS, ""), REPODIRMODEL_ROLE_PATH);
tags->setEditable(false);
getWorkspace().getDirModel().appendRow(tags);
foreach(const QString &tag_name, getWorkspace().getTags())
for(QStringMap::const_iterator it=getWorkspace().getTags().begin(); it!=getWorkspace().getTags().end(); ++it)
{
const QString &tag_name = it.key();
QStandardItem *tag = new QStandardItem(QIcon(":icons/icons/Book-01.png"), tag_name);
tag->setData(TreeViewItem(TreeViewItem::TYPE_TAG, tag_name), REPODIRMODEL_ROLE_PATH);
tags->appendRow(tag);
@ -1613,10 +1617,12 @@ void MainWindow::onWorkspaceTreeViewSelectionChanged(const QItemSelection &/*sel
Q_ASSERT(data.isValid());
TreeViewItem tv = data.value<TreeViewItem>();
if(tv.Type != TreeViewItem::TYPE_FOLDER && tv.Type != TreeViewItem::TYPE_WORKSPACE)
continue;
new_dirs.insert(tv.Value);
if(tv.Type == TreeViewItem::TYPE_FOLDER || tv.Type == TreeViewItem::TYPE_WORKSPACE)
new_dirs.insert(tv.Value);
else if(tv.Type == TreeViewItem::TYPE_TAG)
selectedTags.append(tv.Value);
else if(tv.Type == TreeViewItem::TYPE_BRANCH)
selectedBranches.append(tv.Value);
}
// Update the selection if we have any new folders
@ -1870,6 +1876,9 @@ void MainWindow::on_actionApplyStash_triggered()
QStringList stashes;
getSelectionStashes(stashes);
if(stashes.empty())
return;
bool delete_stashes = false;
if(!FileActionDialog::run(this, tr("Apply Stash"), tr("The following stashes will be applied.")+"\n"+tr("Are you sure?"), stashes, tr("Delete after applying"), &delete_stashes))
return;
@ -2225,7 +2234,20 @@ void MainWindow::on_actionNewTag_triggered()
//------------------------------------------------------------------------------
void MainWindow::on_actionDeleteTag_triggered()
{
if(selectedTags.size()!=1)
return;
const QString &tagname = selectedTags.first();
if(QMessageBox::Yes != DialogQuery(this, tr("Delete Tag"), tr("Are you sure want to delete the tag %0 ?").arg(tagname)))
return;
Q_ASSERT(getWorkspace().getTags().contains(tagname));
const QString &revision = getWorkspace().getTags()[tagname];
fossil().tagDelete(tagname, revision);
refresh();
}
//------------------------------------------------------------------------------

View File

@ -164,6 +164,8 @@ private:
bool operationAborted;
stringset_t selectedDirs; // The directory selected in the tree
QStringList selectedTags;
QStringList selectedBranches;
QStringList versionList;
Workspace workspace;

View File

@ -320,7 +320,7 @@ void ParseProperties(QStringMap &properties, const QStringList &lines, QChar sep
if(index!=-1)
{
key = l.left(index).trimmed();
value = l.mid(index).trimmed();
value = l.mid(index+1).trimmed();
}
else
key = l;

View File

@ -189,11 +189,11 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
fossil().branchList(branchList, branchList);
fossil().tagList(tagList);
fossil().tagList(tags);
// Fossil includes the branches in the tag list
// So remove them
foreach(const QString &name, branchList)
tagList.removeAll(name);
tags.remove(name);
_done:
uiCallback.endProcess();

View File

@ -6,6 +6,7 @@
#include <QDir>
#include <QSet>
#include <QMap>
#include "Utils.h"
#include "Fossil.h"
//////////////////////////////////////////////////////////////////////////
@ -120,7 +121,7 @@ public:
filemap_t &getFiles() { return workspaceFiles; }
stringset_t &getPaths() { return pathSet; }
stashmap_t &getStashes() { return stashMap; }
QStringList &getTags() { return tagList; }
QStringMap &getTags() { return tags; }
QStringList &getBranches() { return branchList; }
private:
@ -129,7 +130,7 @@ private:
stringset_t pathSet;
stashmap_t stashMap;
QStringList branchList;
QStringList tagList;
QStringMap tags;
QStandardItemModel repoFileModel;
QStandardItemModel repoDirModel;