Plugins/VcsPlugins/vcsMercurial/BookmarksExtension/bookmarks.py

changeset 3302
e92f0dd51979
parent 3190
a9a94491c4fd
child 3484
645c12de6b0c
--- a/Plugins/VcsPlugins/vcsMercurial/BookmarksExtension/bookmarks.py	Sun Feb 23 15:24:28 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/BookmarksExtension/bookmarks.py	Sun Feb 23 19:20:43 2014 +0100
@@ -15,8 +15,6 @@
 from ..HgExtension import HgExtension
 from ..HgDialog import HgDialog
 
-import Preferences
-
 
 class Bookmarks(HgExtension):
     """
@@ -63,15 +61,13 @@
         @param repodir directory name of the repository (string)
         @return list of bookmarks (list of string)
         """
-        args = []
-        args.append('bookmarks')
+        args = self.vcs.initCommand("bookmarks")
         
         client = self.vcs.getClient()
         output = ""
         if client:
             output = client.runcommand(args)[0]
         else:
-            ioEncoding = Preferences.getSystem("IOEncoding")
             process = QProcess()
             process.setWorkingDirectory(repodir)
             process.start('hg', args)
@@ -79,9 +75,8 @@
             if procStarted:
                 finished = process.waitForFinished(30000)
                 if finished and process.exitCode() == 0:
-                    output = str(
-                        process.readAllStandardOutput(), ioEncoding,
-                        'replace')
+                    output = str(process.readAllStandardOutput(),
+                                 self.vcs.getEncoding(), 'replace')
         
         self.bookmarksList = []
         for line in output.splitlines():
@@ -117,8 +112,7 @@
         if dlg.exec_() == QDialog.Accepted:
             rev, bookmark = dlg.getData()
             
-            args = []
-            args.append("bookmarks")
+            args = self.vcs.initCommand("bookmarks")
             if rev:
                 args.append("--rev")
                 args.append(rev)
@@ -149,8 +143,7 @@
             [""] + sorted(self.hgGetBookmarksList(repodir)),
             0, True)
         if ok and bookmark:
-            args = []
-            args.append("bookmarks")
+            args = self.vcs.initCommand("bookmarks")
             args.append("--delete")
             args.append(bookmark)
             
@@ -177,8 +170,7 @@
         if dlg.exec_() == QDialog.Accepted:
             newName, oldName = dlg.getData()
             
-            args = []
-            args.append("bookmarks")
+            args = self.vcs.initCommand("bookmarks")
             args.append("--rename")
             args.append(oldName)
             args.append(newName)
@@ -209,8 +201,7 @@
         if dlg.exec_() == QDialog.Accepted:
             rev, bookmark = dlg.getData()
             
-            args = []
-            args.append("bookmarks")
+            args = self.vcs.initCommand("bookmarks")
             args.append("--force")
             if rev:
                 args.append("--rev")
@@ -256,11 +247,10 @@
         """
         bookmarksList = []
         
-        args = []
         if incoming:
-            args.append('incoming')
+            args = self.vcs.initCommand("incoming")
         else:
-            args.append('outgoing')
+            args = self.vcs.initCommand("outgoing")
         args.append('--bookmarks')
         
         client = self.vcs.getClient()
@@ -268,7 +258,6 @@
         if client:
             output = client.runcommand(args)[0]
         else:
-            ioEncoding = Preferences.getSystem("IOEncoding")
             process = QProcess()
             process.setWorkingDirectory(repodir)
             process.start('hg', args)
@@ -276,9 +265,8 @@
             if procStarted:
                 finished = process.waitForFinished(30000)
                 if finished and process.exitCode() == 0:
-                    output = str(
-                        process.readAllStandardOutput(), ioEncoding,
-                        'replace')
+                    output = str(process.readAllStandardOutput(),
+                                 self.vcs.getEncoding(), 'replace')
         
         for line in output.splitlines():
             if line.startswith(" "):
@@ -311,8 +299,7 @@
             [""] + sorted(bookmarks),
             0, True)
         if ok and bookmark:
-            args = []
-            args.append('pull')
+            args = self.vcs.initCommand("pull")
             args.append('--bookmark')
             args.append(bookmark)
             
@@ -345,8 +332,7 @@
             [""] + sorted(bookmarks),
             0, True)
         if ok and bookmark:
-            args = []
-            args.append('push')
+            args = self.vcs.initCommand("push")
             args.append('--bookmark')
             args.append(bookmark)
             

eric ide

mercurial