sshrepo: move mkstemp() out of the try block, we don't use the exception
simpler fix for 3b6f18851d87
--- a/mercurial/sshserver.py Sat Nov 07 03:22:03 2009 +0100
+++ b/mercurial/sshserver.py Sat Nov 07 13:25:25 2009 +0100
@@ -181,11 +181,9 @@
self.respond('')
# write bundle data to temporary file because it can be big
- tempname = fp = None
+ fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
+ fp = os.fdopen(fd, 'wb+')
try:
- fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
- fp = os.fdopen(fd, 'wb+')
-
count = int(self.fin.readline())
while count:
fp.write(self.fin.read(count))
@@ -212,10 +210,8 @@
self.lock.release()
self.lock = None
finally:
- if fp is not None:
- fp.close()
- if tempname is not None:
- os.unlink(tempname)
+ fp.close()
+ os.unlink(tempname)
def do_stream_out(self):
try: