comparison fetch_command.py @ 228:f71af18c4379

Merge with crew.
author Augie Fackler <durin42@gmail.com>
date Tue, 07 Apr 2009 13:48:58 -0500
parents 330f0b15d417 2117cb0118fe
children 7f20914e52e8
comparison
equal deleted inserted replaced
223:330f0b15d417 228:f71af18c4379
52 authors=authors, 52 authors=authors,
53 filemap=filemap) 53 filemap=filemap)
54 if os.path.exists(hg_editor.uuid_file): 54 if os.path.exists(hg_editor.uuid_file):
55 uuid = open(hg_editor.uuid_file).read() 55 uuid = open(hg_editor.uuid_file).read()
56 assert uuid == svn.uuid 56 assert uuid == svn.uuid
57 start = int(open(hg_editor.last_revision_handled_file, 'r').read()) 57 start = hg_editor.last_known_revision()
58 else: 58 else:
59 open(hg_editor.uuid_file, 'w').write(svn.uuid) 59 open(hg_editor.uuid_file, 'w').write(svn.uuid)
60 open(hg_editor.svn_url_file, 'w').write(svn_url) 60 open(hg_editor.svn_url_file, 'w').write(svn_url)
61 open(hg_editor.last_revision_handled_file, 'w').write(str(0))
62 initializing_repo = True 61 initializing_repo = True
63 start = skipto_rev 62 start = skipto_rev
64 63
65 if initializing_repo and start > 0: 64 if initializing_repo and start > 0:
66 raise merc_util.Abort('Revision skipping at repository initialization ' 65 raise merc_util.Abort('Revision skipping at repository initialization '
90 have_replay = False 89 have_replay = False
91 stupid_svn_server_pull_rev(ui, svn, hg_editor, r) 90 stupid_svn_server_pull_rev(ui, svn, hg_editor, r)
92 else: 91 else:
93 stupid_svn_server_pull_rev(ui, svn, hg_editor, r) 92 stupid_svn_server_pull_rev(ui, svn, hg_editor, r)
94 converted = True 93 converted = True
95 tmpfile = '%s_tmp' % hg_editor.last_revision_handled_file
96 fp = open(tmpfile, 'w')
97 fp.write(str(r.revnum))
98 fp.close()
99 merc_util.rename(tmpfile,
100 hg_editor.last_revision_handled_file)
101 except core.SubversionException, e: #pragma: no cover 94 except core.SubversionException, e: #pragma: no cover
102 if hasattr(e, 'message') and ( 95 if e.apr_err == core.SVN_ERR_RA_DAV_REQUEST_FAILED:
103 'Server sent unexpected return value (502 Bad Gateway)'
104 ' in response to PROPFIND') in e.message:
105 tries += 1 96 tries += 1
106 ui.status('Got a 502, retrying (%s)\n' % tries) 97 ui.status('Got a 502, retrying (%s)\n' % tries)
107 else: 98 else:
108 raise 99 raise merc_util.Abort(*e.args)
109 util.swap_out_encoding(old_encoding) 100 util.swap_out_encoding(old_encoding)
110 101
111 fetch_revisions = util.register_subcommand('pull')(fetch_revisions) 102 fetch_revisions = util.register_subcommand('pull')(fetch_revisions)
112 103
113 104
247 if d: 238 if d:
248 raise BadPatchApply('branch creation with mods') 239 raise BadPatchApply('branch creation with mods')
249 except svnwrap.SubversionRepoCanNotDiff: 240 except svnwrap.SubversionRepoCanNotDiff:
250 raise BadPatchApply('subversion diffing code is not supported') 241 raise BadPatchApply('subversion diffing code is not supported')
251 except core.SubversionException, e: 242 except core.SubversionException, e:
252 if (hasattr(e, 'apr_err') and e.apr_err != 160013): 243 if (hasattr(e, 'apr_err') and e.apr_err != core.SVN_ERR_FS_NOT_FOUND):
253 raise 244 raise
254 raise BadPatchApply('previous revision does not exist') 245 raise BadPatchApply('previous revision does not exist')
255 if '\0' in d: 246 if '\0' in d:
256 raise BadPatchApply('binary diffs are not supported') 247 raise BadPatchApply('binary diffs are not supported')
257 files_data = {} 248 files_data = {}
608 try: 599 try:
609 files_touched, filectxfn2 = stupid_diff_branchrev( 600 files_touched, filectxfn2 = stupid_diff_branchrev(
610 ui, svn, hg_editor, b, r, parentctx) 601 ui, svn, hg_editor, b, r, parentctx)
611 except BadPatchApply, e: 602 except BadPatchApply, e:
612 # Either this revision or the previous one does not exist. 603 # Either this revision or the previous one does not exist.
613 ui.status("fetching entire rev: %s.\n" % e.message) 604 ui.status("Fetching entire revision: %s.\n" % e.args[0])
614 files_touched, filectxfn2 = stupid_fetch_branchrev( 605 files_touched, filectxfn2 = stupid_fetch_branchrev(
615 svn, hg_editor, b, branches[b], r, parentctx) 606 svn, hg_editor, b, branches[b], r, parentctx)
616 607
617 externals = stupid_fetch_externals(svn, branches[b], r, parentctx) 608 externals = stupid_fetch_externals(svn, branches[b], r, parentctx)
618 if externals is not None: 609 if externals is not None: