Sat, 04 Aug 2018 14:05:07 +0200
hg, HgGraftDialog: added support for the '--no-commit' flag as of Mercurial 4.7.0.
--- a/Plugins/VcsPlugins/vcsMercurial/HgGraftDialog.py Sat Aug 04 13:38:50 2018 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/HgGraftDialog.py Sat Aug 04 14:05:07 2018 +0200 @@ -15,7 +15,6 @@ from .Ui_HgGraftDialog import Ui_HgGraftDialog -# TODO: Mercurial 4.7: add support for the --no-commit flag class HgGraftDialog(QDialog, Ui_HgGraftDialog): """ Class implementing a dialog to enter the data for a graft session. @@ -24,10 +23,12 @@ """ Constructor - @param vcs reference to the VCS object (Hg) - @param revs list of revisions to show in the revisions pane (list of - strings) - @param parent reference to the parent widget (QWidget) + @param vcs reference to the VCS object + @type Hg + @param revs list of revisions to show in the revisions pane + @type list of str + @param parent reference to the parent widget + @type QWidget """ super(HgGraftDialog, self).__init__(parent) self.setupUi(self) @@ -36,6 +37,8 @@ if revs: self.revisionsEdit.setPlainText("\n".join(sorted(revs))) + + self.noCommitCheckBox.setEnabled(vcs.version >= (4, 7, 0)) self.__updateOk() @@ -63,16 +66,18 @@ """ Private slot to handle changes of the user group state. - @param checked flag giving the checked state (boolean) + @param checked flag giving the checked state + @type bool """ self.__updateOk() @pyqtSlot(bool) def on_currentUserCheckBox_toggled(self, checked): """ - Private slot to handle changes of the currentuser state. + Private slot to handle changes of the current user state. - @param checked flag giving the checked state (boolean) + @param checked flag giving the checked state + @type bool """ self.__updateOk() @@ -94,17 +99,28 @@ current user and the user name, another tuple giving a flag indicating to set the date, a flag indicating to use the current date and the date, a flag indicating to append graft info - to the log message and a flag indicating a dry-run (list of - strings, (boolean, boolean, string), (boolean, boolean, string), - boolean, boolean) + to the log message, a flag indicating a dry-run and a flag + indicating to not commit the copied changesets + @rtype tuple of (list of str, (bool, bool, str), (bool, bool, str), + bool, bool, bool) """ - userData = (self.userGroup.isChecked(), - self.currentUserCheckBox.isChecked(), - self.userEdit.text()) - dateData = (self.dateGroup.isChecked(), - self.currentDateCheckBox.isChecked(), - self.dateTimeEdit.dateTime().toString("yyyy-MM-dd hh:mm")) - return (self.revisionsEdit.toPlainText().strip().splitlines(), - userData, dateData, - self.logCheckBox.isChecked(), - self.dryRunCheckBox.isChecked()) + userData = ( + self.userGroup.isChecked(), + self.currentUserCheckBox.isChecked(), + self.userEdit.text(), + ) + + dateData = ( + self.dateGroup.isChecked(), + self.currentDateCheckBox.isChecked(), + self.dateTimeEdit.dateTime().toString("yyyy-MM-dd hh:mm"), + ) + + return ( + self.revisionsEdit.toPlainText().strip().splitlines(), + userData, + dateData, + self.logCheckBox.isChecked(), + self.dryRunCheckBox.isChecked(), + self.noCommitCheckBox.isChecked(), + )
--- a/Plugins/VcsPlugins/vcsMercurial/HgGraftDialog.ui Sat Aug 04 13:38:50 2018 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/HgGraftDialog.ui Sat Aug 04 14:05:07 2018 +0200 @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>450</width> - <height>400</height> + <height>500</height> </rect> </property> <property name="windowTitle"> @@ -166,6 +166,16 @@ </widget> </item> <item> + <widget class="QCheckBox" name="noCommitCheckBox"> + <property name="toolTip"> + <string>Select to not commit the copied changesets</string> + </property> + <property name="text"> + <string>Don't Commit</string> + </property> + </widget> + </item> + <item> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum>
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py Sat Aug 04 13:38:50 2018 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/hg.py Sat Aug 04 14:05:07 2018 +0200 @@ -3000,13 +3000,13 @@ if os.path.splitdrive(repodir)[1] == os.sep: return False - # TODO: Mercurial 4.7: add support for the --no-commit flag from .HgGraftDialog import HgGraftDialog res = False dlg = HgGraftDialog(self, revs) if dlg.exec_() == QDialog.Accepted: revs, (userData, currentUser, userName), \ - (dateData, currentDate, dateStr), log, dryrun = dlg.getData() + (dateData, currentDate, dateStr), log, dryrun, \ + noCommit = dlg.getData() args = self.initCommand("graft") args.append("--verbose") @@ -3026,6 +3026,8 @@ args.append("--log") if dryrun: args.append("--dry-run") + if noCommit: + args.append("--no-commit") args.extend(revs) dia = HgDialog(self.tr('Copy Changesets'), self)