eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditPlanEditor.py

changeset 7785
9978016560ec
parent 7780
41420f82c0ac
child 7836
2f0d208b8137
diff -r 3257703e10c5 -r 9978016560ec eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditPlanEditor.py
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditPlanEditor.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditPlanEditor.py	Wed Oct 14 17:50:39 2020 +0200
@@ -103,9 +103,8 @@
         populate the dialog.
         """
         try:
-            f = open(self.__fileName, "r")
-            txt = f.read()
-            f.close()
+            with open(self.__fileName, "r") as f:
+                txt = f.read()
         except (IOError, OSError) as err:
             E5MessageBox.critical(
                 self,
@@ -239,9 +238,8 @@
         """
         text = self.__assembleEditPlan()
         try:
-            f = open(self.__fileName, "w")
-            f.write(text)
-            f.close()
+            with open(self.__fileName, "w") as f:
+                f.write(text)
         except (IOError, OSError) as err:
             E5MessageBox.critical(
                 self,

eric ide

mercurial