eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py

changeset 7785
9978016560ec
parent 7779
757334671130
child 7923
91e843545d9a
diff -r 3257703e10c5 -r 9978016560ec eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py	Tue Oct 13 19:02:26 2020 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py	Wed Oct 14 17:50:39 2020 +0200
@@ -1148,9 +1148,8 @@
         if patch:
             patchFile = self.__tmpPatchFileName()
             try:
-                f = open(patchFile, "w")
-                f.write(patch)
-                f.close()
+                with open(patchFile, "w") as f:
+                    f.write(patch)
                 self.vcs.gitApply(self.dname, patchFile, cached=True,
                                   noDialog=True)
                 self.on_refreshButton_clicked()
@@ -1171,9 +1170,8 @@
         if patch:
             patchFile = self.__tmpPatchFileName()
             try:
-                f = open(patchFile, "w")
-                f.write(patch)
-                f.close()
+                with open(patchFile, "w") as f:
+                    f.write(patch)
                 self.vcs.gitApply(self.dname, patchFile, cached=True,
                                   reverse=True, noDialog=True)
                 self.on_refreshButton_clicked()
@@ -1204,9 +1202,8 @@
             if patch:
                 patchFile = self.__tmpPatchFileName()
                 try:
-                    f = open(patchFile, "w")
-                    f.write(patch)
-                    f.close()
+                    with open(patchFile, "w") as f:
+                        f.write(patch)
                     self.vcs.gitApply(self.dname, patchFile, reverse=True,
                                       noDialog=True)
                     self.on_refreshButton_clicked()

eric ide

mercurial