Plugins/VcsPlugins/vcsMercurial/HgStatusMonitorThread.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3302
e92f0dd51979
child 3555
43473ba956ce
--- a/Plugins/VcsPlugins/vcsMercurial/HgStatusMonitorThread.py	Sun Mar 30 22:00:14 2014 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/HgStatusMonitorThread.py	Thu Apr 03 23:05:31 2014 +0200
@@ -9,16 +9,14 @@
 
 from __future__ import unicode_literals
 try:
-    str = unicode    # __IGNORE_WARNING__
-except (NameError):
+    str = unicode
+except NameError:
     pass
 
 from PyQt4.QtCore import QProcess
 
 from VCS.StatusMonitorThread import VcsStatusMonitorThread
 
-import Preferences
-
 
 class HgStatusMonitorThread(VcsStatusMonitorThread):
     """
@@ -35,8 +33,6 @@
         """
         VcsStatusMonitorThread.__init__(self, interval, project, vcs, parent)
         
-        self.__ioEncoding = Preferences.getSystem("IOEncoding")
-        
         self.__client = None
         self.__useCommandLine = False
     
@@ -78,8 +74,7 @@
                 self.__useCommandLine = True
         
         # step 1: get overall status
-        args = []
-        args.append('status')
+        args = self.vcs.initCommand("status")
         args.append('--noninteractive')
         args.append('--all')
         
@@ -96,16 +91,16 @@
                 finished = process.waitForFinished(300000)
                 if finished and process.exitCode() == 0:
                     output = str(process.readAllStandardOutput(),
-                                 self.__ioEncoding, 'replace')
+                                 self.vcs.getEncoding(), 'replace')
                 else:
                     process.kill()
                     process.waitForFinished()
                     error = str(process.readAllStandardError(),
-                                self.__ioEncoding, 'replace')
+                                self.vcs.getEncoding(), 'replace')
             else:
                 process.kill()
                 process.waitForFinished()
-                error = self.trUtf8("Could not start the Mercurial process.")
+                error = self.tr("Could not start the Mercurial process.")
         
         if error:
             return False, error
@@ -122,8 +117,7 @@
                     states[name] = status
         
         # step 2: get conflicting changes
-        args = []
-        args.append('resolve')
+        args = self.vcs.initCommand("resolve")
         args.append('--list')
         
         output = ""
@@ -137,9 +131,8 @@
             if procStarted:
                 finished = process.waitForFinished(300000)
                 if finished and process.exitCode() == 0:
-                    output = str(
-                        process.readAllStandardOutput(),
-                        self.__ioEncoding, 'replace')
+                    output = str(process.readAllStandardOutput(),
+                                 self.vcs.getEncoding(), 'replace')
         
         for line in output.splitlines():
             flag, name = line.split(" ", 1)
@@ -160,7 +153,7 @@
         self.reportedStates = states
         
         return True, \
-            self.trUtf8("Mercurial status checked successfully")
+            self.tr("Mercurial status checked successfully")
     
     def _shutdown(self):
         """

eric ide

mercurial