Commits are now allowed when a merge integration has occured even when no files are modified
Support for forced merges Context menus are offset by a pixel to prevent unintended clicks FossilOrigin-Name: b0f81bc9c4d226d8406f65d9ad02099205d7e067
This commit is contained in:
@ -119,6 +119,12 @@ bool Fossil::listFiles(QStringList &files)
|
||||
return runFossil(QStringList() << "ls" << "-l", &files, RUNFLAGS_SILENT_ALL);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Fossil::status(QStringList &result)
|
||||
{
|
||||
return runFossil(QStringList() << "status", &result, RUNFLAGS_SILENT_ALL);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Fossil::pushRepository()
|
||||
{
|
||||
@ -549,7 +555,7 @@ bool Fossil::branchNew(const QString& name, const QString& revisionBasis, bool i
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Fossil::branchMerge(QStringList &res, const QString& revision, bool integrate, bool testOnly)
|
||||
bool Fossil::branchMerge(QStringList &res, const QString& revision, bool integrate, bool force, bool testOnly)
|
||||
{
|
||||
QStringList params;
|
||||
|
||||
@ -558,6 +564,9 @@ bool Fossil::branchMerge(QStringList &res, const QString& revision, bool integra
|
||||
if(integrate)
|
||||
params << "--integrate";
|
||||
|
||||
if(force)
|
||||
params << "--force";
|
||||
|
||||
if(testOnly)
|
||||
params << "--dry-run";
|
||||
|
||||
|
@ -92,6 +92,8 @@ public:
|
||||
void stopUI();
|
||||
|
||||
bool listFiles(QStringList &files);
|
||||
bool status(QStringList& result);
|
||||
|
||||
bool diffFile(const QString &repoFile);
|
||||
bool commitFiles(const QStringList &fileList, const QString &comment);
|
||||
bool addFiles(const QStringList& fileList);
|
||||
@ -117,7 +119,7 @@ public:
|
||||
|
||||
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);
|
||||
bool branchMerge(QStringList& res, const QString& revision, bool integrate, bool force, bool testOnly);
|
||||
|
||||
const QString &getCurrentRevision() const { return currentRevision; }
|
||||
const QStringList &getCurrentTags() const { return currentTags; }
|
||||
|
@ -1240,7 +1240,7 @@ void MainWindow::on_actionCommit_triggered()
|
||||
QStringList commit_files;
|
||||
getSelectionFilenames(commit_files, WorkspaceFile::TYPE_MODIFIED, true);
|
||||
|
||||
if(commit_files.empty())
|
||||
if(commit_files.empty() && !getWorkspace().otherChanges())
|
||||
return;
|
||||
|
||||
QStringList commit_msgs = settings.GetValue(FUEL_SETTING_COMMIT_MSG).toStringList();
|
||||
@ -1260,7 +1260,7 @@ void MainWindow::on_actionCommit_triggered()
|
||||
return;
|
||||
|
||||
// Since via the commit dialog the user can deselect all files
|
||||
if(commit_files.empty())
|
||||
if(commit_files.empty() && !getWorkspace().otherChanges())
|
||||
return;
|
||||
|
||||
// Do commit
|
||||
@ -2004,7 +2004,7 @@ void MainWindow::on_textBrowser_customContextMenuRequested(const QPoint &pos)
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_fileTableView_customContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
QPoint gpos = QCursor::pos();
|
||||
QPoint gpos = QCursor::pos() + QPoint(1, 1);
|
||||
#ifdef Q_OS_WIN
|
||||
if(qApp->keyboardModifiers() & Qt::SHIFT)
|
||||
{
|
||||
@ -2059,7 +2059,7 @@ void MainWindow::on_workspaceTreeView_customContextMenuRequested(const QPoint &)
|
||||
|
||||
if(menu)
|
||||
{
|
||||
QPoint pos = QCursor::pos();
|
||||
QPoint pos = QCursor::pos() + QPoint(1, 1);
|
||||
menu->popup(pos);
|
||||
}
|
||||
}
|
||||
@ -2301,20 +2301,23 @@ void MainWindow::MergeRevision(const QString &defaultRevision)
|
||||
QString revision = defaultRevision;
|
||||
|
||||
bool integrate = false;
|
||||
revision = UpdateDialog::runMerge(this, tr("Merge"), versionList, revision, integrate);
|
||||
bool force = false;
|
||||
revision = UpdateDialog::runMerge(this, tr("Merge"), versionList, revision, integrate, force);
|
||||
|
||||
if(revision.isEmpty())
|
||||
return;
|
||||
|
||||
// Do test merge
|
||||
if(!fossil().branchMerge(res, revision, integrate, true))
|
||||
if(!fossil().branchMerge(res, revision, integrate, force, 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);
|
||||
fossil().branchMerge(res, revision, integrate, force, false);
|
||||
|
||||
log(tr("Merge completed. Don't forget to commit!")+"\n");
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ QString UpdateDialog::runUpdate(QWidget *parent, const QString &title, const QSt
|
||||
dlg.ui->lineName->setVisible(false);
|
||||
dlg.ui->lblIntegrate->setVisible(false);
|
||||
dlg.ui->chkIntegrate->setVisible(false);
|
||||
dlg.ui->lblForce->setVisible(false);
|
||||
dlg.ui->chkForce->setVisible(false);
|
||||
|
||||
dlg.adjustSize();
|
||||
|
||||
@ -41,7 +43,7 @@ QString UpdateDialog::runUpdate(QWidget *parent, const QString &title, const QSt
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString UpdateDialog::runMerge(QWidget *parent, const QString &title, const QStringList &completions, const QString &defaultValue, bool &integrate)
|
||||
QString UpdateDialog::runMerge(QWidget *parent, const QString &title, const QStringList &completions, const QString &defaultValue, bool &integrate, bool &force)
|
||||
{
|
||||
UpdateDialog dlg(parent, completions, defaultValue);
|
||||
dlg.setWindowTitle(title);
|
||||
@ -50,12 +52,17 @@ QString UpdateDialog::runMerge(QWidget *parent, const QString &title, const QStr
|
||||
dlg.ui->lblIntegrate->setVisible(true);
|
||||
dlg.ui->chkIntegrate->setVisible(true);
|
||||
dlg.ui->chkIntegrate->setChecked(integrate);
|
||||
dlg.ui->lblForce->setVisible(true);
|
||||
dlg.ui->chkForce->setVisible(true);
|
||||
dlg.ui->chkForce->setChecked(force);
|
||||
|
||||
dlg.adjustSize();
|
||||
|
||||
if(dlg.exec() != QDialog::Accepted)
|
||||
return QString("");
|
||||
|
||||
integrate = dlg.ui->chkIntegrate->checkState() == Qt::Checked;
|
||||
force = dlg.ui->chkForce->checkState() == Qt::Checked;
|
||||
|
||||
return dlg.ui->cmbRevision->currentText().trimmed();
|
||||
}
|
||||
@ -71,6 +78,9 @@ bool UpdateDialog::runNewTag(QWidget *parent, const QString &title, const QStrin
|
||||
dlg.ui->lineName->setVisible(true);
|
||||
dlg.ui->lblIntegrate->setVisible(false);
|
||||
dlg.ui->chkIntegrate->setVisible(false);
|
||||
dlg.ui->lblForce->setVisible(false);
|
||||
dlg.ui->chkForce->setVisible(false);
|
||||
|
||||
dlg.adjustSize();
|
||||
|
||||
if(dlg.exec() != QDialog::Accepted)
|
||||
|
@ -17,7 +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 QString runMerge(QWidget* parent, const QString& title, const QStringList& completions, const QString& defaultValue, bool& integrate, bool& force);
|
||||
static bool runNewTag(QWidget *parent, const QString &title, const QStringList &completions, const QString &defaultValue, QString &revision, QString &name);
|
||||
|
||||
private:
|
||||
|
@ -17,6 +17,10 @@ void Workspace::clearState()
|
||||
|
||||
getFiles().clear();
|
||||
getPaths().clear();
|
||||
stashMap.clear();
|
||||
branchList.clear();
|
||||
tags.clear();
|
||||
isIntegrated = false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -184,7 +188,20 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
||||
getPaths().insert(path);
|
||||
}
|
||||
|
||||
// Load the stash
|
||||
// Check if the repository needs integration
|
||||
res.clear();
|
||||
fossil().status(res);
|
||||
isIntegrated = false;
|
||||
foreach(const QString &l, res)
|
||||
{
|
||||
if(l.trimmed().indexOf("INTEGRATE")==0)
|
||||
{
|
||||
isIntegrated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Load the stashes, branches and tags
|
||||
fossil().stashList(getStashes());
|
||||
|
||||
fossil().branchList(branchList, branchList);
|
||||
|
@ -123,6 +123,7 @@ public:
|
||||
stashmap_t &getStashes() { return stashMap; }
|
||||
QStringMap &getTags() { return tags; }
|
||||
QStringList &getBranches() { return branchList; }
|
||||
bool otherChanges() const { return isIntegrated; }
|
||||
|
||||
private:
|
||||
Fossil bridge;
|
||||
@ -131,6 +132,7 @@ private:
|
||||
stashmap_t stashMap;
|
||||
QStringList branchList;
|
||||
QStringMap tags;
|
||||
bool isIntegrated;
|
||||
|
||||
QStandardItemModel repoFileModel;
|
||||
QStandardItemModel repoDirModel;
|
||||
|
Reference in New Issue
Block a user