--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDialog.py Mon Dec 02 11:37:38 2024 +0100 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgUserConfigDialog.py Mon Dec 02 15:48:03 2024 +0100 @@ -84,11 +84,6 @@ ) self.protocolsList.headerItem().setText(self.protocolsList.columnCount(), "") - if self.__version < (3, 9, 0): - self.disableTls10WarningCheckBox.setEnabled(False) - self.minimumProtocolComboBox.setEnabled(False) - self.minimumProtcolGroupBox.setEnabled(False) - self.tabWidget.setCurrentIndex(0) self.__editor = None @@ -115,6 +110,7 @@ self.userNameEdit.text(), self.emailEdit.text(), ) + ################################################################### ## extensions section ################################################################### @@ -172,12 +168,27 @@ del self.__config["extensions"]["largefiles"] self.__config["extensions"]["#largefiles"] = "" - if self.closeheadCheckBox.isChecked() and self.__version >= (4, 8, 0): + if self.closeheadCheckBox.isChecked(): self.__config["extensions"]["closehead"] = "" else: if "closehead" in self.__config["extensions"]: del self.__config["extensions"]["closehead"] self.__config["extensions"]["#closehead"] = "" + + if self.fastexportCheckBox.isChecked(): + self.__config["extensions"]["fastexport"] = "" + else: + if "fastexport" in self.__config["extensions"]: + del self.__config["extensions"]["fastexport"] + self.__config["extensions"]["#fastexport"] = "" + + if self.uncommitCheckBox.isChecked(): + self.__config["extensions"]["uncommit"] = "" + else: + if "uncommit" in self.__config["uncommit"]: + del self.__config["extensions"]["uncommit"] + self.__config["extensions"]["#uncommit"] = "" + ################################################################### ## http_proxy section ################################################################### @@ -192,77 +203,50 @@ else: if "http_proxy" in self.__config: del self.__config["http_proxy"] + ################################################################### ## hostfingerprints/hostsecurity section ################################################################### - if self.__version < (3, 9, 0): - # - # delete hostsecurity section - # - if "hostsecurity" in self.__config: - del self.__config["hostsecurity"] + # + # hostsecurity section + # + if "hostsecurity" not in self.__config: + self.__config["hostsecurity"] = {} - # - # hostfingerprints section - # - if self.fingerprintsList.topLevelItemCount() > 0: - 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)] = fingerprint - else: - if "hostfingerprints" in self.__config: - del self.__config["hostfingerprints"] + if self.fingerprintsList.topLevelItemCount() > 0: + self.__clearFingerprints() + fingerprints = self.__assembleFingerprints() + for host in fingerprints: + key = "{0}:fingerprints".format(host) + self.__config["hostsecurity"][key] = ", ".join(fingerprints[host]) else: - # - # delete hostfingerprints section - # - if "hostfingerprints" in self.__config: - del self.__config["hostfingerprints"] - - # - # hostsecurity section - # - if "hostsecurity" not in self.__config: - self.__config["hostsecurity"] = {} + self.__clearFingerprints() - if self.fingerprintsList.topLevelItemCount() > 0: - self.__clearFingerprints() - fingerprints = self.__assembleFingerprints() - for host in fingerprints: - key = "{0}:fingerprints".format(host) - self.__config["hostsecurity"][key] = ", ".join(fingerprints[host]) - else: - self.__clearFingerprints() - - if self.disableTls10WarningCheckBox.isChecked(): - disabletls10warning = "true" - else: - disabletls10warning = "false" - self.__config["hostsecurity"]["disabletls10warning"] = disabletls10warning + if self.disableTls10WarningCheckBox.isChecked(): + disabletls10warning = "true" + else: + disabletls10warning = "false" + self.__config["hostsecurity"]["disabletls10warning"] = disabletls10warning - if self.minimumProtocolComboBox.currentIndex() == 0: - self.__config.remove_option("hostsecurity", "minimumprotocol") - else: - minimumProtocol = self.minimumProtocolComboBox.itemData( - self.minimumProtocolComboBox.currentIndex() - ) - self.__config["hostsecurity"]["minimumprotocol"] = minimumProtocol + if self.minimumProtocolComboBox.currentIndex() == 0: + self.__config.remove_option("hostsecurity", "minimumprotocol") + else: + minimumProtocol = self.minimumProtocolComboBox.itemData( + self.minimumProtocolComboBox.currentIndex() + ) + self.__config["hostsecurity"]["minimumprotocol"] = minimumProtocol - if self.protocolsList.topLevelItemCount() > 0: - self.__clearMinimumProtocols() - minimumProtocols = self.__assembleMinimumProtocols() - for host in minimumProtocols: - key = "{0}:minimumprotocol".format(host) - self.__config["hostsecurity"][key] = minimumProtocols[host] - else: - self.__clearMinimumProtocols() + if self.protocolsList.topLevelItemCount() > 0: + self.__clearMinimumProtocols() + minimumProtocols = self.__assembleMinimumProtocols() + for host in minimumProtocols: + key = "{0}:minimumprotocol".format(host) + self.__config["hostsecurity"][key] = minimumProtocols[host] + else: + self.__clearMinimumProtocols() - if len(self.__config.options("hostsecurity")) == 0: - del self.__config["hostsecurity"] + if len(self.__config.options("hostsecurity")) == 0: + del self.__config["hostsecurity"] ################################################################### cfgFile = getConfigPath() @@ -302,7 +286,12 @@ self.closeheadCheckBox.setChecked( "closehead" in self.__config["extensions"] ) - self.closeheadCheckBox.setEnabled(self.__version >= (4, 8, 0)) + self.fastexportCheckBox.setChecked( + "fastexport" in self.__config["extensions"] + ) + self.uncommitCheckBox.setChecked( + "uncommit" in self.__config["extensions"] + ) # step 3: extract large files information if "largefiles" in self.__config: @@ -332,36 +321,13 @@ if "no" in self.__config["http_proxy"]: self.proxyBypassEdit.setText(self.__config["http_proxy"]["no"]) - # step 5a: extract host fingerprints - if "hostfingerprints" in self.__config: - for host in self.__config.options("hostfingerprints"): - if self.__version < (3, 9, 0): - QTreeWidgetItem( - self.fingerprintsList, - [host, self.__config["hostfingerprints"][host]], - ) - else: - # convert to hostsecurity fingerprint - QTreeWidgetItem( - self.fingerprintsList, - [host, "sha1:" + self.__config["hostfingerprints"][host]], - ) - - # step 5b: extract hostsecurity fingerprints + # step 5: extract hostsecurity fingerprints if "hostsecurity" in self.__config: for key in self.__config.options("hostsecurity"): if key.endswith(":fingerprints"): host = key.replace(":fingerprints", "") 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()], @@ -417,6 +383,8 @@ self.rebaseCheckBox.setChecked(False) self.histeditCheckBox.setChecked(False) self.closeheadCheckBox.setChecked(False) + self.fastexportCheckBox.setChecked(False) + self.uncommitCheckBox.setChecked(False) self.largefilesCheckBox.setChecked(False) self.lfFileSizeSpinBox.setValue(10)