comparison tests/test_util.py @ 890:78db88de9622

Partial metadata rebuilding For highly active subversion repositories, it can be excruciatingly slow to pull updates one at a time from subversion. One way around this is to setup another mercurial repo that pulls new commits from svn periodicly (say every 5 minutes). When you want to update your repository, you can pull commits from this mercurial repository via native mercurial protocols, which will be much faster than pulling directly from svn. Unfortunately, your metadata will be out of date after doing so. Highly active repositories also tend to be very large, which means that it takes a long time to rebuild your metadata from scratch. To address this, this adds support to do a partial rebuild on the metadata by processing only revisions that have been added to the repository after the last revision we processed. With the rev map 1k revisions (~2 days) behind tip updatemeta is dramatically faster than rebuild meta: $ hg --time svn updatemeta Time: real 0.570 secs (user 0.480+0.000 sys 0.060+0.000) $ hg --time svn rebuildmeta Time: real 129.160 secs (user 128.570+0.000 sys 0.320+0.000)
author David Schleimer <dschleimer@fb.com>
date Sat, 12 May 2012 07:28:23 -0700
parents c6388ed0ec0a
children 04dfc23688b9
comparison
equal deleted inserted replaced
889:7a98fbadcae9 890:78db88de9622
197 assert cp.rstrip(os.sep) == _rootdir, ( 197 assert cp.rstrip(os.sep) == _rootdir, (
198 'Module location verification failed: hgsubversion was imported ' 198 'Module location verification failed: hgsubversion was imported '
199 'from the wrong path!' 199 'from the wrong path!'
200 ) 200 )
201 201
202 def hgclone(ui, source, dest, update=True): 202 def hgclone(ui, source, dest, update=True, rev=None):
203 if getattr(hg, 'peer', None): 203 if getattr(hg, 'peer', None):
204 # Since 1.9 (d976542986d2) 204 # Since 1.9 (d976542986d2)
205 src, dest = hg.clone(ui, {}, source, dest, update=update) 205 src, dest = hg.clone(ui, {}, source, dest, update=update, rev=rev)
206 else: 206 else:
207 src, dest = hg.clone(ui, source, dest, update=update) 207 src, dest = hg.clone(ui, source, dest, update=update, rev=rev)
208 return src, dest 208 return src, dest
209 209
210 def svnls(repo_path, path, rev='HEAD'): 210 def svnls(repo_path, path, rev='HEAD'):
211 path = repo_path + '/' + path 211 path = repo_path + '/' + path
212 path = util.normalize_url(fileurl(path)) 212 path = util.normalize_url(fileurl(path))