Mercurial > hgsubversion
changeset 1023:7a262ecae4f3
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.
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Tue, 18 Jun 2013 17:47:37 -0700 |
parents | 1c9b1d0e0ba3 |
children | 8feff33e387d |
files | hgsubversion/svnwrap/svn_swig_wrapper.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 '''