diff --git a/fetch_command.py b/fetch_command.py index 1be4ac6e18..dec8cb1529 100644 --- a/fetch_command.py +++ b/fetch_command.py @@ -349,12 +349,8 @@ def stupid_svn_server_pull_rev(ui, svn, hg_editor, r): f = open(file_path, 'w') f.write(svn.get_file(diff_path+'/'+m, r.revnum)) f.close() - except core.SubversionException, e: - if (e.message.endswith("' path not found") - or e.message.startswith("File not found: revision")): - pass - else: - raise + except IOError: + pass d2 = empty_file_patch_wont_make_re.sub('', d) d2 = property_exec_set_re.sub('', d2) d2 = property_exec_removed_re.sub('', d2) diff --git a/svnwrap/svn_swig_wrapper.py b/svnwrap/svn_swig_wrapper.py index 2c900d3539..146c809388 100644 --- a/svnwrap/svn_swig_wrapper.py +++ b/svnwrap/svn_swig_wrapper.py @@ -391,17 +391,16 @@ class SubversionRepo(object): def get_file(self, path, revision): out = cStringIO.StringIO() - tmpdir = tempfile.mkdtemp('svnwrap_temp') try: - # hot tip: the swig bridge doesn't like StringIO for these bad boys - out_path = os.path.join(tmpdir, 'diffout') - out = open(out_path, 'w') - ra.get_file(self.ra, path,revision, out , None) - out.close() - x = open(out_path).read() - return x - finally: - shutil.rmtree(tmpdir) + ra.get_file(self.ra, path, revision, out) + except core.SubversionException, e: + notfound = (core.SVN_ERR_FS_NOT_FOUND, + core.SVN_ERR_RA_DAV_PATH_NOT_FOUND) + if e.apr_err in notfound: # File not found + raise IOError() + raise + data = out.getvalue() + return data def proplist(self, path, revision, recurse=False): rev = core.svn_opt_revision_t()