diff fetch_command.py @ 225:2117cb0118fe

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 2165461d2dd8
children f71af18c4379 4aba7542f6a9
line wrap: on
line diff
--- a/fetch_command.py
+++ b/fetch_command.py
@@ -55,11 +55,10 @@ def fetch_revisions(ui, svn_url, hg_repo
     if os.path.exists(hg_editor.uuid_file):
         uuid = open(hg_editor.uuid_file).read()
         assert uuid == svn.uuid
-        start = int(open(hg_editor.last_revision_handled_file, 'r').read())
+        start = hg_editor.last_known_revision()
     else:
         open(hg_editor.uuid_file, 'w').write(svn.uuid)
         open(hg_editor.svn_url_file, 'w').write(svn_url)
-        open(hg_editor.last_revision_handled_file, 'w').write(str(0))
         initializing_repo = True
         start = skipto_rev
 
@@ -93,12 +92,6 @@ def fetch_revisions(ui, svn_url, hg_repo
                     else:
                         stupid_svn_server_pull_rev(ui, svn, hg_editor, r)
                     converted = True
-                    tmpfile = '%s_tmp' % hg_editor.last_revision_handled_file
-                    fp = open(tmpfile, 'w')
-                    fp.write(str(r.revnum))
-                    fp.close()
-                    merc_util.rename(tmpfile,
-                                     hg_editor.last_revision_handled_file)
                 except core.SubversionException, e: #pragma: no cover
                     if e.apr_err == core.SVN_ERR_RA_DAV_REQUEST_FAILED:
                         tries += 1