comparison fetch_command.py @ 32:d01196ca1e39

Fix non-atomic write of the last_revision_handled_file which was causing problems if the write got interrupted in the wrong spot.
author Augie Fackler <durin42@gmail.com>
date Wed, 15 Oct 2008 13:29:20 -0500
parents 575bd29bc1d8
children a9c15cae50e5
comparison
equal deleted inserted replaced
31:05800c403321 32:d01196ca1e39
85 have_replay = False 85 have_replay = False
86 stupid_svn_server_pull_rev(ui, svn, hg_editor, r) 86 stupid_svn_server_pull_rev(ui, svn, hg_editor, r)
87 else: 87 else:
88 stupid_svn_server_pull_rev(ui, svn, hg_editor, r) 88 stupid_svn_server_pull_rev(ui, svn, hg_editor, r)
89 converted = True 89 converted = True
90 open(hg_editor.last_revision_handled_file, 90 tmpfile = '%s_tmp' % hg_editor.last_revision_handled_file
91 'w').write(str(r.revnum)) 91 fp = open(tmpfile, 'w')
92 fp.write(str(r.revnum))
93 fp.close()
94 merc_util.rename(tmpfile,
95 hg_editor.last_revision_handled_file)
92 except core.SubversionException, e: 96 except core.SubversionException, e:
93 if hasattr(e, 'message') and ( 97 if hasattr(e, 'message') and (
94 'Server sent unexpected return value (502 Bad Gateway)' 98 'Server sent unexpected return value (502 Bad Gateway)'
95 ' in response to PROPFIND') in e.message: 99 ' in response to PROPFIND') in e.message:
96 tries += 1 100 tries += 1