Mercurial > hgsubversion
comparison fetch_command.py @ 296:9be04de434ed
Get rid of .hg/svn/last_rev:
We now calculate the last known revision by iterating over all known
revisions and finding the highest number. Theoretically, we might be
able to simply read the latest entry, but in practice, that's a bug
waiting to happen. For instance, we might want to achieve
compatibility with '.hg/shamap' as generated by the
ConvertExtension, and it not only cannot offer a guarantee of
linearity, but it also allows more than one conversion to source exists.
I'd say we have other problems to care about until this turns up as a
hotspot in profiling. Such as why we leak circa 100MB of memory per
1000 revisions converted ;)
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 27 Mar 2009 01:09:36 +0100 |
parents | fa26c7ef0180 |
children | f71af18c4379 4aba7542f6a9 |
comparison
equal
deleted
inserted
replaced
295:aacc8cf83e13 | 296:9be04de434ed |
---|---|
53 authors=authors, | 53 authors=authors, |
54 filemap=filemap) | 54 filemap=filemap) |
55 if os.path.exists(hg_editor.uuid_file): | 55 if os.path.exists(hg_editor.uuid_file): |
56 uuid = open(hg_editor.uuid_file).read() | 56 uuid = open(hg_editor.uuid_file).read() |
57 assert uuid == svn.uuid | 57 assert uuid == svn.uuid |
58 start = int(open(hg_editor.last_revision_handled_file, 'r').read()) | 58 start = hg_editor.last_known_revision() |
59 else: | 59 else: |
60 open(hg_editor.uuid_file, 'w').write(svn.uuid) | 60 open(hg_editor.uuid_file, 'w').write(svn.uuid) |
61 open(hg_editor.svn_url_file, 'w').write(svn_url) | 61 open(hg_editor.svn_url_file, 'w').write(svn_url) |
62 open(hg_editor.last_revision_handled_file, 'w').write(str(0)) | |
63 initializing_repo = True | 62 initializing_repo = True |
64 start = skipto_rev | 63 start = skipto_rev |
65 | 64 |
66 if initializing_repo and start > 0: | 65 if initializing_repo and start > 0: |
67 raise merc_util.Abort('Revision skipping at repository initialization ' | 66 raise merc_util.Abort('Revision skipping at repository initialization ' |
91 have_replay = False | 90 have_replay = False |
92 stupid_svn_server_pull_rev(ui, svn, hg_editor, r) | 91 stupid_svn_server_pull_rev(ui, svn, hg_editor, r) |
93 else: | 92 else: |
94 stupid_svn_server_pull_rev(ui, svn, hg_editor, r) | 93 stupid_svn_server_pull_rev(ui, svn, hg_editor, r) |
95 converted = True | 94 converted = True |
96 tmpfile = '%s_tmp' % hg_editor.last_revision_handled_file | |
97 fp = open(tmpfile, 'w') | |
98 fp.write(str(r.revnum)) | |
99 fp.close() | |
100 merc_util.rename(tmpfile, | |
101 hg_editor.last_revision_handled_file) | |
102 except core.SubversionException, e: #pragma: no cover | 95 except core.SubversionException, e: #pragma: no cover |
103 if e.apr_err == core.SVN_ERR_RA_DAV_REQUEST_FAILED: | 96 if e.apr_err == core.SVN_ERR_RA_DAV_REQUEST_FAILED: |
104 tries += 1 | 97 tries += 1 |
105 ui.status('Got a 502, retrying (%s)\n' % tries) | 98 ui.status('Got a 502, retrying (%s)\n' % tries) |
106 else: | 99 else: |