Added branch on commit
Refactored CommitDialog FossilOrigin-Name: 34efdbe98a491079ce2a2ae97c701ed5af118a4c
This commit is contained in:
parent
d07ee31362
commit
65e06d023e
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Initial\swork\son\sbranching\sduring\scommit\nRefactored\sCommitDialog\susage
|
||||
D 2015-05-23T11:48:50.173
|
||||
C Added\sbranch\son\scommit\nRefactored\sCommitDialog\n
|
||||
D 2015-05-24T08:47:24.547
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -188,19 +188,19 @@ F src/BrowserWidget.cpp 8b8f545cdff4a4188edc698a1b4777f5df46f056
|
||||
F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597
|
||||
F src/CloneDialog.cpp 4fc5aa8146ac63ba6ba7341b1635b3025819d708
|
||||
F src/CloneDialog.h 8813d91f893eb3eb86a4ea5e50f9a53a0ea07047
|
||||
F src/CommitDialog.cpp 32a4860171b9dfe5b0cea15bc534dd56c00b4631
|
||||
F src/CommitDialog.h edec8c152e6b40e248c48d8f56e8d8e218e2c2c8
|
||||
F src/CommitDialog.cpp bbf5fe1c66d28068cc3fd061f4f9f1faa9e89196
|
||||
F src/CommitDialog.h 921bf27c0c538ab9e9d6bdc750064337d346270b
|
||||
F src/CustomWebView.cpp b7dd0c41977c2cba005df07ed8967ba6f58d07d9
|
||||
F src/CustomWebView.h fbc8ee55812d1acb3c3b2bc31be7533e8a112822
|
||||
F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8
|
||||
F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
||||
F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||
F src/Fossil.cpp 0df84415b9c380b03e7e10f0777f6e92f3fa9584
|
||||
F src/Fossil.cpp a0b44c6b77de686e45cb4d84cfbf94865c8b39bf
|
||||
F src/Fossil.h 651d2a1c052abe2804f9eff366bf2561dc54f7eb
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp 6e8aa088373fc0e501fef144a1cdd94eb0fe2f91
|
||||
F src/MainWindow.cpp ff43767952214b51530537efea858027cb408356
|
||||
F src/MainWindow.h f2141839cccb3941df9ed7288588f2de3a5c8179
|
||||
F src/RevisionDialog.cpp 51065c65a07c118dd1a7363da4a55a135d1c6c9c
|
||||
F src/RevisionDialog.h b718c3009342eaabad39c8a11a253a4e4fef7a73
|
||||
@ -217,12 +217,12 @@ F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
|
||||
F ui/BrowserWidget.ui 994ad9ea0e9f5815d6b1a27acc2f6f39164c507f
|
||||
F ui/CloneDialog.ui 4886e7d4f258ea8b852b5eefc860396e35145712
|
||||
F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f
|
||||
F ui/CommitDialog.ui 5270bbf9c0b0c64d695420388160e2bb0e217d9f
|
||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||
F ui/MainWindow.ui 7f11c2ca1c3e371c71db27ae0fe6ad3758e6b5e1
|
||||
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
||||
F ui/SettingsDialog.ui 5aafd8784268ea7cd828330d4673500b8f38d6db
|
||||
P 999f57bd1e05e99c67a921c09f782da170ae827c
|
||||
R d4e513e4fb3bc634010d85fa4326ab7b
|
||||
P 4b4c7cdb6d717d381081bbfbd7e9657acf32d089
|
||||
R e360bba7a506e0fc5f0fa38b4d129c9b
|
||||
U kostas
|
||||
Z d83ca9723da4099dee50cb4eb2941d68
|
||||
Z 6beeae656e862ad56c841db3d3bac58a
|
||||
|
@ -1 +1 @@
|
||||
4b4c7cdb6d717d381081bbfbd7e9657acf32d089
|
||||
34efdbe98a491079ce2a2ae97c701ed5af118a4c
|
@ -4,7 +4,7 @@
|
||||
#include "ui_CommitDialog.h"
|
||||
#include "MainWindow.h" // Ugly. I know.
|
||||
|
||||
CommitDialog::CommitDialog(QWidget *parent, const QString &title, QStringList &files, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue) :
|
||||
CommitDialog::CommitDialog(QWidget *parent, const QString &title, QStringList &files, const QStringList *history, bool stashMode) :
|
||||
QDialog(parent, Qt::Sheet),
|
||||
ui(new Ui::CommitDialog)
|
||||
{
|
||||
@ -15,16 +15,13 @@ CommitDialog::CommitDialog(QWidget *parent, const QString &title, QStringList &f
|
||||
setWindowTitle(title);
|
||||
|
||||
// Activate the appropriate control based on mode
|
||||
ui->plainTextEdit->setVisible(!singleLineEntry);
|
||||
ui->lineEdit->setVisible(singleLineEntry);
|
||||
ui->plainTextEdit->setVisible(!stashMode);
|
||||
ui->lineEdit->setVisible(stashMode);
|
||||
|
||||
// Activate the checkbox if we have some text
|
||||
ui->checkBox->setVisible(checkBoxText!=0);
|
||||
if(checkBoxText && checkBoxValue)
|
||||
{
|
||||
ui->checkBox->setText(*checkBoxText);
|
||||
ui->checkBox->setCheckState(*checkBoxValue ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
ui->chkRevertFiles->setVisible(stashMode);
|
||||
|
||||
ui->widgetBranchOptions->setVisible(!stashMode);
|
||||
|
||||
// Activate the combo if we have history
|
||||
ui->comboBox->setVisible(history!=0);
|
||||
@ -77,16 +74,12 @@ CommitDialog::~CommitDialog()
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool CommitDialog::run(QWidget *parent, const QString &title, QStringList &files, QString &commitMsg, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue)
|
||||
bool CommitDialog::runCommit(QWidget* parent, QStringList& files, QString& commitMsg, const QStringList& commitMsgHistory, QString &branchName, bool &privateBranch)
|
||||
{
|
||||
CommitDialog dlg(parent, title, files, history, singleLineEntry, checkBoxText, checkBoxValue);
|
||||
CommitDialog dlg(parent, tr("Commit Changes"), files, &commitMsgHistory, false);
|
||||
int res = dlg.exec();
|
||||
|
||||
if(singleLineEntry)
|
||||
commitMsg = dlg.ui->lineEdit->text();
|
||||
else
|
||||
commitMsg = dlg.ui->plainTextEdit->toPlainText();
|
||||
|
||||
commitMsg = dlg.ui->plainTextEdit->toPlainText();
|
||||
|
||||
if(res!=QDialog::Accepted)
|
||||
return false;
|
||||
@ -100,26 +93,38 @@ bool CommitDialog::run(QWidget *parent, const QString &title, QStringList &files
|
||||
files.append(si->text());
|
||||
}
|
||||
|
||||
if(checkBoxText)
|
||||
branchName.clear();
|
||||
if(dlg.ui->chkNewBranch->isChecked())
|
||||
{
|
||||
Q_ASSERT(checkBoxValue);
|
||||
*checkBoxValue = dlg.ui->checkBox->checkState() == Qt::Checked;
|
||||
branchName = dlg.ui->lineBranchName->text().trimmed();
|
||||
privateBranch = dlg.ui->chkPrivateBranch->isChecked();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool CommitDialog::runCommit(QWidget* parent, QStringList& files, QString& commitMsg, const QStringList& commitMsgHistory)
|
||||
bool CommitDialog::runStashNew(QWidget* parent, QStringList& stashedFiles, QString& stashName, bool& revertFiles)
|
||||
{
|
||||
return run(parent, tr("Commit Changes"), files, commitMsg, &commitMsgHistory, false, 0, 0);
|
||||
}
|
||||
CommitDialog dlg(parent, tr("Stash Changes"), stashedFiles, NULL, true);
|
||||
int res = dlg.exec();
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool CommitDialog::runStashNew(QWidget* parent, QStringList& stashedFiles, QString& stashName, bool& checkBoxValue)
|
||||
{
|
||||
QString checkbox_text = tr("Revert stashed files");
|
||||
return run(parent, tr("Stash Changes"), stashedFiles, stashName, 0, true, &checkbox_text, &checkBoxValue);
|
||||
stashName = dlg.ui->lineEdit->text();
|
||||
|
||||
if(res!=QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
stashedFiles.clear();
|
||||
for(int i=0; i<dlg.itemModel.rowCount(); ++i)
|
||||
{
|
||||
QStandardItem *si = dlg.itemModel.item(i);
|
||||
if(si->checkState()!=Qt::Checked)
|
||||
continue;
|
||||
stashedFiles.append(si->text());
|
||||
}
|
||||
|
||||
revertFiles = dlg.ui->chkRevertFiles->checkState() == Qt::Checked;
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -155,3 +160,10 @@ void CommitDialog::on_listView_clicked(const QModelIndex &)
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(num_selected>0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void CommitDialog::on_chkNewBranch_toggled(bool checked)
|
||||
{
|
||||
ui->chkPrivateBranch->setEnabled(checked);
|
||||
ui->lineBranchName->setEnabled(checked);
|
||||
}
|
||||
|
@ -13,19 +13,17 @@ class CommitDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CommitDialog(QWidget *parent, const QString &title, QStringList &files, const QStringList *history=0, bool singleLineEntry=false, const QString *checkBoxText=0, bool *checkBoxValue=0);
|
||||
explicit CommitDialog(QWidget *parent, const QString &title, QStringList &files, const QStringList *history, bool stashMode);
|
||||
~CommitDialog();
|
||||
|
||||
static bool runStashNew(QWidget* parent, QStringList& stashedFiles, QString& stashName, bool &checkBoxValue);
|
||||
static bool runCommit(QWidget* parent, QStringList& files, QString& commitMsg, const QStringList &commitMsgHistory);
|
||||
|
||||
private:
|
||||
static bool run(QWidget *parent, const QString &title, QStringList &files, QString &commitMsg, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue);
|
||||
static bool runStashNew(QWidget* parent, QStringList& stashedFiles, QString& stashName, bool &revertFiles);
|
||||
static bool runCommit(QWidget* parent, QStringList& files, QString& commitMsg, const QStringList &commitMsgHistory, QString& branchName, bool& privateBranch);
|
||||
|
||||
private slots:
|
||||
void on_comboBox_activated(int index);
|
||||
void on_listView_doubleClicked(const QModelIndex &index);
|
||||
void on_listView_clicked(const QModelIndex &index);
|
||||
void on_chkNewBranch_toggled(bool checked);
|
||||
|
||||
private:
|
||||
Ui::CommitDialog *ui;
|
||||
|
@ -227,7 +227,7 @@ bool Fossil::commitFiles(const QStringList& fileList, const QString& comment, co
|
||||
// Commit to new branch
|
||||
if(!newBranchName.isEmpty())
|
||||
{
|
||||
params << "--branch" << newBranchName;
|
||||
params << "--branch" << newBranchName.trimmed();
|
||||
|
||||
// Private branches are not synced with remotes
|
||||
if(isPrivateBranch)
|
||||
|
@ -1358,7 +1358,9 @@ void MainWindow::on_actionCommit_triggered()
|
||||
QStringList commit_msgs = settings.GetValue(FUEL_SETTING_COMMIT_MSG).toStringList();
|
||||
|
||||
QString msg;
|
||||
bool aborted = !CommitDialog::runCommit(this, commit_files, msg, commit_msgs);
|
||||
QString branch_name="";
|
||||
bool private_branch = false;
|
||||
bool aborted = !CommitDialog::runCommit(this, commit_files, msg, commit_msgs, branch_name, private_branch);
|
||||
|
||||
// Aborted or not we always keep the commit messages.
|
||||
// (This has saved me way too many times on TortoiseSVN)
|
||||
@ -1388,10 +1390,6 @@ void MainWindow::on_actionCommit_triggered()
|
||||
if(commit_files.size() != all_modified_files.size())
|
||||
files = commit_files;
|
||||
|
||||
// FIXME: add UI
|
||||
QString branch_name="";
|
||||
bool private_branch = false;
|
||||
|
||||
fossil().commitFiles(files, msg, branch_name, private_branch);
|
||||
refresh();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<height>397</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -62,9 +62,72 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<widget class="QWidget" name="widgetBranchOptions" native="true">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>New branch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="chkNewBranch">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="chkPrivateBranch">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineBranchName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Branch name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Private branch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkRevertFiles">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Revert stashed files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user