# HG changeset patch # User David Schleimer # Date 1371602857 25200 # Node ID 7a262ecae4f3035ade0c1b1b15dde18af9e53b37 # Parent 1c9b1d0e0ba34e28eb1c6240501e8b930560a48c svnwrap: use get_file instead of list_props during replay This patch has an enormous effect on the time taken to import commits which add many files. Specifically, it makes them much faster for pulls over the network because it avoids creating a new connection to subversion for every added file. In my testing, it dropped the time taken to import a revision that adds ~6500 files from approximately 1 hour to 30 seconds. I believe this test is representative of real-world performance improvements. diff --git a/hgsubversion/svnwrap/svn_swig_wrapper.py b/hgsubversion/svnwrap/svn_swig_wrapper.py --- a/hgsubversion/svnwrap/svn_swig_wrapper.py +++ b/hgsubversion/svnwrap/svn_swig_wrapper.py @@ -471,9 +471,14 @@ class SubversionRepo(object): sf = f[l:] if links[f] or execs[f]: continue - props = self.list_props(sf, revision) - links[f] = props.get('svn:special') == '*' - execs[f] = props.get('svn:executable') == '*' + # The list_props API creates a new connection and then + # calls get_file for the remote file case. It also + # creates a new connection to the subversion server + # every time it's called. As a result, it's actually + # *cheaper* to call get_file than list_props here + data, mode = self.get_file(sf, revision) + links[f] = mode == 'l' + execs[f] = mode == 'x' def get_revision(self, revision, editor): ''' feed the contents of the given revision to the given editor '''