Initial work on branching during commit
Refactored CommitDialog usage FossilOrigin-Name: 4b4c7cdb6d717d381081bbfbd7e9657acf32d089
This commit is contained in:
		
							
								
								
									
										20
									
								
								manifest
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								manifest
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | |||||||
| C -\sApp\snow\suses\saliases\sinstead\sof\sicon\sfilenames\n-\sRemoved\sunused\sactionViewStash\n\n\n\n | C Initial\swork\son\sbranching\sduring\scommit\nRefactored\sCommitDialog\susage | ||||||
| D 2015-05-22T20:18:08.661 | D 2015-05-23T11:48:50.173 | ||||||
| F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35 | F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35 | ||||||
| F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b | F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b | ||||||
| F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b | F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b | ||||||
| @@ -188,19 +188,19 @@ F src/BrowserWidget.cpp 8b8f545cdff4a4188edc698a1b4777f5df46f056 | |||||||
| F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597 | F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597 | ||||||
| F src/CloneDialog.cpp 4fc5aa8146ac63ba6ba7341b1635b3025819d708 | F src/CloneDialog.cpp 4fc5aa8146ac63ba6ba7341b1635b3025819d708 | ||||||
| F src/CloneDialog.h 8813d91f893eb3eb86a4ea5e50f9a53a0ea07047 | F src/CloneDialog.h 8813d91f893eb3eb86a4ea5e50f9a53a0ea07047 | ||||||
| F src/CommitDialog.cpp 6d9b8287c26c1f8fbe5b40971d41dc0f7132c4cf | F src/CommitDialog.cpp 32a4860171b9dfe5b0cea15bc534dd56c00b4631 | ||||||
| F src/CommitDialog.h 45fa33c4745cbb54b3cd3d56e6341ae84058ce54 | F src/CommitDialog.h edec8c152e6b40e248c48d8f56e8d8e218e2c2c8 | ||||||
| F src/CustomWebView.cpp b7dd0c41977c2cba005df07ed8967ba6f58d07d9 | F src/CustomWebView.cpp b7dd0c41977c2cba005df07ed8967ba6f58d07d9 | ||||||
| F src/CustomWebView.h fbc8ee55812d1acb3c3b2bc31be7533e8a112822 | F src/CustomWebView.h fbc8ee55812d1acb3c3b2bc31be7533e8a112822 | ||||||
| F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8 | F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8 | ||||||
| F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce | F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce | ||||||
| F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2 | F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2 | ||||||
| F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df | F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df | ||||||
| F src/Fossil.cpp ca7ad24622e1fc1a03c92d7ae9b51afc17f7c09c | F src/Fossil.cpp 0df84415b9c380b03e7e10f0777f6e92f3fa9584 | ||||||
| F src/Fossil.h d65a7461d213bcc30f08724d3306c6ee00843217 | F src/Fossil.h 651d2a1c052abe2804f9eff366bf2561dc54f7eb | ||||||
| F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c | F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c | ||||||
| F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261 | F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261 | ||||||
| F src/MainWindow.cpp 0c4e30a60fe3a0ab882495fc79172993e34b2a22 | F src/MainWindow.cpp 6e8aa088373fc0e501fef144a1cdd94eb0fe2f91 | ||||||
| F src/MainWindow.h f2141839cccb3941df9ed7288588f2de3a5c8179 | F src/MainWindow.h f2141839cccb3941df9ed7288588f2de3a5c8179 | ||||||
| F src/RevisionDialog.cpp 51065c65a07c118dd1a7363da4a55a135d1c6c9c | F src/RevisionDialog.cpp 51065c65a07c118dd1a7363da4a55a135d1c6c9c | ||||||
| F src/RevisionDialog.h b718c3009342eaabad39c8a11a253a4e4fef7a73 | F src/RevisionDialog.h b718c3009342eaabad39c8a11a253a4e4fef7a73 | ||||||
| @@ -222,7 +222,7 @@ F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d | |||||||
| F ui/MainWindow.ui 7f11c2ca1c3e371c71db27ae0fe6ad3758e6b5e1 | F ui/MainWindow.ui 7f11c2ca1c3e371c71db27ae0fe6ad3758e6b5e1 | ||||||
| F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd | F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd | ||||||
| F ui/SettingsDialog.ui 5aafd8784268ea7cd828330d4673500b8f38d6db | F ui/SettingsDialog.ui 5aafd8784268ea7cd828330d4673500b8f38d6db | ||||||
| P 0eef20c8eb990a24b214a25b630b2786fee010d7 | P 999f57bd1e05e99c67a921c09f782da170ae827c | ||||||
| R 21435a9740da4d31c0bef8b2f954d654 | R d4e513e4fb3bc634010d85fa4326ab7b | ||||||
| U kostas | U kostas | ||||||
| Z e16a627a5e5c7286e58debb37a03c1db | Z d83ca9723da4099dee50cb4eb2941d68 | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 999f57bd1e05e99c67a921c09f782da170ae827c | 4b4c7cdb6d717d381081bbfbd7e9657acf32d089 | ||||||
| @@ -109,6 +109,19 @@ bool CommitDialog::run(QWidget *parent, const QString &title, QStringList &files | |||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
|  | bool CommitDialog::runCommit(QWidget* parent, QStringList& files, QString& commitMsg, const QStringList& commitMsgHistory) | ||||||
|  | { | ||||||
|  | 	return run(parent, tr("Commit Changes"), files, commitMsg, &commitMsgHistory, false, 0, 0); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
|  | 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); | ||||||
|  | } | ||||||
|  |  | ||||||
| //------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ | ||||||
| void CommitDialog::on_comboBox_activated(int index) | void CommitDialog::on_comboBox_activated(int index) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -16,7 +16,11 @@ 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=0, bool singleLineEntry=false, const QString *checkBoxText=0, bool *checkBoxValue=0); | ||||||
| 	~CommitDialog(); | 	~CommitDialog(); | ||||||
|  |  | ||||||
| 	static bool run(QWidget *parent, const QString &title, QStringList &files, QString &commitMsg, const QStringList *history=0, bool singleLineEntry=false, const QString *checkBoxText=0, bool *checkBoxValue=0); | 	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); | ||||||
|  |  | ||||||
| private slots: | private slots: | ||||||
| 	void on_comboBox_activated(int index); | 	void on_comboBox_activated(int index); | ||||||
|   | |||||||
| @@ -197,7 +197,7 @@ bool Fossil::diffFile(const QString &repoFile) | |||||||
| } | } | ||||||
|  |  | ||||||
| //------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ | ||||||
| bool Fossil::commitFiles(const QStringList& fileList, const QString& comment) | bool Fossil::commitFiles(const QStringList& fileList, const QString& comment, const QString &newBranchName, bool isPrivateBranch) | ||||||
| { | { | ||||||
| 	// Do commit | 	// Do commit | ||||||
| 	QString comment_fname; | 	QString comment_fname; | ||||||
| @@ -223,6 +223,17 @@ bool Fossil::commitFiles(const QStringList& fileList, const QString& comment) | |||||||
| 	// Generate fossil parameters. | 	// Generate fossil parameters. | ||||||
| 	QStringList params; | 	QStringList params; | ||||||
| 	params << "commit" << "--message-file" << QuotePath(comment_fname); | 	params << "commit" << "--message-file" << QuotePath(comment_fname); | ||||||
|  |  | ||||||
|  | 	// Commit to new branch | ||||||
|  | 	if(!newBranchName.isEmpty()) | ||||||
|  | 	{ | ||||||
|  | 		params << "--branch" << newBranchName; | ||||||
|  |  | ||||||
|  | 		// Private branches are not synced with remotes | ||||||
|  | 		if(isPrivateBranch) | ||||||
|  | 			params << "--private"; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	params << QuotePaths(fileList); | 	params << QuotePaths(fileList); | ||||||
|  |  | ||||||
| 	runFossil(params); | 	runFossil(params); | ||||||
|   | |||||||
| @@ -96,7 +96,7 @@ public: | |||||||
| 	bool status(QStringList& result); | 	bool status(QStringList& result); | ||||||
|  |  | ||||||
| 	bool diffFile(const QString &repoFile); | 	bool diffFile(const QString &repoFile); | ||||||
| 	bool commitFiles(const QStringList &fileList, const QString &comment); | 	bool commitFiles(const QStringList &fileList, const QString &comment, const QString& newBranchName, bool isPrivateBranch); | ||||||
| 	bool addFiles(const QStringList& fileList); | 	bool addFiles(const QStringList& fileList); | ||||||
| 	bool removeFiles(const QStringList& fileList, bool deleteLocal); | 	bool removeFiles(const QStringList& fileList, bool deleteLocal); | ||||||
| 	bool revertFiles(const QStringList& fileList); | 	bool revertFiles(const QStringList& fileList); | ||||||
|   | |||||||
| @@ -1358,7 +1358,7 @@ void MainWindow::on_actionCommit_triggered() | |||||||
| 	QStringList commit_msgs = settings.GetValue(FUEL_SETTING_COMMIT_MSG).toStringList(); | 	QStringList commit_msgs = settings.GetValue(FUEL_SETTING_COMMIT_MSG).toStringList(); | ||||||
|  |  | ||||||
| 	QString msg; | 	QString msg; | ||||||
| 	bool aborted = !CommitDialog::run(this, tr("Commit Changes"), commit_files, msg, &commit_msgs); | 	bool aborted = !CommitDialog::runCommit(this, commit_files, msg, commit_msgs); | ||||||
|  |  | ||||||
| 	// Aborted or not we always keep the commit messages. | 	// Aborted or not we always keep the commit messages. | ||||||
| 	// (This has saved me way too many times on TortoiseSVN) | 	// (This has saved me way too many times on TortoiseSVN) | ||||||
| @@ -1388,7 +1388,11 @@ void MainWindow::on_actionCommit_triggered() | |||||||
| 	if(commit_files.size() != all_modified_files.size()) | 	if(commit_files.size() != all_modified_files.size()) | ||||||
| 		files = commit_files; | 		files = commit_files; | ||||||
|  |  | ||||||
| 	fossil().commitFiles(files, msg); | 	// FIXME: add UI | ||||||
|  | 	QString branch_name=""; | ||||||
|  | 	bool private_branch = false; | ||||||
|  |  | ||||||
|  | 	fossil().commitFiles(files, msg, branch_name, private_branch); | ||||||
| 	refresh(); | 	refresh(); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -1960,8 +1964,8 @@ void MainWindow::on_actionNewStash_triggered() | |||||||
|  |  | ||||||
| 	QString stash_name; | 	QString stash_name; | ||||||
| 	bool revert = false; | 	bool revert = false; | ||||||
| 	QString checkbox_text = tr("Revert stashed files"); |  | ||||||
| 	if(!CommitDialog::run(this, tr("Stash Changes"), stashed_files, stash_name, 0, true, &checkbox_text, &revert) || stashed_files.empty()) | 	if(!CommitDialog::runStashNew(this, stashed_files, stash_name, revert) || stashed_files.empty()) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	stash_name = stash_name.trimmed(); | 	stash_name = stash_name.trimmed(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user