# HG changeset patch # User Mateusz Kwapich # Date 1418429831 28800 # Node ID 9e85feb9398461cee905d59040c4c3e9cf641bb1 # Parent 7bbe120be1938ec17608bfcf25f747cd7a1bc2fc wrappers: improve push performance by reusing the existing metadata Push operation for n commits regenerated SVNMeta class 2*n+1 times (one time at beginning, n times in push() loop, 1 time per each of n pulls). This operation is very costly when the revision map is big. This commit reuses this metadata every time when there is no rebase made between svn commits which leads to 1 metadata rebuild in optimistic case and n+1 metadata rebuilds in pessimistic case (rebase after every commit). To achieve this I added extra parameter to pull command to pass metadata to it. All unit tests are passing for this change. diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -261,6 +261,8 @@ def push(repo, dest, force, revs): # Don't trust the pre-rebase repo and context. repo = getlocalpeer(ui, {}, meta.path) + meta = repo.svnmeta(svn.uuid, svn.subdir) + hashes = meta.revmap.hashes() tip_ctx = repo[tip_ctx.node()] for c in tip_ctx.descendants(): rebasesrc = c.extra().get('rebase_source') @@ -289,10 +291,8 @@ def push(repo, dest, force, revs): # 5. Pull the latest changesets from subversion, which will # include the one we just committed (and possibly others). - r = pull(repo, dest, force=force) + r = pull(repo, dest, force=force, meta=meta) assert not r or r == 0 - meta = repo.svnmeta(svn.uuid, svn.subdir) - hashes = meta.revmap.hashes() # 6. Move our tip to the latest pulled tip for c in tip_ctx.descendants(): @@ -379,7 +379,7 @@ def exchangepush(orig, repo, remote, for else: return orig(repo, remote, force, revs, newbranch, bookmarks=bookmarks) -def pull(repo, source, heads=[], force=False): +def pull(repo, source, heads=[], force=False, meta=None): """pull new revisions from Subversion""" assert source.capable('subversion') svn_url = source.svnurl @@ -394,7 +394,8 @@ def pull(repo, source, heads=[], force=F repo.ui.note('fetching stupidly...\n') svn = source.svn - meta = repo.svnmeta(svn.uuid, svn.subdir) + if meta is None: + meta = repo.svnmeta(svn.uuid, svn.subdir) stopat_rev = util.parse_revnum(svn, checkout)