#
#
# add_file "guitone/res/forms/commit_revision.ui"
# content [78cef617df6139602c85a8d944f455ada106f0ca]
#
# add_file "guitone/src/model/GetRevision.cpp"
# content [9ced226a036d9bf560f8b2bc7c2bd90d3d916b40]
#
# add_file "guitone/src/model/GetRevision.h"
# content [9cb280cfdc594b15059acce545e9c0a90a8de9d4]
#
# add_file "guitone/src/view/dialogs/CommitRevision.cpp"
# content [e9f64428b27666c3c5985bb7bbddc3817308ec0a]
#
# add_file "guitone/src/view/dialogs/CommitRevision.h"
# content [c6064832b35481c22dd0d0bc11d07fb221f40793]
#
# patch "guitone/guitone.pro"
# from [9498bf3718baefb221af5a0a302a9f1accf4cfcc]
# to [9c37c31facd0210a4d47db3d688b0f70f807c3ce]
#
# patch "guitone/res/forms/main_window.ui"
# from [c1486a9008e6114a0f4e9ecb8dc7fd8ae7b12706]
# to [62161c4ccc8ae3874887d716c76ea8f179aa2b4c]
#
# patch "guitone/src/view/MainWindow.cpp"
# from [13a2b8934f4761e361cccf1963f85076c47ec448]
# to [fbf63888c531297f7941918ebeb4ee6de9f1ed5c]
#
# patch "guitone/src/view/MainWindow.h"
# from [9fc77547a3eb9bebfeecd21f3efcff99d77fa71b]
# to [a6eec6cd24f15814a4f00dc46cb458432930a2f1]
#
============================================================
--- guitone/res/forms/commit_revision.ui 78cef617df6139602c85a8d944f455ada106f0ca
+++ guitone/res/forms/commit_revision.ui 78cef617df6139602c85a8d944f455ada106f0ca
@@ -0,0 +1,380 @@
+
+ CommitRevision
+
+
+
+ 0
+ 0
+ 423
+ 522
+
+
+
+ Commit revision
+
+
+
+ 9
+
+
+ 6
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ Changes to commit
+
+
+
+ 9
+
+
+ 6
+
+
-
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ QAbstractItemView::ExtendedSelection
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ Select all
+
+
+
+ -
+
+
+ Invert Selection
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Changelog entry
+
+
+
+ 9
+
+
+ 6
+
+
-
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ Previous changelog entries
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ use alternative branch
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+
+ 7
+ 0
+ 0
+ 0
+
+
+
+
+ 200
+ 0
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ use alternative author
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 16
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+
+ 7
+ 0
+ 0
+ 0
+
+
+
+
+ 200
+ 0
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Abort
+
+
+
+ -
+
+
+ Commit
+
+
+
+
+
+
+
+
+
+
+
+ TreeView
+ QTreeView
+
+
+
+
+
+
+ checkAltAuthor
+ toggled(bool)
+ altAuthor
+ setEnabled(bool)
+
+
+ 89
+ 458
+
+
+ 238
+ 461
+
+
+
+
+ checkAltBranch
+ toggled(bool)
+ altBranch
+ setEnabled(bool)
+
+
+ 87
+ 425
+
+
+ 243
+ 427
+
+
+
+
+ selectAll
+ clicked()
+ changeView
+ selectAll()
+
+
+ 64
+ 180
+
+
+ 78
+ 98
+
+
+
+
+ abort
+ clicked()
+ CommitRevision
+ reject()
+
+
+ 294
+ 502
+
+
+ 146
+ 487
+
+
+
+
+ commitRev
+ clicked()
+ CommitRevision
+ accept()
+
+
+ 371
+ 492
+
+
+ 45
+ 483
+
+
+
+
+
============================================================
--- guitone/src/model/GetRevision.cpp 9ced226a036d9bf560f8b2bc7c2bd90d3d916b40
+++ guitone/src/model/GetRevision.cpp 9ced226a036d9bf560f8b2bc7c2bd90d3d916b40
@@ -0,0 +1,232 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Thomas Keller *
+ * address@hidden *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "GetRevision.h"
+#include "InventoryItem.h"
+#include "Monotone.h"
+#include "BasicIOParser.h"
+
+#include
+
+GetRevision::GetRevision(QObject *parent)
+ : QStandardItemModel(parent)
+{
+ mtnDelegate = new MonotoneDelegate(this);
+}
+
+GetRevision::~GetRevision()
+{
+ delete mtnDelegate;
+}
+
+bool GetRevision::readRevision(const QString & rev)
+{
+ clear();
+
+ QStringList cmd;
+ cmd << "get_revision";
+ if (rev.size() > 0)
+ {
+ cmd << rev;
+ }
+
+ return mtnDelegate->triggerCommand(cmd);
+}
+
+void GetRevision::parseOutput()
+{
+ BasicIOParser parser(AutomateCommand::data);
+ Q_ASSERT(parser.parse());
+ StanzaList list = parser.getStanzas();
+
+ setHorizontalHeaderLabels(QStringList() << tr("Changes"));
+ QMap changemap;
+
+ for (int i=0, size = list.size(); i < size; ++i)
+ {
+ Stanza stanza = list.at(i);
+
+ QString type;
+ QString data;
+ QString data2;
+
+ for (int j=0, size2 = stanza.size(); j < size2; j++)
+ {
+ StanzaEntry entry = stanza.at(j);
+
+ if (i == 0 && j == 0)
+ {
+ if (entry.sym != "format_version")
+ {
+ qWarning("GetRevision::parseOutput(): First entry in first stanza should be used format version.");
+ } else
+ if (entry.vals.at(0) != "1")
+ {
+ qWarning("GetRevision::parseOutput(): Format version is unequal to '1' - newer interface version?");
+ }
+ break;
+ }
+
+ // we're only interested in real changeset entries
+ if (j == 0 && (entry.sym == "new_manifest" || entry.sym == "old_revision"))
+ break;
+
+ if (entry.sym == "delete")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ type = "delete";
+ data = entry.vals.at(0);
+ break;
+ }
+
+ if (entry.sym == "rename")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ type = "rename";
+ data = entry.vals.at(0);
+ continue;
+ }
+
+ if (entry.sym == "to" && type == "rename")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ data = tr("%1 to %2").arg(data).arg(entry.vals.at(0));
+ break;
+ }
+
+ if (entry.sym == "add_dir")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ type = "add_dir";
+ data = entry.vals.at(0);
+ break;
+ }
+
+ if (entry.sym == "add_file")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ type ="add_file";
+ data = entry.vals.at(0);
+ // we're not interested in the FILEID here
+ break;
+ }
+
+ if (entry.sym == "patch")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ type = "patch";
+ data = entry.vals.at(0);
+ // we're not interested in the old/new FILEID here
+ break;
+ }
+
+ if (entry.sym == "clear")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ type = "clear";
+ data = entry.vals.at(0);
+ continue;
+ }
+
+ if (entry.sym == "attr" && type == "clear")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ data = tr("'%1' from %2").arg(entry.vals.at(0)).arg(data);
+ break;
+ }
+
+ if (entry.sym == "set")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ type = "set";
+ data = entry.vals.at(0);
+ continue;
+ }
+
+ if (entry.sym == "attr" && type == "set")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ data2 = entry.vals.at(0);
+ continue;
+ }
+
+ if (entry.sym == "value" && type == "set")
+ {
+ Q_ASSERT(entry.vals.size() == 1);
+ data = tr("'%1' to '%2' for %3").arg(entry.vals.at(0)).arg(data2).arg(data);
+ break;
+ }
+
+ qWarning("GetRevision::parseOutput(): Unknown symbol %s.", qPrintable(entry.sym));
+ }
+
+ // check if we really processed an item entry
+ if (type.size() == 0) continue;
+
+ if (!changemap.contains(type))
+ {
+ changemap.insert(type, QStringList());
+ }
+
+ changemap[type].append(data);
+ }
+
+ QStandardItem * parent = invisibleRootItem();
+
+ // FIXME: we should create QStandardItems right from the start and
+ // store references to the original Stanza's as data part
+ // to make it possible to commit partial changes
+ foreach (QString key, changemap.keys())
+ {
+ QString label;
+ if (key == "delete")
+ label = tr("deleted entries");
+ else if (key == "renamed")
+ label = tr("renamed entries");
+ else if (key == "add_dir")
+ label = tr("added directories");
+ else if (key == "add_file")
+ label = tr("added files");
+ else if (key == "patch")
+ label = tr("patched files");
+ else if (key == "clear")
+ label = tr("removed attributes");
+ else if (key == "set")
+ label = tr("added attributes");
+ else
+ Q_ASSERT(false);
+
+ QStandardItem * type = new QStandardItem(label);
+ parent->appendRow(type);
+
+ foreach (QString data, changemap.value(key))
+ {
+ QStandardItem * entry = new QStandardItem(data);
+ type->appendRow(entry);
+ }
+ }
+
+ // reset the view
+ reset();
+
+ // signal that we've finished (whoever listens to that)
+ emit revisionRead();
+}
+
============================================================
--- guitone/src/model/GetRevision.h 9cb280cfdc594b15059acce545e9c0a90a8de9d4
+++ guitone/src/model/GetRevision.h 9cb280cfdc594b15059acce545e9c0a90a8de9d4
@@ -0,0 +1,48 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Thomas Keller *
+ * address@hidden *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef GET_REVISION_H
+#define GET_REVISION_H
+
+#include "AutomateCommand.h"
+#include "MonotoneDelegate.h"
+
+#include
+
+
+class GetRevision : public QStandardItemModel, public AutomateCommand
+{
+ Q_OBJECT
+public:
+ GetRevision(QObject*);
+ virtual ~GetRevision();
+
+public slots:
+ bool readRevision(const QString &);
+
+signals:
+ void revisionRead();
+
+private:
+ void parseOutput();
+ MonotoneDelegate * mtnDelegate;
+};
+
+#endif
============================================================
--- guitone/src/view/dialogs/CommitRevision.cpp e9f64428b27666c3c5985bb7bbddc3817308ec0a
+++ guitone/src/view/dialogs/CommitRevision.cpp e9f64428b27666c3c5985bb7bbddc3817308ec0a
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Thomas Keller *
+ * address@hidden *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "CommitRevision.h"
+#include "Monotone.h"
+
+#include
+
+CommitRevision::CommitRevision(QWidget* parent) : Dialog(parent)
+{
+ setupUi(this);
+ Dialog::init();
+
+ revModel = new GetRevision(this);
+ changeView->setModel(revModel);
+ changeView->header()->hide();
+ revModel->readRevision(QString());
+
+ connect(
+ invertSelection, SIGNAL(clicked()),
+ this, SLOT(invertChangesetSelection())
+ );
+}
+
+CommitRevision::~CommitRevision()
+{
+ delete revModel;
+}
+
+void CommitRevision::invertChangesetSelection()
+{
+ QItemSelectionModel * selectionModel = changeView->selectionModel();
+
+ QModelIndex parent;
+
+ QModelIndex topLeft = revModel->index(0, 0, parent);
+ QModelIndex bottomRight = revModel->index(
+ revModel->rowCount(parent)-1,
+ revModel->columnCount(parent)-1,
+ parent
+ );
+
+ QItemSelection selection(topLeft, bottomRight);
+
+ // FIXME: this does not work in trees with more than two levels
+ foreach(QModelIndex parent, selection.indexes())
+ {
+ topLeft = revModel->index(0, 0, parent);
+ bottomRight = revModel->index(
+ revModel->rowCount(parent)-1,
+ revModel->columnCount(parent)-1,
+ parent
+ );
+ selection.merge(QItemSelection(topLeft, bottomRight), QItemSelectionModel::Select);
+ }
+
+ selectionModel->select(selection, QItemSelectionModel::Toggle);
+}
+
============================================================
--- guitone/src/view/dialogs/CommitRevision.h c6064832b35481c22dd0d0bc11d07fb221f40793
+++ guitone/src/view/dialogs/CommitRevision.h c6064832b35481c22dd0d0bc11d07fb221f40793
@@ -0,0 +1,43 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Thomas Keller *
+ * address@hidden *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef REVISION_DIFF_H
+#define REVISION_DIFF_H
+
+#include "Dialog.h"
+#include "ui_commit_revision.h"
+#include "GetRevision.h"
+
+class CommitRevision : public Dialog, private Ui::CommitRevision
+{
+ Q_OBJECT
+
+public:
+ CommitRevision(QWidget*);
+ ~CommitRevision();
+
+private:
+ GetRevision * revModel;
+
+private slots:
+ void invertChangesetSelection();
+};
+
+#endif
============================================================
--- guitone/guitone.pro 9498bf3718baefb221af5a0a302a9f1accf4cfcc
+++ guitone/guitone.pro 9c37c31facd0210a4d47db3d688b0f70f807c3ce
@@ -32,6 +32,7 @@ HEADERS += src/view/MainWindow.h \
src/view/dialogs/About.h \
src/view/dialogs/ChangesetBrowser.h \
src/view/dialogs/RevisionManifest.h \
+ src/view/dialogs/CommitRevision.h \
src/monotone/Monotone.h \
src/monotone/MonotoneDelegate.h \
src/monotone/FileExporter.h \
@@ -53,6 +54,7 @@ HEADERS += src/view/MainWindow.h \
src/model/Manifest.h \
src/model/Ancestors.h \
src/model/GetBranchLog.h \
+ src/model/GetRevision.h \
src/util/IconProvider.h \
src/util/AbstractParser.h \
src/util/BasicIOParser.h \
@@ -83,6 +85,7 @@ SOURCES += src/view/MainWindow.cpp \
src/view/dialogs/About.cpp \
src/view/dialogs/ChangesetBrowser.cpp \
src/view/dialogs/RevisionManifest.cpp \
+ src/view/dialogs/CommitRevision.cpp \
src/monotone/Monotone.cpp \
src/monotone/MonotoneDelegate.cpp \
src/monotone/FileExporter.cpp \
@@ -104,6 +107,7 @@ SOURCES += src/view/MainWindow.cpp \
src/model/Manifest.cpp \
src/model/Ancestors.cpp \
src/model/GetBranchLog.cpp \
+ src/model/GetRevision.cpp \
src/util/IconProvider.cpp \
src/util/AbstractParser.cpp \
src/util/BasicIOParser.cpp \
@@ -128,7 +132,8 @@ FORMS += res/forms/select_revision.ui
res/forms/about.ui \
res/forms/main_window.ui \
res/forms/changeset_browser.ui \
- res/forms/manifest.ui
+ res/forms/manifest.ui \
+ res/forms/commit_revision.ui
UI_DIR = tmp
OBJECTS_DIR = tmp
============================================================
--- guitone/res/forms/main_window.ui c1486a9008e6114a0f4e9ecb8dc7fd8ae7b12706
+++ guitone/res/forms/main_window.ui 62161c4ccc8ae3874887d716c76ea8f179aa2b4c
@@ -117,7 +117,7 @@ or File > Open Database for a database r
0
0
713
- 22
+ 24
-
-
+
+
@@ -452,6 +453,14 @@ or File > Open Database for a database r
Bring all to front
+
+
+ Commit revision
+
+
+ Ctrl+C
+
+
============================================================
--- guitone/src/view/MainWindow.cpp 13a2b8934f4761e361cccf1963f85076c47ec448
+++ guitone/src/view/MainWindow.cpp fbf63888c531297f7941918ebeb4ee6de9f1ed5c
@@ -28,6 +28,7 @@
#include "InventoryView.h"
#include "AttributesView.h"
#include "UpdateWorkspace.h"
+#include "CommitRevision.h"
#include "CheckoutRevision.h"
#include "Preferences.h"
#include "KeyManagement.h"
@@ -571,14 +572,20 @@ void MainWindow:: on_actionChangeset_bro
dialog.execDocumentModal();
}
-void MainWindow:: on_actionUpdate_workspace_triggered()
+void MainWindow::on_actionUpdate_workspace_triggered()
{
UpdateWorkspace dialog(this);
dialog.execDocumentModal();
}
-void MainWindow:: on_actionCheckout_revision_triggered()
+void MainWindow::on_actionCommit_revision_triggered()
{
+ CommitRevision dialog(this);
+ dialog.execDocumentModal();
+}
+
+void MainWindow::on_actionCheckout_revision_triggered()
+{
CheckoutRevision dialog(this);
dialog.execDocumentModal();
}
============================================================
--- guitone/src/view/MainWindow.h 9fc77547a3eb9bebfeecd21f3efcff99d77fa71b
+++ guitone/src/view/MainWindow.h a6eec6cd24f15814a4f00dc46cb458432930a2f1
@@ -66,6 +66,7 @@ private slots:
void on_menuShow_triggered(QAction *);
void on_actionExpand_tree_triggered();
void on_actionUpdate_workspace_triggered();
+ void on_actionCommit_revision_triggered();
void on_actionCheckout_revision_triggered();
void on_actionKey_management_triggered();
void on_actionPreferences_triggered();