--- a/mercurial/httppeer.py Mon Jul 29 10:07:53 2024 +0200
+++ b/mercurial/httppeer.py Fri Jul 26 21:54:07 2024 -0400
@@ -520,10 +520,9 @@
os.unlink(tempname)
def _calltwowaystream(self, cmd, fp, **args):
- filename = None
+ # dump bundle to disk
+ fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg")
try:
- # dump bundle to disk
- fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg")
with os.fdopen(fd, "wb") as fh:
d = fp.read(4096)
while d:
@@ -534,8 +533,7 @@
headers = {'Content-Type': 'application/mercurial-0.1'}
return self._callstream(cmd, data=fp_, headers=headers, **args)
finally:
- if filename is not None:
- os.unlink(filename)
+ os.unlink(filename)
def _callcompressable(self, cmd, **args):
return self._callstream(cmd, _compressible=True, **args)