hgext/rebase.py
changeset 52567 92dff84829b3
parent 52386 6856d88410b2
child 52638 dc36535a5edc
--- a/hgext/rebase.py	Mon Dec 16 20:52:20 2024 -0500
+++ b/hgext/rebase.py	Mon Dec 16 20:57:01 2024 -0500
@@ -1856,9 +1856,11 @@
 def isagitpatch(repo, patchname):
     """Return true if the given patch is in git format"""
     mqpatch = os.path.join(repo.mq.path, patchname)
-    for line in patch.linereader(open(mqpatch, 'rb')):
-        if line.startswith(b'diff --git'):
-            return True
+
+    with open(mqpatch, 'rb') as fp:
+        for line in patch.linereader(fp):
+            if line.startswith(b'diff --git'):
+                return True
     return False