Added tag and branch list to workspace view
FossilOrigin-Name: 304f9bd6c61babe7abc522c1a1301fe3f1887505
This commit is contained in:
parent
a48f81d1f5
commit
729caef32e
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Renamed\sgetStashViewSelection\sto\sgetSelectionStashes
|
||||
D 2015-05-01T19:31:56.612
|
||||
C Added\stag\sand\sbranch\slist\sto\sworkspace\sview
|
||||
D 2015-05-02T12:44:09.110
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -196,18 +196,18 @@ F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8
|
||||
F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
||||
F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||
F src/Fossil.cpp b54d136f05764535636da04bcc5f60b2eb97e5b6
|
||||
F src/Fossil.h e46ec6cdb5c23a34176050fbd90e561ac87c07f9
|
||||
F src/Fossil.cpp c19b0e9b510743e7a49c7f0d2b4c5eba4b93382e
|
||||
F src/Fossil.h 33b6845a8adbc351f82c5256282671a6c3d864d2
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp 96ebf7dd8ecbff629a334160079051f671cf57d9
|
||||
F src/MainWindow.cpp 87b8831f7035c4584c2b4b728ad0b72f17ac63f1
|
||||
F src/MainWindow.h ef23aacdae4a6795fc19d9c24b3c76394a7b669d
|
||||
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
|
||||
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
|
||||
F src/Utils.cpp f78728e0817b1db23007ba0d2c5c26980ee7ebca
|
||||
F src/Utils.h 8ad68bd227bd999eb6ea92a70bb4be2d6788d912
|
||||
F src/Workspace.cpp 114daa2d44228ac253056fdf74a45e977d181475
|
||||
F src/Workspace.h 28e8e466df6ddce0bb80e8c9dbec7355d53f2c78
|
||||
F src/Workspace.cpp fca14549ff85125a9fb7fd8a2722198055ea9f9a
|
||||
F src/Workspace.h 8c965e73a966432e45ce80f4a223167eeafc3abe
|
||||
F src/main.cpp 2ac8badc2a63fa123ceae53382ce24cfe1b5a54b
|
||||
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
|
||||
@ -217,7 +217,7 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f
|
||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||
F ui/MainWindow.ui b735238428bad38bbb5c03e09975e5bb0fa156ab
|
||||
F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b
|
||||
P 1b0d47442df7a239ed11a048bde0073603b514f1
|
||||
R 7380968ed8535cfc03d075d0ca405f15
|
||||
P 82357d43ca742466e08d3794bdc9a4ab800ad867
|
||||
R 32a798815197954f6956d147e48ec66c
|
||||
U kostas
|
||||
Z b61f064d91c92dc5af55c95f81df5c39
|
||||
Z da4f0b035007563aa632b403c0d99df8
|
||||
|
@ -1 +1 @@
|
||||
82357d43ca742466e08d3794bdc9a4ab800ad867
|
||||
304f9bd6c61babe7abc522c1a1301fe3f1887505
|
@ -417,6 +417,63 @@ bool Fossil::stashDiff(const QString& name)
|
||||
return runFossil(QStringList() << "stash" << "diff" << name, 0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Fossil::tagList(QStringList& tags)
|
||||
{
|
||||
tags.clear();
|
||||
QStringList res;
|
||||
|
||||
if(!runFossil(QStringList() << "tag" << "ls", &res, RUNFLAGS_SILENT_ALL))
|
||||
return false;
|
||||
|
||||
foreach(const QString &line, res)
|
||||
{
|
||||
QString tag = line.trimmed();
|
||||
|
||||
if(tag.isEmpty())
|
||||
continue;
|
||||
tags.append(tag);
|
||||
}
|
||||
tags.sort();
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Fossil::branchList(QStringList& branches, QStringList& activeBranches)
|
||||
{
|
||||
branches.clear();
|
||||
activeBranches.clear();
|
||||
QStringList res;
|
||||
|
||||
if(!runFossil(QStringList() << "branch" , &res, RUNFLAGS_SILENT_ALL))
|
||||
return false;
|
||||
|
||||
foreach(const QString &line, res)
|
||||
{
|
||||
QString name = line.trimmed();
|
||||
|
||||
if(name.isEmpty())
|
||||
continue;
|
||||
|
||||
// Active branches start with a start
|
||||
int active_index = name.indexOf('*');
|
||||
bool is_active = (active_index != -1) && active_index==0;
|
||||
|
||||
// Strip
|
||||
if(is_active)
|
||||
{
|
||||
name = name.mid(is_active+1).trimmed();
|
||||
activeBranches.append(name);
|
||||
}
|
||||
else
|
||||
branches.append(name);
|
||||
}
|
||||
|
||||
branches.sort();
|
||||
activeBranches.sort();
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static QString ParseFossilQuery(QString line)
|
||||
{
|
||||
|
@ -110,6 +110,9 @@ public:
|
||||
|
||||
void abortOperation() { operationAborted = true; }
|
||||
|
||||
bool tagList(QStringList& tags);
|
||||
bool branchList(QStringList& branches, QStringList& activeBranches);
|
||||
|
||||
private:
|
||||
void log(const QString &text, bool isHTML=false)
|
||||
{
|
||||
|
@ -669,33 +669,49 @@ void MainWindow::updateDirView()
|
||||
}
|
||||
}
|
||||
|
||||
// Branches
|
||||
QStandardItem *branches = new QStandardItem(QIcon(":icons/icons/Document Organization Chart-01.png"), "Branches");
|
||||
branches->setData(TreeViewItem(TreeViewItem::TYPE_BRANCHES, ""), REPODIRMODEL_ROLE_PATH);
|
||||
branches->setEditable(false);
|
||||
getWorkspace().getDirModel().appendRow(branches);
|
||||
foreach(const QString &branch_name, getWorkspace().getBranches())
|
||||
{
|
||||
QStandardItem *branch = new QStandardItem(QIcon(":icons/icons/Document Organization Chart-01.png"), branch_name);
|
||||
branch->setData(TreeViewItem(TreeViewItem::TYPE_BRANCH, branch_name), REPODIRMODEL_ROLE_PATH);
|
||||
branches->appendRow(branch);
|
||||
}
|
||||
|
||||
// Tags
|
||||
QStandardItem *tags = new QStandardItem(QIcon(":icons/icons/Book-01.png"), "Tags");
|
||||
tags->setData(TreeViewItem(TreeViewItem::TYPE_TAGS, ""), REPODIRMODEL_ROLE_PATH);
|
||||
tags->setEditable(false);
|
||||
getWorkspace().getDirModel().appendRow(tags);
|
||||
foreach(const QString &tag_name, getWorkspace().getTags())
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
// Stashes
|
||||
QStandardItem *stashes = new QStandardItem(QIcon(":icons/icons/My Documents-01.png"), "Stashes");
|
||||
stashes->setData(TreeViewItem(TreeViewItem::TYPE_STASHES, ""), REPODIRMODEL_ROLE_PATH);
|
||||
stashes->setEditable(false);
|
||||
getWorkspace().getDirModel().appendRow(stashes);
|
||||
for(stashmap_t::const_iterator it= getWorkspace().getStashes().begin(); it!=getWorkspace().getStashes().end(); ++it)
|
||||
{
|
||||
QStandardItem *stash = new QStandardItem(QIcon(":icons/icons/Folder-01.png"), it.key());
|
||||
QStandardItem *stash = new QStandardItem(QIcon(":icons/icons/My Documents-01.png"), it.key());
|
||||
stash->setData(TreeViewItem(TreeViewItem::TYPE_STASH, it.value()), REPODIRMODEL_ROLE_PATH);
|
||||
stashes->appendRow(stash);
|
||||
}
|
||||
|
||||
|
||||
QStandardItem *tags = new QStandardItem(QIcon(":icons/icons/Book-01.png"), "Tags");
|
||||
tags->setData(TreeViewItem(TreeViewItem::TYPE_TAGS, ""), REPODIRMODEL_ROLE_PATH);
|
||||
tags->setEditable(false);
|
||||
getWorkspace().getDirModel().appendRow(tags);
|
||||
|
||||
// Remotes
|
||||
QStandardItem *remotes = new QStandardItem(QIcon(":icons/icons/Network PC-01.png"), "Remotes");
|
||||
remotes->setData(TreeViewItem(TreeViewItem::TYPE_REMOTES, ""), REPODIRMODEL_ROLE_PATH);
|
||||
remotes->setEditable(false);
|
||||
getWorkspace().getDirModel().appendRow(remotes);
|
||||
|
||||
// Settings
|
||||
QStandardItem *settings = new QStandardItem(QIcon(":icons/icons/Gear-01.png"), "Settings");
|
||||
settings->setData(TreeViewItem(TreeViewItem::TYPE_SETTINGS, ""), REPODIRMODEL_ROLE_PATH);
|
||||
settings->setEditable(false);
|
||||
|
@ -186,6 +186,15 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
||||
|
||||
// Load the stash
|
||||
fossil().stashList(getStashes());
|
||||
|
||||
fossil().branchList(branchList, branchList);
|
||||
|
||||
fossil().tagList(tagList);
|
||||
// Fossil includes the branches in the tag list
|
||||
// So remove them
|
||||
foreach(const QString &name, branchList)
|
||||
tagList.removeAll(name);
|
||||
|
||||
_done:
|
||||
uiCallback.endProcess();
|
||||
}
|
||||
|
@ -120,12 +120,16 @@ public:
|
||||
filemap_t &getFiles() { return workspaceFiles; }
|
||||
stringset_t &getPaths() { return pathSet; }
|
||||
stashmap_t &getStashes() { return stashMap; }
|
||||
QStringList &getTags() { return tagList; }
|
||||
QStringList &getBranches() { return branchList; }
|
||||
|
||||
private:
|
||||
Fossil bridge;
|
||||
filemap_t workspaceFiles;
|
||||
stringset_t pathSet;
|
||||
stashmap_t stashMap;
|
||||
QStringList branchList;
|
||||
QStringList tagList;
|
||||
|
||||
QStandardItemModel repoFileModel;
|
||||
QStandardItemModel repoDirModel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user