Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3302
e92f0dd51979
child 3550
8019baa33b0c
diff -r 96232974dcdb -r 645c12de6b0c Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py
--- a/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py	Sun Mar 30 22:00:14 2014 +0200
+++ b/Plugins/VcsPlugins/vcsMercurial/HgDiffDialog.py	Thu Apr 03 23:05:31 2014 +0200
@@ -9,8 +9,8 @@
 
 from __future__ import unicode_literals
 try:
-    str = unicode    # __IGNORE_WARNING__
-except (NameError):
+    str = unicode
+except NameError:
     pass
 
 import os
@@ -116,14 +116,11 @@
         
         self.filesCombo.clear()
         
-        args = []
         if qdiff:
-            args.append('qdiff')
-            self.setWindowTitle(self.trUtf8("Patch Contents"))
+            args = self.vcs.initCommand("qdiff")
+            self.setWindowTitle(self.tr("Patch Contents"))
         else:
-            args.append('diff')
-            self.vcs.addArguments(args, self.vcs.options['global'])
-            self.vcs.addArguments(args, self.vcs.options['diff'])
+            args = self.vcs.initCommand("diff")
             
             if self.vcs.hasSubrepositories():
                 args.append("--subrepos")
@@ -200,8 +197,8 @@
                 self.inputGroup.hide()
                 E5MessageBox.critical(
                     self,
-                    self.trUtf8('Process Generation Error'),
-                    self.trUtf8(
+                    self.tr('Process Generation Error'),
+                    self.tr(
                         'The process {0} could not be started. '
                         'Ensure, that it is in the search path.'
                     ).format('hg'))
@@ -226,7 +223,7 @@
         
         if self.paras == 0:
             self.contents.insertPlainText(
-                self.trUtf8('There is no difference.'))
+                self.tr('There is no difference.'))
             return
         
         self.buttonBox.button(QDialogButtonBox.Save).setEnabled(True)
@@ -239,8 +236,8 @@
         self.contents.setTextCursor(tc)
         self.contents.ensureCursorVisible()
         
-        self.filesCombo.addItem(self.trUtf8("<Start>"), 0)
-        self.filesCombo.addItem(self.trUtf8("<End>"), -1)
+        self.filesCombo.addItem(self.tr("<Start>"), 0)
+        self.filesCombo.addItem(self.tr("<End>"), -1)
         for oldFile, newFile, pos in sorted(self.__fileSeparators):
             if oldFile != newFile:
                 self.filesCombo.addItem(
@@ -318,8 +315,7 @@
         self.process.setReadChannel(QProcess.StandardOutput)
         
         while self.process.canReadLine():
-            line = str(self.process.readLine(),
-                       Preferences.getSystem("IOEncoding"),
+            line = str(self.process.readLine(), self.vcs.getEncoding(),
                        'replace')
             self.__processOutputLine(line)
     
@@ -332,8 +328,7 @@
         """
         if self.process is not None:
             s = str(self.process.readAllStandardError(),
-                    Preferences.getSystem("IOEncoding"),
-                    'replace')
+                    self.vcs.getEncoding(), 'replace')
             self.__showError(s)
     
     def __showError(self, out):
@@ -411,9 +406,9 @@
         
         fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
             self,
-            self.trUtf8("Save Diff"),
+            self.tr("Save Diff"),
             fname,
-            self.trUtf8("Patch Files (*.diff)"),
+            self.tr("Patch Files (*.diff)"),
             None,
             E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
         
@@ -428,9 +423,9 @@
         if QFileInfo(fname).exists():
             res = E5MessageBox.yesNo(
                 self,
-                self.trUtf8("Save Diff"),
-                self.trUtf8("<p>The patch file <b>{0}</b> already exists."
-                            " Overwrite it?</p>").format(fname),
+                self.tr("Save Diff"),
+                self.tr("<p>The patch file <b>{0}</b> already exists."
+                        " Overwrite it?</p>").format(fname),
                 icon=E5MessageBox.Warning)
             if not res:
                 return
@@ -443,8 +438,8 @@
             f.close()
         except IOError as why:
             E5MessageBox.critical(
-                self, self.trUtf8('Save Diff'),
-                self.trUtf8(
+                self, self.tr('Save Diff'),
+                self.tr(
                     '<p>The patch file <b>{0}</b> could not be saved.'
                     '<br>Reason: {1}</p>')
                 .format(fname, str(why)))

eric ide

mercurial