comparison fetch_command.py @ 224:2165461d2dd8

Exception clean-ups; use symbolic names & avoid Python 2.6 deprecations.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Thu, 19 Mar 2009 21:27:39 +0100
parents 907c160c6289
children 2117cb0118fe
comparison
equal deleted inserted replaced
212:a421aca2b0f5 224:2165461d2dd8
98 fp.write(str(r.revnum)) 98 fp.write(str(r.revnum))
99 fp.close() 99 fp.close()
100 merc_util.rename(tmpfile, 100 merc_util.rename(tmpfile,
101 hg_editor.last_revision_handled_file) 101 hg_editor.last_revision_handled_file)
102 except core.SubversionException, e: #pragma: no cover 102 except core.SubversionException, e: #pragma: no cover
103 if hasattr(e, 'message') and ( 103 if e.apr_err == core.SVN_ERR_RA_DAV_REQUEST_FAILED:
104 'Server sent unexpected return value (502 Bad Gateway)'
105 ' in response to PROPFIND') in e.message:
106 tries += 1 104 tries += 1
107 ui.status('Got a 502, retrying (%s)\n' % tries) 105 ui.status('Got a 502, retrying (%s)\n' % tries)
108 else: 106 else:
109 raise 107 raise merc_util.Abort(*e.args)
110 merc_util._encoding = old_encoding 108 merc_util._encoding = old_encoding
111 fetch_revisions = util.register_subcommand('pull')(fetch_revisions) 109 fetch_revisions = util.register_subcommand('pull')(fetch_revisions)
112 110
113 111
114 def cleanup_file_handles(svn, count): 112 def cleanup_file_handles(svn, count):
246 if d: 244 if d:
247 raise BadPatchApply('branch creation with mods') 245 raise BadPatchApply('branch creation with mods')
248 except svnwrap.SubversionRepoCanNotDiff: 246 except svnwrap.SubversionRepoCanNotDiff:
249 raise BadPatchApply('subversion diffing code is not supported') 247 raise BadPatchApply('subversion diffing code is not supported')
250 except core.SubversionException, e: 248 except core.SubversionException, e:
251 if (hasattr(e, 'apr_err') and e.apr_err != 160013): 249 if (hasattr(e, 'apr_err') and e.apr_err != core.SVN_ERR_FS_NOT_FOUND):
252 raise 250 raise
253 raise BadPatchApply('previous revision does not exist') 251 raise BadPatchApply('previous revision does not exist')
254 if '\0' in d: 252 if '\0' in d:
255 raise BadPatchApply('binary diffs are not supported') 253 raise BadPatchApply('binary diffs are not supported')
256 files_data = {} 254 files_data = {}
607 try: 605 try:
608 files_touched, filectxfn2 = stupid_diff_branchrev( 606 files_touched, filectxfn2 = stupid_diff_branchrev(
609 ui, svn, hg_editor, b, r, parentctx) 607 ui, svn, hg_editor, b, r, parentctx)
610 except BadPatchApply, e: 608 except BadPatchApply, e:
611 # Either this revision or the previous one does not exist. 609 # Either this revision or the previous one does not exist.
612 ui.status("fetching entire rev: %s.\n" % e.message) 610 ui.status("Fetching entire revision: %s.\n" % e.args[0])
613 files_touched, filectxfn2 = stupid_fetch_branchrev( 611 files_touched, filectxfn2 = stupid_fetch_branchrev(
614 svn, hg_editor, b, branches[b], r, parentctx) 612 svn, hg_editor, b, branches[b], r, parentctx)
615 613
616 externals = stupid_fetch_externals(svn, branches[b], r, parentctx) 614 externals = stupid_fetch_externals(svn, branches[b], r, parentctx)
617 if externals is not None: 615 if externals is not None: