diff hgext/convert/subversion.py @ 20420:62153c5d1ce2

convert: secret config option for disabling debugsvnlog Subversion issues involving svn log such as d54467c1a198 can be tricky to debug when it is run in an 'hg debugsvnlog' sub process. Debugging is simpler when convert only uses one process. With this change convert will invoke the svn log directly when setting [convert] svn.debugsvnlog = False This is intentionally not documented.
author Mads Kiilerich <madski@unity3d.com>
date Fri, 07 Feb 2014 17:29:37 +0100
parents e61a8395c3c1
children 5236c7a72a2d
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Fri Feb 07 17:28:37 2014 +0100
+++ b/hgext/convert/subversion.py	Fri Feb 07 17:29:37 2014 +0100
@@ -174,6 +174,30 @@
             self._stdout.close()
             self._stdout = None
 
+class directlogstream(list):
+    """Direct revision log iterator.
+    This can be used for debugging and development but it will probably leak
+    memory and is not suitable for real conversions."""
+    def __init__(self, url, paths, start, end, limit=0,
+                  discover_changed_paths=True, strict_node_history=False):
+
+        def receiver(orig_paths, revnum, author, date, message, pool):
+            paths = {}
+            if orig_paths is not None:
+                for k, v in orig_paths.iteritems():
+                    paths[k] = changedpath(v)
+            self.append((paths, revnum, author, date, message))
+
+        # Use an ra of our own so that our parent can consume
+        # our results without confusing the server.
+        t = transport.SvnRaTransport(url=url)
+        svn.ra.get_log(t.ra, paths, start, end, limit,
+                       discover_changed_paths,
+                       strict_node_history,
+                       receiver)
+
+    def close(self):
+        pass
 
 # Check to see if the given path is a local Subversion repo. Verify this by
 # looking for several svn-specific files and directories in the given
@@ -992,6 +1016,9 @@
             relpaths.append(p.strip('/'))
         args = [self.baseurl, relpaths, start, end, limit,
                 discover_changed_paths, strict_node_history]
+        # undocumented feature: debugsvnlog can be disabled
+        if not self.ui.configbool('convert', 'svn.debugsvnlog', True):
+            return directlogstream(*args)
         arg = encodeargs(args)
         hgexe = util.hgexecutable()
         cmd = '%s debugsvnlog' % util.shellquote(hgexe)