diff -r 700fc0934424 -r dfac14826e78 Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py --- a/Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py Wed Aug 10 16:23:08 2016 +0200 +++ b/Plugins/VcsPlugins/vcsMercurial/ProjectHelper.py Thu Aug 11 16:13:37 2016 +0200 @@ -63,6 +63,8 @@ for extension in self.__extensions: self.__extensionMenuTitles[ self.__extensions[extension].menuTitle()] = extension + + self.__toolbarManager = None def setObjects(self, vcsObject, projectObject): """ @@ -78,6 +80,17 @@ extension.setObjects(vcsObject, projectObject) self.vcs.iniFileChanged.connect(self.__checkActions) + + title = self.__toolbar.windowTitle() + if self.vcs.version >= (3, 9): + self.actions.append(self.hgBookmarkPullCurrentAct) + self.__toolbarManager.addAction(self.hgBookmarkPullCurrentAct, + title) + + if self.vcs.version >= (3, 8): + self.actions.append(self.hgBookmarkPushCurrentAct) + self.__toolbarManager.addAction(self.hgBookmarkPushCurrentAct, + title) def getProject(self): """ @@ -1154,6 +1167,22 @@ self.hgBookmarkPullAct.triggered.connect(self.__hgBookmarkPull) self.actions.append(self.hgBookmarkPullAct) + self.hgBookmarkPullCurrentAct = E5Action( + self.tr('Pull current bookmark'), + UI.PixmapCache.getIcon("pullBookmark.png"), + self.tr('Pull current bookmark'), + 0, 0, self, 'mercurial_pull_current_bookmark') + self.hgBookmarkPullCurrentAct.setStatusTip(self.tr( + 'Pull the current bookmark from a remote repository' + )) + self.hgBookmarkPullCurrentAct.setWhatsThis(self.tr( + """<b>Pull current bookmark</b>""" + """<p>This pulls the current bookmark from a remote""" + """ repository into the local repository.</p>""" + )) + self.hgBookmarkPullCurrentAct.triggered.connect( + self.__hgBookmarkPullCurrent) + self.hgBookmarkOutgoingAct = E5Action( self.tr('Show outgoing bookmarks'), UI.PixmapCache.getIcon("outgoingBookmark.png"), @@ -1187,6 +1216,22 @@ self.hgBookmarkPushAct.triggered.connect(self.__hgBookmarkPush) self.actions.append(self.hgBookmarkPushAct) + self.hgBookmarkPushCurrentAct = E5Action( + self.tr('Push current bookmark'), + UI.PixmapCache.getIcon("pushBookmark.png"), + self.tr('Push current bookmark'), + 0, 0, self, 'mercurial_push_current_bookmark') + self.hgBookmarkPushCurrentAct.setStatusTip(self.tr( + 'Push the current bookmark to a remote repository' + )) + self.hgBookmarkPushCurrentAct.setWhatsThis(self.tr( + """<b>Push current bookmark</b>""" + """<p>This pushes the current bookmark from the local""" + """ repository to a remote repository.</p>""" + )) + self.hgBookmarkPushCurrentAct.triggered.connect( + self.__hgBookmarkPushCurrent) + def __checkActions(self): """ Private slot to set the enabled status of actions. @@ -1195,6 +1240,8 @@ self.hgIncomingAct.setEnabled(self.vcs.canPull()) self.hgBookmarkPullAct.setEnabled(self.vcs.canPull()) self.hgBookmarkIncomingAct.setEnabled(self.vcs.canPull()) + if self.vcs.version >= (3, 9): + self.hgBookmarkPullCurrentAct.setEnabled(self.vcs.canPull()) self.hgPushAct.setEnabled(self.vcs.canPush()) self.hgPushBranchAct.setEnabled(self.vcs.canPush()) @@ -1202,6 +1249,8 @@ self.hgOutgoingAct.setEnabled(self.vcs.canPush()) self.hgBookmarkPushAct.setEnabled(self.vcs.canPush()) self.hgBookmarkOutgoingAct.setEnabled(self.vcs.canPush()) + if self.vcs.version >= (3, 8): + self.hgBookmarkPushCurrentAct.setEnabled(self.vcs.canPull()) def initMenu(self, menu): """ @@ -1294,9 +1343,13 @@ bookmarksMenu.addSeparator() bookmarksMenu.addAction(self.hgBookmarkIncomingAct) bookmarksMenu.addAction(self.hgBookmarkPullAct) + if self.vcs.version >= (3, 9): + bookmarksMenu.addAction(self.hgBookmarkPullCurrentAct) bookmarksMenu.addSeparator() bookmarksMenu.addAction(self.hgBookmarkOutgoingAct) bookmarksMenu.addAction(self.hgBookmarkPushAct) + if self.vcs.version >= (3, 8): + bookmarksMenu.addAction(self.hgBookmarkPushCurrentAct) self.subMenus.append(bookmarksMenu) self.__extensionsMenu = QMenu(self.tr("Extensions"), menu) @@ -1406,6 +1459,8 @@ @param toolbarManager reference to a toolbar manager object (E5ToolBarManager) """ + self.__toolbarManager = toolbarManager + self.__toolbar = QToolBar(self.tr("Mercurial"), ui) self.__toolbar.setIconSize(UI.Config.ToolBarIconSize) self.__toolbar.setObjectName("MercurialToolbar") @@ -1915,8 +1970,21 @@ """ self.vcs.hgBookmarkPull(self.project.getProjectPath()) + def __hgBookmarkPullCurrent(self): + """ + Private slot used to pull the current bookmark from a remote + repository. + """ + self.vcs.hgBookmarkPull(self.project.getProjectPath(), current=True) + def __hgBookmarkPush(self): """ Private slot used to push a bookmark to a remote repository. """ self.vcs.hgBookmarkPush(self.project.getProjectPath()) + + def __hgBookmarkPushCurrent(self): + """ + Private slot used to push the current bookmark to a remote repository. + """ + self.vcs.hgBookmarkPush(self.project.getProjectPath(), current=True)