eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksListDialog.py

changeset 7970
c4ee8a81584c
parent 7923
91e843545d9a
child 8108
a42ae6be4cc3
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksListDialog.py	Tue Jan 12 17:19:02 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgBookmarksListDialog.py	Tue Jan 12 20:03:30 2021 +0100
@@ -7,8 +7,6 @@
 Module implementing a dialog to show a list of bookmarks.
 """
 
-import os
-
 from PyQt5.QtCore import pyqtSlot, Qt, QCoreApplication, QPoint
 from PyQt5.QtWidgets import (
     QDialog, QDialogButtonBox, QHeaderView, QTreeWidgetItem, QLineEdit, QMenu,
@@ -48,7 +46,6 @@
         
         self.vcs = vcs
         self.__bookmarksList = None
-        self.__repoDir = None
         self.__hgClient = vcs.getClient()
         self.__bookmarksDefined = False
         self.__currentRevision = ""
@@ -71,11 +68,10 @@
         
         e.accept()
     
-    def start(self, path, bookmarksList):
+    def start(self, bookmarksList):
         """
         Public slot to start the bookmarks command.
         
-        @param path name of directory to be listed (string)
         @param bookmarksList reference to string list receiving the bookmarks
             (list of strings)
         """
@@ -90,16 +86,6 @@
         self.__bookmarksList = bookmarksList
         del self.__bookmarksList[:]     # clear the list
         
-        dname, fname = self.vcs.splitPath(path)
-        
-        # find the root of the repo
-        repodir = dname
-        while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
-            repodir = os.path.dirname(repodir)
-            if os.path.splitdrive(repodir)[1] == os.sep:
-                return
-        self.__repoDir = repodir
-        
         args = self.vcs.initCommand("bookmarks")
         
         self.refreshButton.setEnabled(False)
@@ -245,7 +231,7 @@
         else:
             self.__currentRevision = ""
         
-        self.start(self.__repoDir, self.__bookmarksList)
+        self.start(self.__bookmarksList)
     
     @pyqtSlot(QPoint)
     def on_bookmarksList_customContextMenuRequested(self, pos):
@@ -286,8 +272,7 @@
         itm = self.bookmarksList.currentItem()
         bookmark = itm.text(3).strip()
         if bookmark:
-            shouldReopen = self.vcs.vcsUpdate(
-                self.__repoDir, revision=bookmark)
+            shouldReopen = self.vcs.vcsUpdate(revision=bookmark)
             if shouldReopen:
                 res = E5MessageBox.yesNo(
                     None,
@@ -314,7 +299,7 @@
                 self.tr("""<p>Shall the bookmark <b>{0}</b> really be"""
                         """ deleted?</p>""").format(bookmark))
             if yes:
-                self.vcs.hgBookmarkDelete(self.__repoDir, bookmark=bookmark)
+                self.vcs.hgBookmarkDelete(bookmark=bookmark)
                 self.on_refreshButton_clicked()
     
     def __renameBookmark(self):
@@ -331,7 +316,7 @@
                 .format(bookmark),
                 QLineEdit.Normal)
             if ok and bool(newName):
-                self.vcs.hgBookmarkRename(self.__repoDir, (bookmark, newName))
+                self.vcs.hgBookmarkRename((bookmark, newName))
                 self.on_refreshButton_clicked()
     
     def __pullBookmark(self):
@@ -341,7 +326,7 @@
         itm = self.bookmarksList.currentItem()
         bookmark = itm.text(3).strip()
         if bookmark:
-            self.vcs.hgBookmarkPull(self.__repoDir, bookmark=bookmark)
+            self.vcs.hgBookmarkPull(bookmark=bookmark)
             self.on_refreshButton_clicked()
     
     def __pushBookmark(self):
@@ -351,5 +336,5 @@
         itm = self.bookmarksList.currentItem()
         bookmark = itm.text(3).strip()
         if bookmark:
-            self.vcs.hgBookmarkPush(self.__repoDir, bookmark=bookmark)
+            self.vcs.hgBookmarkPush(bookmark=bookmark)
             self.on_refreshButton_clicked()

eric ide

mercurial