diff -r 1bf444289f77 -r 9c11e9285a46 Plugins/VcsPlugins/vcsMercurial/hg.py --- a/Plugins/VcsPlugins/vcsMercurial/hg.py Wed Nov 16 19:06:28 2016 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/hg.py Wed Nov 16 19:12:01 2016 +0100 @@ -3629,11 +3629,12 @@ if res: dia.exec_() - def hgBookmarkDelete(self, name): + def hgBookmarkDelete(self, name, bookmark=None): """ Public method to delete a bookmark. @param name file/directory name (string) + @param bookmark name of the bookmark (string) """ # find the root of the repo repodir = self.splitPath(name)[0] @@ -3642,12 +3643,15 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - bookmark, ok = QInputDialog.getItem( - None, - self.tr("Delete Bookmark"), - self.tr("Select the bookmark to be deleted:"), - [""] + sorted(self.hgGetBookmarksList(repodir)), - 0, True) + if bookmark: + ok = True + else: + bookmark, ok = QInputDialog.getItem( + None, + self.tr("Delete Bookmark"), + self.tr("Select the bookmark to be deleted:"), + [""] + sorted(self.hgGetBookmarksList(repodir)), + 0, True) if ok and bookmark: args = self.initCommand("bookmarks") args.append("--delete") @@ -3658,11 +3662,14 @@ if res: dia.exec_() - def hgBookmarkRename(self, name): + def hgBookmarkRename(self, name, renameInfo=None): """ Public method to rename a bookmark. - @param name file/directory name (string) + @param name file/directory name + @type str + @param renameInfo old and new names of the bookmark + @type tuple of str and str """ # find the root of the repo repodir = self.splitPath(name)[0] @@ -3671,15 +3678,17 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - from .HgBookmarkRenameDialog import HgBookmarkRenameDialog - dlg = HgBookmarkRenameDialog(self.hgGetBookmarksList(repodir)) - if dlg.exec_() == QDialog.Accepted: - newName, oldName = dlg.getData() - + if not renameInfo: + from .HgBookmarkRenameDialog import HgBookmarkRenameDialog + dlg = HgBookmarkRenameDialog(self.hgGetBookmarksList(repodir)) + if dlg.exec_() == QDialog.Accepted: + renameInfo = dlg.getData() + + if renameInfo: args = self.initCommand("bookmarks") args.append("--rename") - args.append(oldName) - args.append(newName) + args.append(renameInfo[0]) + args.append(renameInfo[1]) dia = HgDialog(self.tr('Rename Mercurial Bookmark'), self) res = dia.startProcess(args, repodir) @@ -3792,7 +3801,7 @@ return bookmarksList - def hgBookmarkPull(self, name, current=False): + def hgBookmarkPull(self, name, current=False, bookmark=None): """ Public method to pull a bookmark from a remote repository. @@ -3800,6 +3809,8 @@ @type str @param current flag indicating to pull the current bookmark @type bool + @param bookmark name of the bookmark + @type str """ # find the root of the repo repodir = self.splitPath(name)[0] @@ -3811,15 +3822,17 @@ if current: bookmark = "." ok = True + elif bookmark: + ok = True else: bookmarks = self.__getInOutBookmarks(repodir, True) - bookmark, ok = QInputDialog.getItem( None, self.tr("Pull Bookmark"), self.tr("Select the bookmark to be pulled:"), [""] + sorted(bookmarks), 0, True) + if ok and bookmark: args = self.initCommand("pull") args.append('--bookmark') @@ -3832,7 +3845,7 @@ if res: dia.exec_() - def hgBookmarkPush(self, name, current=False): + def hgBookmarkPush(self, name, current=False, bookmark=None): """ Public method to push a bookmark to a remote repository. @@ -3840,6 +3853,8 @@ @type str @param current flag indicating to push the current bookmark @type bool + @param bookmark name of the bookmark + @type str """ # find the root of the repo repodir = self.splitPath(name)[0] @@ -3851,15 +3866,17 @@ if current: bookmark = "." ok = True + elif bookmark: + ok = True else: bookmarks = self.__getInOutBookmarks(repodir, False) - bookmark, ok = QInputDialog.getItem( None, self.tr("Push Bookmark"), self.tr("Select the bookmark to be push:"), [""] + sorted(bookmarks), 0, True) + if ok and bookmark: args = self.initCommand("push") args.append('--bookmark')