#
#
# patch "guitone/res/forms/update_workspace.ui"
# from [1ab451b897d3cddd3b4cf6db68fba93b142d7be5]
# to [9ab8858e2d6e2c098d641974eda6d029a19c3b4b]
#
# patch "guitone/src/monotone/Monotone.cpp"
# from [67695c80ab3235132e5ef09938b17ff9f9c41dc1]
# to [40298a2fc25d054404bc707cf3abd7a1b4312547]
#
# patch "guitone/src/monotone/MonotoneDelegate.cpp"
# from [8ced325644429a3184ad3af3c8cff57935138140]
# to [191136263572d10bd33319fd68b89251fe38d5d7]
#
# patch "guitone/src/monotone/MonotoneDelegate.h"
# from [d8a29d33b3159cee8097a2e9dae0431d6e3fc077]
# to [90d2cbee4e869a67166728b9f5fa73dc574ae57a]
#
# patch "guitone/src/view/dialogs/DatabaseView.cpp"
# from [46f48c4b9060cb37cb8a28f6b652a599e131ffa9]
# to [13160196473d423ce4d93f67b43b6c2f21084b06]
#
# patch "guitone/src/view/dialogs/SelectRevision.cpp"
# from [cbbddc03998b43c5b38913183e74cbfd94f48128]
# to [1dd6ddd72a6a24749b9324ce067e0d13a026e648]
#
# patch "guitone/src/view/dialogs/SelectRevision.h"
# from [b2bd738e08ba2e3899fa2d3d83c7f3505d452241]
# to [23e1f02d0da51fcf7ffe720b5d346a0f36e98a7a]
#
# patch "guitone/src/view/dialogs/UpdateWorkspace.cpp"
# from [8c45dee2130daca23cb09f526ca0578d8b40d323]
# to [6afc965a7d6216f59b4fe5a3404db462387a2b13]
#
# patch "guitone/src/view/dialogs/UpdateWorkspace.h"
# from [c72f6ca89fb849509f78100e1ec8fbc1a66b784d]
# to [e84c1072dc7c37aa6b0d12480d7328d100f01f29]
#
============================================================
--- guitone/res/forms/update_workspace.ui 1ab451b897d3cddd3b4cf6db68fba93b142d7be5
+++ guitone/res/forms/update_workspace.ui 9ab8858e2d6e2c098d641974eda6d029a19c3b4b
@@ -100,6 +100,9 @@
Qt::Horizontal
+
+ QSizePolicy::MinimumExpanding
+
40
@@ -109,7 +112,22 @@
-
-
+
+
+
+ 3
+ 0
+ 0
+ 0
+
+
+
+
+ 200
+ 0
+
+
+
@@ -133,6 +151,9 @@
Qt::Horizontal
+
+ QSizePolicy::MinimumExpanding
+
40
@@ -142,7 +163,22 @@
-
-
+
+
+
+ 3
+ 0
+ 0
+ 0
+
+
+
+
+ 200
+ 0
+
+
+
============================================================
--- guitone/src/monotone/Monotone.cpp 67695c80ab3235132e5ef09938b17ff9f9c41dc1
+++ guitone/src/monotone/Monotone.cpp 40298a2fc25d054404bc707cf3abd7a1b4312547
@@ -93,7 +93,7 @@ const QString Monotone::RequiredInterfac
const QString Monotone::RequiredProgramVersion = "0.32";
const QString Monotone::RequiredInterfaceVersion = "4.0";
-const int Monotone::StdioBufferSize = 50 * 1024 * 1024;
+const int Monotone::StdioBufferSize = 60;//50 * 1024 * 1024;
const int Monotone::WaitForMonotoneStart = 15000; // milliseconds
Monotone::Monotone(QObject * parent) : QObject(parent), process(0)
@@ -447,7 +447,7 @@ void Monotone::readAndParseStdout()
return;
}
- input = input.mid(parser.getProcessedBytes());
+ input = parser.getLeftBytes();
int commandNumber = parser.getCommandNumber();
int returnCode = parser.getErrorCode();
============================================================
--- guitone/src/monotone/MonotoneDelegate.cpp 8ced325644429a3184ad3af3c8cff57935138140
+++ guitone/src/monotone/MonotoneDelegate.cpp 191136263572d10bd33319fd68b89251fe38d5d7
@@ -108,7 +108,7 @@ QString MonotoneDelegate::getOption(cons
if (mtn->getReturnCode(cmdNum) > 0)
{
- qCritical("Inventory::getOption: Couldn't retrieve option %s: %s",
+ qCritical("Couldn't retrieve option %s: %s",
qPrintable(opt), qPrintable(data));
return QString();
}
@@ -148,3 +148,22 @@ QString MonotoneDelegate::getBranchNameS
return shortBranchName;
}
+QStringList MonotoneDelegate::resolveSelector(const QString & selector)
+{
+ Monotone * mtn = Monotone::singleton();
+
+ int cmdNum;
+ mtn->executeCommand(QStringList() << "select" << selector, cmdNum);
+
+ QString data = mtn->getDecodedData(cmdNum);
+
+ if (mtn->getReturnCode(cmdNum) > 0)
+ {
+ qCritical("Couldn't resolve selector %s: %s",
+ qPrintable(selector), qPrintable(data));
+ return QStringList();
+ }
+
+ QStringList revList = data.split('\n', QString::SkipEmptyParts);
+ return revList;
+}
============================================================
--- guitone/src/monotone/MonotoneDelegate.h d8a29d33b3159cee8097a2e9dae0431d6e3fc077
+++ guitone/src/monotone/MonotoneDelegate.h 90d2cbee4e869a67166728b9f5fa73dc574ae57a
@@ -39,6 +39,7 @@ public:
static QString getOption(const QString &);
static QString getBranchName();
static QString getBranchNameShort();
+ static QStringList resolveSelector(const QString &);
private:
AutomateCommand * cmdModel;
============================================================
--- guitone/src/view/dialogs/DatabaseView.cpp 46f48c4b9060cb37cb8a28f6b652a599e131ffa9
+++ guitone/src/view/dialogs/DatabaseView.cpp 13160196473d423ce4d93f67b43b6c2f21084b06
@@ -82,7 +82,7 @@ void DatabaseView::initTreeWidget()
void DatabaseView::initTreeWidget()
{
- branchModel = new Branches(tree, this);
+ branchModel = new Branches(this, tree);
branchModel->readBranches();
branches->setRootIsDecorated(false);
branches->setModel(branchModel);
============================================================
--- guitone/src/view/dialogs/SelectRevision.cpp cbbddc03998b43c5b38913183e74cbfd94f48128
+++ guitone/src/view/dialogs/SelectRevision.cpp 1dd6ddd72a6a24749b9324ce067e0d13a026e648
@@ -390,3 +390,10 @@ void SelectRevision::contextMenuRequeste
}
}
+void SelectRevision::queryRevisions(const QString & selector)
+{
+ selectorBox->setCurrentIndex(selectorBox->findData(""));
+ selectorValue->setText(selector);
+ triggerRevisionSearch();
+}
+
============================================================
--- guitone/src/view/dialogs/SelectRevision.h b2bd738e08ba2e3899fa2d3d83c7f3505d452241
+++ guitone/src/view/dialogs/SelectRevision.h 23e1f02d0da51fcf7ffe720b5d346a0f36e98a7a
@@ -40,6 +40,7 @@ public:
SelectRevision(QWidget *);
~SelectRevision();
inline QString getSelectedRevision() const { return currentRevision; }
+ void queryRevisions(const QString &);
private:
void openManifestDialog(const QString &);
============================================================
--- guitone/src/view/dialogs/UpdateWorkspace.cpp 8c45dee2130daca23cb09f526ca0578d8b40d323
+++ guitone/src/view/dialogs/UpdateWorkspace.cpp 6afc965a7d6216f59b4fe5a3404db462387a2b13
@@ -21,6 +21,7 @@
#include "UpdateWorkspace.h"
#include "SelectRevision.h"
#include "MonotoneDelegate.h"
+#include "Settings.h"
#include
@@ -37,29 +38,155 @@ UpdateWorkspace::UpdateWorkspace(QWidget
updateToLatest->text().arg(MonotoneDelegate::getBranchName())
);
- // create the models
- selectorModel = new Select(this);
- branchesModel = new Branches(false, this);
- tagsModel = new Tags(this);
+ branchesModel = new Branches(this, false);
+ branchesModel->readBranches();
+ branchList->setModel(branchesModel);
+ tagsModel = new Tags(this);
+ tagsModel->readTags(QString());
+ tagList->setModel(tagsModel);
+
+ selectorCompleter = new QCompleter(
+ Settings::getItemList("RecentUpdateSelectors"),
+ this
+ );
+
+ selectorCompleter->setCaseSensitivity(Qt::CaseInsensitive);
+ selectedRevision->setCompleter(selectorCompleter);
+
connect(
selectRevision, SIGNAL(clicked()),
- this, SLOT(openSelectRevision())
+ this, SLOT(slotSelectRevision())
);
+
+ connect(
+ branchList, SIGNAL(activated(int)),
+ this, SLOT(selectBranchOption())
+ );
+
+ connect(
+ tagList, SIGNAL(activated(int)),
+ this, SLOT(selectTagOption())
+ );
+
+ connect(
+ selectedRevision, SIGNAL(textChanged(const QString &)),
+ this, SLOT(selectSelectorOption())
+ );
}
UpdateWorkspace::~UpdateWorkspace()
{
- delete selectorModel;
delete branchesModel;
delete tagsModel;
+ delete selectorCompleter;
}
-void UpdateWorkspace::openSelectRevision()
+void UpdateWorkspace::accept()
{
+ QString selector;
+
+ if (updateToLatest->isChecked())
+ {
+ selector = "h:" + MonotoneDelegate::getBranchName();
+ }
+
+ if (updateToBranch->isChecked())
+ {
+ QString selection(branchList->currentText());
+ if (selection.isEmpty())
+ {
+ QMessageBox::warning(
+ this,
+ tr("No branch selected"),
+ tr("Please select a branch from the list of branches."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+ selector = "h:" + selection;
+ }
+
+ if (updateToTag->isChecked())
+ {
+ QString selection(tagList->currentText());
+ if (selection.isEmpty())
+ {
+ QMessageBox::warning(
+ this,
+ tr("No tag selected"),
+ tr("Please select a tag from the list of tags (if any are available)."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+ selector = "t:" + selection;
+ }
+
+ if (updateToRevision->isChecked())
+ {
+ QString selection = selectedRevision->text();
+ if (selection.isEmpty())
+ {
+ QMessageBox::warning(
+ this,
+ tr("No selector given"),
+ tr("Please enter a monotone selector or choose a revision by clicking on 'select revision'."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+ selector = selection;
+ Settings::addItemToList("RecentUpdateSelectors", selection, 10);
+ }
+
+ QStringList revList(MonotoneDelegate::resolveSelector(selector));
+
+ if (revList.size() == 0)
+ {
+ QMessageBox::warning(
+ this,
+ tr("No revisions matched"),
+ tr("Your selection didn't match any revisions or was invalid."),
+ QMessageBox::Ok
+ );
+ return;
+ }
+
+ if (revList.size() > 1)
+ {
+ QMessageBox::information(
+ this,
+ tr("Multiple revisions matched"),
+ tr("Your selection matched multiple revisions. Please choose one."),
+ QMessageBox::Ok
+ );
+
+ openSelectRevision(selector);
+ return;
+ }
+
+ selectedRevisionId = revList.at(0);
+ qDebug("selected %s as update revision", qPrintable(selectedRevisionId));
+ done(0);
+}
+
+void UpdateWorkspace::slotSelectRevision()
+{
+ openSelectRevision(QString());
+}
+
+void UpdateWorkspace::openSelectRevision(const QString & selector)
+{
hide();
SelectRevision dlg(parentWidget());
+
+ if (selector.size() > 0)
+ {
+ dlg.queryRevisions(selector);
+ }
+
if (dlg.execDocumentModal() == QDialog::Accepted)
{
selectedRevision->setText(dlg.getSelectedRevision());
@@ -68,3 +195,18 @@ void UpdateWorkspace::openSelectRevision
show();
}
+void UpdateWorkspace::selectBranchOption()
+{
+ updateToBranch->setChecked(true);
+}
+
+void UpdateWorkspace::selectTagOption()
+{
+ updateToTag->setChecked(true);
+}
+
+void UpdateWorkspace::selectSelectorOption()
+{
+ updateToRevision->setChecked(true);
+}
+
============================================================
--- guitone/src/view/dialogs/UpdateWorkspace.h c72f6ca89fb849509f78100e1ec8fbc1a66b784d
+++ guitone/src/view/dialogs/UpdateWorkspace.h e84c1072dc7c37aa6b0d12480d7328d100f01f29
@@ -39,15 +39,19 @@ private:
inline QString getSelectedRevision() const { return selectedRevisionId; }
private:
- Select * selectorModel;
+ void openSelectRevision(const QString &);
+
Branches * branchesModel;
Tags * tagsModel;
QCompleter * selectorCompleter;
-
- QString selectedRevisionId;
+ QString selectedRevisionId;
private slots:
- void openSelectRevision();
+ void slotSelectRevision();
+ void accept();
+ void selectBranchOption();
+ void selectTagOption();
+ void selectSelectorOption();
};
#endif