David Schleimer committed 7a262ec

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.

  • Participants
  • Parent commits 1c9b1d0

Comments (0)

Files changed (1)

File hgsubversion/svnwrap/

                 sf = f[l:]
                 if links[f] or execs[f]:
-                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 '''