Fixed an issue with the Mercurial user config dialog downgrading from a newer Mercurial version.

Sun, 20 Nov 2016 16:47:33 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 20 Nov 2016 16:47:33 +0100
changeset 5340
abbb6f750607
parent 5339
4f86ca6d3827
child 5341
d874aeb629dc

Fixed an issue with the Mercurial user config dialog downgrading from a newer Mercurial version.

Plugins/VcsPlugins/vcsMercurial/HgUserConfigDialog.py file | annotate | diff | comparison | revisions
--- a/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDialog.py	Sun Nov 20 16:29:29 2016 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDialog.py	Sun Nov 20 16:47:33 2016 +0100
@@ -203,8 +203,11 @@
                 self.__config["hostfingerprints"] = {}
                 for row in range(self.fingerprintsList.topLevelItemCount()):
                     itm = self.fingerprintsList.topLevelItem(row)
+                    fingerprint = itm.text(1)
+                    if fingerprint.startswith("sha1:"):
+                        fingerprint = fingerprint[5:]
                     self.__config["hostfingerprints"][itm.text(0)] = \
-                        itm.text(1)
+                        fingerprint
             else:
                 if "hostfingerprints" in self.__config:
                     del self.__config["hostfingerprints"]
@@ -358,6 +361,14 @@
                         fingerprints = \
                             self.__config["hostsecurity"][key].split(",")
                         for fingerprint in fingerprints:
+                            if self.__version < (3, 9, 0):
+                                # downgrade from a newer version
+                                if fingerprint.startswith("sha1:"):
+                                    fingerprint = fingerprint[5:]
+                                else:
+                                    # Mercurial < 3.9.0 supports sha1
+                                    # fingerprints only
+                                    continue
                             QTreeWidgetItem(self.fingerprintsList, [
                                 host,
                                 fingerprint.replace("\\", "").strip()

eric ide

mercurial