Added merge support
FossilOrigin-Name: ac65fbf8d33a9e64fb97bd8652a43b4d11c8e538
This commit is contained in:
parent
f9eda348be
commit
cdba8c05f6
26
manifest
26
manifest
@ -1,5 +1,5 @@
|
||||
C Fixed\sup-to-date\sworkspace\scheck\nAdded\sicons\sfor\stag\soperations
|
||||
D 2015-05-03T10:26:29.811
|
||||
C Added\smerge\ssupport
|
||||
D 2015-05-03T11:44:04.852
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -196,19 +196,19 @@ F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8
|
||||
F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
||||
F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||
F src/Fossil.cpp 46edbf48a7f09c0673136c726f62cf3e95e92f1e
|
||||
F src/Fossil.h 7e45c12f80c06af78bf7a13cce75e0b105e0b99a
|
||||
F src/Fossil.cpp 57363e0f487f325ba2eae6fdcf29756c9b1ae4a9
|
||||
F src/Fossil.h fb34964797dc10cea02bdf2e3f2c97a74fddafc5
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp 032fec25b6f679d2863839095c9039ff4bf4b41d
|
||||
F src/MainWindow.h dffe67ceb1d7a51b858ce8a0fb688bfa7e90c5be
|
||||
F src/MainWindow.cpp 7ae75136eb3a2f867de4281cbe428a176c3d11c8
|
||||
F src/MainWindow.h a4f3c753debe65d6231721c9948c4e8dee699021
|
||||
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
|
||||
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
|
||||
F src/UpdateDialog.cpp 5f9ff02aeed08ab3a69d0a9a3b3efeefbc38f3d4
|
||||
F src/UpdateDialog.h 93c6ad9bd814f23e431c67bcd01928f33e10a80b
|
||||
F src/UpdateDialog.cpp 08b0261de45babd947a0fbbd5af6bf8b58b74735
|
||||
F src/UpdateDialog.h bf04816f3cc5425beaaca72ca05bcc793d4ca204
|
||||
F src/Utils.cpp 748a58f19187aff7f3b867894129291cbe091678
|
||||
F src/Utils.h 9cc125f59b8d46ff47bbde4c2cf9bc77f8e2553b
|
||||
F src/Workspace.cpp 329b9ecd8363089b5fb230c0fd3606f2e9dab73a
|
||||
F src/Workspace.cpp 12edd94656a0aaef20798f883b59af3074466cec
|
||||
F src/Workspace.h 890fdb5f6b768809bc962374d22422dbfb6e89a1
|
||||
F src/main.cpp 2ac8badc2a63fa123ceae53382ce24cfe1b5a54b
|
||||
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||
@ -219,8 +219,8 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f
|
||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||
F ui/MainWindow.ui d4fc7971a0717677adb1be0bb88502dfcb92f5c4
|
||||
F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b
|
||||
F ui/UpdateDialog.ui 636fd495d481ade1f20a65f79b538b9a49bbf1fa
|
||||
P 72ac541c4c28f83c94c371f2d81e116b8f3cf261
|
||||
R fd6aaebd153d8868db1e625f9440db3c
|
||||
F ui/UpdateDialog.ui cd909f40c16e439181664e53bc3e86c2df647e3f
|
||||
P 87468705beaaef842877ab8459e287a61edf4bc3
|
||||
R 5791f89a3c32b1103d6b1aa0c81d25f4
|
||||
U kostas
|
||||
Z 43ffc6ff0a38aa6f520fbb26747d7238
|
||||
Z 6e82b9757fd44eb9f7e8cfc7e84094f4
|
||||
|
@ -1 +1 @@
|
||||
87468705beaaef842877ab8459e287a61edf4bc3
|
||||
ac65fbf8d33a9e64fb97bd8652a43b4d11c8e538
|
@ -531,6 +531,43 @@ bool Fossil::branchList(QStringList& branches, QStringList& activeBranches)
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Fossil::branchNew(const QString& name, const QString& revisionBasis, bool isPrivate)
|
||||
{
|
||||
QStringList params;
|
||||
|
||||
params <<"branch" << "new" << name << revisionBasis;
|
||||
|
||||
if(isPrivate)
|
||||
params << "--private";
|
||||
|
||||
QStringList res;
|
||||
|
||||
if(!runFossil(params, &res))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Fossil::branchMerge(QStringList &res, const QString& revision, bool integrate, bool testOnly)
|
||||
{
|
||||
QStringList params;
|
||||
|
||||
params <<"merge";
|
||||
|
||||
if(integrate)
|
||||
params << "--integrate";
|
||||
|
||||
if(testOnly)
|
||||
params << "--dry-run";
|
||||
|
||||
params << revision;
|
||||
|
||||
if(!runFossil(params, &res))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static QString ParseFossilQuery(QString line)
|
||||
{
|
||||
|
@ -116,6 +116,8 @@ public:
|
||||
bool tagDelete(const QString& name, const QString& revision);
|
||||
|
||||
bool branchList(QStringList& branches, QStringList& activeBranches);
|
||||
bool branchNew(const QString& name, const QString& revisionBasis, bool isPrivate=false);
|
||||
bool branchMerge(QStringList& res, const QString& revision, bool integrate, bool testOnly);
|
||||
|
||||
const QString &getCurrentRevision() const { return currentRevision; }
|
||||
const QStringList &getCurrentTags() const { return currentTags; }
|
||||
|
@ -18,7 +18,8 @@
|
||||
#include "UpdateDialog.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#define LATEST_VERSION "Latest"
|
||||
#define LATEST_VERSION "Latest Revision"
|
||||
#define CURRENT_VERSION "Current Revision"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
enum
|
||||
@ -147,6 +148,8 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
||||
|
||||
// StashMenu
|
||||
menuStashes = new QMenu(this);
|
||||
menuStashes->addAction(ui->actionNewStash);
|
||||
menuStashes->addAction(separator);
|
||||
menuStashes->addAction(ui->actionApplyStash);
|
||||
menuStashes->addAction(ui->actionDiffStash);
|
||||
menuStashes->addAction(ui->actionDeleteStash);
|
||||
@ -154,9 +157,16 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
||||
// TagsMenu
|
||||
menuTags = new QMenu(this);
|
||||
menuTags->addAction(ui->actionNewTag);
|
||||
menuTags->addAction(separator);
|
||||
menuTags->addAction(ui->actionDeleteTag);
|
||||
menuTags->addAction(ui->actionUpdateRevision);
|
||||
|
||||
// BranchesMenu
|
||||
menuBranches = new QMenu(this);
|
||||
menuBranches->addAction(ui->actionNewBranch);
|
||||
menuBranches->addAction(separator);
|
||||
menuBranches->addAction(ui->actionMergeBranch);
|
||||
menuBranches->addAction(ui->actionUpdateRevision);
|
||||
|
||||
// Recent Workspaces
|
||||
// Locate a sequence of two separator actions in file menu
|
||||
@ -586,10 +596,7 @@ void MainWindow::scanWorkspace()
|
||||
updateFileView();
|
||||
|
||||
// Build default versions list
|
||||
const QString latest = tr(LATEST_VERSION);
|
||||
|
||||
versionList.clear();
|
||||
versionList.append(latest);
|
||||
versionList += getWorkspace().getBranches();
|
||||
versionList += getWorkspace().getTags().keys();
|
||||
|
||||
@ -1474,7 +1481,13 @@ void MainWindow::on_actionUpdate_triggered()
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionUpdateRevision_triggered()
|
||||
{
|
||||
updateRevision("");
|
||||
QStringList selected = selectedBranches + selectedTags;
|
||||
|
||||
QString revision;
|
||||
if(!selected.isEmpty())
|
||||
revision = selected.first();
|
||||
|
||||
updateRevision(revision);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1610,6 +1623,8 @@ void MainWindow::onWorkspaceTreeViewSelectionChanged(const QItemSelection &/*sel
|
||||
return;
|
||||
|
||||
stringset_t new_dirs;
|
||||
selectedTags.clear();
|
||||
selectedBranches.clear();
|
||||
|
||||
foreach(const QModelIndex &id, indices)
|
||||
{
|
||||
@ -2039,6 +2054,8 @@ void MainWindow::on_workspaceTreeView_customContextMenuRequested(const QPoint &)
|
||||
menu = menuStashes;
|
||||
else if (tv.Type == TreeViewItem::TYPE_TAG || tv.Type == TreeViewItem::TYPE_TAGS)
|
||||
menu = menuTags;
|
||||
else if (tv.Type == TreeViewItem::TYPE_BRANCH || tv.Type == TreeViewItem::TYPE_BRANCHES)
|
||||
menu = menuBranches;
|
||||
|
||||
if(menu)
|
||||
{
|
||||
@ -2221,11 +2238,14 @@ void MainWindow::on_actionNewTag_triggered()
|
||||
QString revision = fossil().getCurrentRevision();
|
||||
|
||||
QString name;
|
||||
if(!UpdateDialog::runNewTag(this, tr("New tag"), versionList, revision, revision, name))
|
||||
if(!UpdateDialog::runNewTag(this, tr("New Tag"), versionList, revision, revision, name))
|
||||
return;
|
||||
|
||||
if(name.isEmpty() || getWorkspace().getTags().contains(name) || getWorkspace().getBranches().contains(name))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Invalid name."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
fossil().tagNew(name, revision);
|
||||
refresh();
|
||||
@ -2253,11 +2273,58 @@ void MainWindow::on_actionDeleteTag_triggered()
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionNewBranch_triggered()
|
||||
{
|
||||
// Default to current revision
|
||||
QString revision = fossil().getCurrentRevision();
|
||||
|
||||
QString branch_name;
|
||||
if(!UpdateDialog::runNewTag(this, tr("New Branch"), versionList, revision, revision, branch_name))
|
||||
return;
|
||||
|
||||
if(branch_name.isEmpty() || getWorkspace().getTags().contains(branch_name) || getWorkspace().getBranches().contains(branch_name))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Invalid name."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
if(!fossil().branchNew(branch_name, revision, false))
|
||||
return;
|
||||
|
||||
if(QMessageBox::Yes == DialogQuery(this, tr("New Branch"), tr("Would you like to check-out the branch '%0' ?").arg(branch_name)))
|
||||
updateRevision(branch_name);
|
||||
else
|
||||
refresh();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::MergeRevision(const QString &defaultRevision)
|
||||
{
|
||||
QStringList res;
|
||||
QString revision = defaultRevision;
|
||||
|
||||
bool integrate = false;
|
||||
revision = UpdateDialog::runMerge(this, tr("Merge"), versionList, revision, integrate);
|
||||
|
||||
if(revision.isEmpty())
|
||||
return;
|
||||
|
||||
// Do test merge
|
||||
if(!fossil().branchMerge(res, revision, integrate, true))
|
||||
return;
|
||||
|
||||
if(!FileActionDialog::run(this, tr("Merge"), tr("The following changesd will be made.")+"\n"+tr("Are you sure?"), res))
|
||||
return;
|
||||
|
||||
// Do update
|
||||
fossil().branchMerge(res, revision, integrate, false);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionMergeBranch_triggered()
|
||||
{
|
||||
QString revision;
|
||||
|
||||
if(!selectedBranches.isEmpty())
|
||||
revision = selectedBranches.first();
|
||||
MergeRevision(revision);
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ private:
|
||||
void updateWorkspaceView();
|
||||
void updateFileView();
|
||||
void selectRootDir();
|
||||
void MergeRevision(const QString& defaultRevision);
|
||||
|
||||
void fossilBrowse(const QString &fossilUrl);
|
||||
void dragEnterEvent(class QDragEnterEvent *event);
|
||||
void dropEvent(class QDropEvent *event);
|
||||
@ -112,15 +114,10 @@ private slots:
|
||||
void on_textBrowser_customContextMenuRequested(const QPoint &pos);
|
||||
void on_fileTableView_customContextMenuRequested(const QPoint &pos);
|
||||
void on_workspaceTreeView_customContextMenuRequested(const QPoint &pos);
|
||||
|
||||
void on_actionUpdateRevision_triggered();
|
||||
|
||||
void on_actionNewTag_triggered();
|
||||
|
||||
void on_actionDeleteTag_triggered();
|
||||
|
||||
void on_actionNewBranch_triggered();
|
||||
|
||||
void on_actionMergeBranch_triggered();
|
||||
|
||||
private:
|
||||
@ -160,7 +157,7 @@ private:
|
||||
QMenu *menuWorkspace;
|
||||
QMenu *menuStashes;
|
||||
QMenu *menuTags;
|
||||
//QMenu *menuBranches;
|
||||
QMenu *menuBranches;
|
||||
|
||||
bool operationAborted;
|
||||
stringset_t selectedDirs; // The directory selected in the tree
|
||||
|
@ -28,20 +28,51 @@ QString UpdateDialog::runUpdate(QWidget *parent, const QString &title, const QSt
|
||||
{
|
||||
UpdateDialog dlg(parent, completions, defaultValue);
|
||||
dlg.setWindowTitle(title);
|
||||
dlg.ui->label_3->setVisible(false);
|
||||
dlg.ui->lblName->setVisible(false);
|
||||
dlg.ui->lineName->setVisible(false);
|
||||
dlg.ui->lblIntegrate->setVisible(false);
|
||||
dlg.ui->chkIntegrate->setVisible(false);
|
||||
|
||||
dlg.adjustSize();
|
||||
|
||||
if(dlg.exec() != QDialog::Accepted)
|
||||
return QString("");
|
||||
return dlg.ui->cmbRevision->currentText().trimmed();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString UpdateDialog::runMerge(QWidget *parent, const QString &title, const QStringList &completions, const QString &defaultValue, bool &integrate)
|
||||
{
|
||||
UpdateDialog dlg(parent, completions, defaultValue);
|
||||
dlg.setWindowTitle(title);
|
||||
dlg.ui->lblName->setVisible(false);
|
||||
dlg.ui->lineName->setVisible(false);
|
||||
dlg.ui->lblIntegrate->setVisible(true);
|
||||
dlg.ui->chkIntegrate->setVisible(true);
|
||||
dlg.ui->chkIntegrate->setChecked(integrate);
|
||||
dlg.adjustSize();
|
||||
|
||||
if(dlg.exec() != QDialog::Accepted)
|
||||
return QString("");
|
||||
|
||||
integrate = dlg.ui->chkIntegrate->checkState() == Qt::Checked;
|
||||
|
||||
return dlg.ui->cmbRevision->currentText().trimmed();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool UpdateDialog::runNewTag(QWidget *parent, const QString &title, const QStringList &completions, const QString &defaultValue, QString &revision, QString &name)
|
||||
{
|
||||
UpdateDialog dlg(parent, completions, defaultValue);
|
||||
dlg.setWindowTitle(title);
|
||||
|
||||
dlg.ui->lblName->setVisible(true);
|
||||
dlg.ui->lineName->setVisible(true);
|
||||
dlg.ui->lblIntegrate->setVisible(false);
|
||||
dlg.ui->chkIntegrate->setVisible(false);
|
||||
dlg.adjustSize();
|
||||
|
||||
if(dlg.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
|
@ -17,6 +17,7 @@ public:
|
||||
~UpdateDialog();
|
||||
|
||||
static QString runUpdate(QWidget *parent, const QString &title, const QStringList &completions, const QString &defaultValue);
|
||||
static QString runMerge(QWidget* parent, const QString& title, const QStringList& completions, const QString& defaultValue, bool& integrate);
|
||||
static bool runNewTag(QWidget *parent, const QString &title, const QStringList &completions, const QString &defaultValue, QString &revision, QString &name);
|
||||
|
||||
private:
|
||||
|
@ -148,7 +148,7 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
||||
type = WorkspaceFile::TYPE_UNCHANGED;
|
||||
else if(status_text=="CONFLICT")
|
||||
type = WorkspaceFile::TYPE_CONFLICTED;
|
||||
else if(status_text=="UPDATED_BY_MERGE")
|
||||
else if(status_text=="UPDATED_BY_MERGE" || status_text=="ADDED_BY_MERGE" || status_text=="ADDED_BY_INTEGRATE" || status_text=="UPDATED_BY_INTEGRATE")
|
||||
type = WorkspaceFile::TYPE_MERGED;
|
||||
|
||||
// Filter unwanted file types
|
||||
|
@ -10,9 +10,15 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>478</width>
|
||||
<height>113</height>
|
||||
<height>146</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -20,7 +26,7 @@
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="lblRevision">
|
||||
<property name="text">
|
||||
<string>Revision</string>
|
||||
</property>
|
||||
@ -34,7 +40,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="lblName">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
@ -43,6 +49,20 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineName"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblIntegrate">
|
||||
<property name="text">
|
||||
<string>Integrate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="chkIntegrate">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user