# HG changeset patch # User Bryan O'Sullivan # Date 1360029485 28800 # Node ID c8cb06e1f3233c2f8a072faed1474bac17321590 # Parent 2c87bdc43d3ca540b9912a462f2b899a79daabda buildmeta: do not contact svn unless needed We read uuid and subdir information from local metadata if available. Only if they do not exist do we need to construct an svnremoterepo object. diff --git a/hgsubversion/svncommands.py b/hgsubversion/svncommands.py --- a/hgsubversion/svncommands.py +++ b/hgsubversion/svncommands.py @@ -67,14 +67,20 @@ def _buildmeta(ui, repo, args, partial=F raise hgutil.Abort('rebuildmeta takes 1 or no arguments') url = repo.ui.expandpath(dest or repo.ui.config('paths', 'default-push') or repo.ui.config('paths', 'default') or '') - svn = svnrepo.svnremoterepo(ui, url).svn - subdir = svn.subdir svnmetadir = os.path.join(repo.path, 'svn') if not os.path.exists(svnmetadir): os.makedirs(svnmetadir) uuidpath = os.path.join(svnmetadir, 'uuid') uuid = read_if_exists(uuidpath) + subdirpath = os.path.join(svnmetadir, 'subdir') + subdir = read_if_exists(subdirpath) + svn = None + if subdir is None: + svn = svnrepo.svnremoterepo(ui, url).svn + subdir = svn.subdir + open(subdirpath, 'wb').write(subdir.strip('/')) + youngest = 0 startrev = 0 sofar = [] @@ -120,8 +126,6 @@ def _buildmeta(ui, repo, args, partial=F numrevs = len(repo) - startrev - write_if_needed(os.path.join(svnmetadir, 'subdir'), subdir.strip('/')) - # ctx.children() visits all revisions in the repository after ctx. Calling # it would make us use O(revisions^2) time, so we perform an extra traversal # of the repository instead. During this traversal, we find all converted @@ -205,6 +209,8 @@ def _buildmeta(ui, repo, args, partial=F if uuid is None: uuid = convinfo[4:40] if not skipuuid: + if svn is None: + svn = svnrepo.svnremoterepo(ui, url).svn if uuid != svn.uuid: raise hgutil.Abort('remote svn repository identifier ' 'does not match')