Sun, 12 Feb 2017 17:42:42 +0100
Added a an entry to apply the currently previewed changegroup file to the Mercurial log browser action menu.
Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py | file | annotate | diff | comparison | revisions | |
Plugins/VcsPlugins/vcsMercurial/hg.py | file | annotate | diff | comparison | revisions |
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sun Feb 12 11:40:10 2017 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sun Feb 12 17:42:42 2017 +0100 @@ -339,6 +339,11 @@ """ the base revision and all other revision will be bundled.""" """ If the dialog is showing outgoing changesets, all""" """ selected changesets will be bundled.</p>""")) + self.__unbundleAct = self.__actionsMenu.addAction( + UI.PixmapCache.getIcon("vcsApplyChangegroup.png"), + self.tr("Apply Changegroup"), self.__unbundleActTriggered) + self.__unbundleAct.setToolTip(self.tr( + "Apply the currently viewed changegroup file")) self.__actionsMenu.addSeparator() @@ -372,8 +377,6 @@ self.actionsButton.setIcon( UI.PixmapCache.getIcon("actionsToolButton.png")) self.actionsButton.setMenu(self.__actionsMenu) - - # TODO: add action to apply viewed bundle file def __actionsMenuHovered(self, action): """ @@ -1519,6 +1522,7 @@ selectedItemsCount == 1) self.__bundleAct.setEnabled(self.logTree.topLevelItemCount() > 0) + self.__unbundleAct.setEnabled(False) self.__gpgSignAct.setEnabled( self.vcs.isExtensionActive("gpg") and @@ -1559,6 +1563,8 @@ self.__lfPullAct.setEnabled(False) self.__fetchAct.setEnabled(False) + self.__unbundleAct.setEnabled(bool(self.__bundle)) + self.actionsButton.setEnabled(True) elif self.initialCommandMode == "outgoing" and self.projectMode: @@ -1566,7 +1572,8 @@ self.__tagAct, self.__switchAct, self.__bookmarkAct, self.__bookmarkMoveAct, self.__pullAct, self.__lfPullAct, self.__fetchAct, self.__stripAct, - self.__gpgSignAct, self.__gpgVerifyAct]: + self.__gpgSignAct, self.__gpgVerifyAct, + self.__unbundleAct]: act.setEnabled(False) selectedItemsCount = len(self.logTree.selectedItems()) @@ -2351,6 +2358,26 @@ self.vcs.hgBundle(self.repodir, bundleData=bundleData) @pyqtSlot() + def __unbundleActTriggered(self): + """ + Private slot to apply the currently previewed bundle file. + """ + if self.initialCommandMode == "incoming" and bool(self.__bundle): + shouldReopen = self.vcs.hgUnbundle(self.repodir, + files=[self.__bundle]) + if shouldReopen: + res = E5MessageBox.yesNo( + None, + self.tr("Apply Changegroup"), + self.tr("""The project should be reread. Do this now?"""), + yesDefault=True) + if res: + e5App().getObject("Project").reopenProject() + return + + self.on_refreshButton_clicked() + + @pyqtSlot() def __gpgSignActTriggered(self): """ Private slot to sign the selected revisions.
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py Sun Feb 12 11:40:10 2017 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/hg.py Sun Feb 12 17:42:42 2017 +0100 @@ -2643,13 +2643,17 @@ self.logBrowserIncoming.raise_() self.logBrowserIncoming.start(name, bundle=file) - def hgUnbundle(self, name): + def hgUnbundle(self, name, files=None): """ Public method to apply changegroup files. - @param name directory name (string) + @param name directory name + @type str + @param files list of bundle files to be applied + @type list of str @return flag indicating, that the update contained an add - or delete (boolean) + or delete + @rtype bool """ dname, fname = self.splitPath(name) @@ -2661,11 +2665,13 @@ return res = False - files = E5FileDialog.getOpenFileNames( - None, - self.tr("Apply changegroups"), - self.__lastChangeGroupPath or repodir, - self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) + if not files: + files = E5FileDialog.getOpenFileNames( + None, + self.tr("Apply changegroups"), + self.__lastChangeGroupPath or repodir, + self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) + if files: self.__lastChangeGroupPath = os.path.dirname(files[0]) @@ -2687,6 +2693,7 @@ dia.exec_() res = dia.hasAddOrDelete() self.checkVCSStatus() + return res def hgBisect(self, name, subcommand):