Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py

changeset 4013
e3c30bae0d15
parent 3863
472eb955ff9c
child 4021
195a471c327b
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py	Tue Dec 30 19:29:44 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py	Wed Dec 31 12:44:08 2014 +0100
@@ -15,7 +15,8 @@
 
 import os
 
-from PyQt5.QtCore import pyqtSlot, QProcess, QTimer, QUrl
+from PyQt5.QtCore import pyqtSlot, QProcess, QTimer, QUrl, QByteArray, \
+    qVersion
 from PyQt5.QtGui import QTextCursor
 from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QApplication, QLineEdit
 
@@ -340,8 +341,13 @@
                 url = QUrl()
                 url.setScheme("file")
                 url.setPath(self.filename)
-                query = parent.split(":")[0] + '_' + rev
-                url.setQuery(query)
+                if qVersion() >= "5.0.0":
+                    query = parent.split(":")[0] + '_' + rev
+                    url.setQuery(query)
+                else:
+                    query = QByteArray()
+                    query.append(parent.split(":")[0]).append('_').append(rev)
+                    url.setEncodedQuery(query)
                 dstr += ' [<a href="{0}" name="{1}" id="{1}">{2}</a>]'.format(
                     url.toString(), query,
                     self.tr('diff to {0}').format(parent),
@@ -487,7 +493,10 @@
         if Utilities.isWindowsPlatform():
             if filename.startswith("/"):
                 filename = filename[1:]
-        ver = url.query()
+        if qVersion() >= "5.0.0":
+            ver = url.query()
+        else:
+            ver = bytes(url.encodedQuery()).decode()
         v1, v2 = ver.split('_')
         if v1 == "" or v2 == "":
             return

eric ide

mercurial