convert: (svn) simplify _find_children
authorBrendan Cully <brendan@kublai.com>
Wed, 01 Aug 2007 15:16:42 -0700
changeset 5050 2bd996d0aaf8
parent 5049 41284ad94852
child 5051 e3dffbdc6522
convert: (svn) simplify _find_children
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Wed Aug 01 14:32:53 2007 -0700
+++ b/hgext/convert/subversion.py	Wed Aug 01 15:16:42 2007 -0700
@@ -46,8 +46,6 @@
         return 'file://%s' % os.path.normpath(os.path.abspath(path))
     return path
 
-class CompatibilityException(Exception): pass
-
 class changedpath(object):
     def __init__(self, p):
         self.copyfrom_path = p.copyfrom_path
@@ -626,52 +624,9 @@
         return data, mode
 
     def _find_children(self, path, revnum):
-        path = path.strip("/")
-
-        def _find_children_fallback(path, revnum):
-            # SWIG python bindings for getdir are broken up to at least 1.4.3
-            pool = Pool()
-            optrev = svn.core.svn_opt_revision_t()
-            optrev.kind = svn.core.svn_opt_revision_number
-            optrev.value.number = revnum
-            rpath = '/'.join([self.base, path]).strip('/')
-            return ['%s/%s' % (path, x) for x in svn.client.ls(rpath, optrev, True, self.ctx, pool).keys()]
-
-        if hasattr(self, '_find_children_fallback'):
-            return _find_children_fallback(path, revnum)
-
-        self.reparent("/" + path)
         pool = Pool()
-
-        children = []
-        def find_children_inner(children, path, revnum = revnum):
-            if hasattr(svn.ra, 'get_dir2'): # Since SVN 1.4
-                fields = 0xffffffff # Binding does not provide SVN_DIRENT_ALL
-                getdir = svn.ra.get_dir2(self.ra, path, revnum, fields, pool)
-            else:
-                getdir = svn.ra.get_dir(self.ra, path, revnum, pool)
-            if type(getdir) == dict:
-                # python binding for getdir is broken up to at least 1.4.3
-                raise CompatibilityException()
-            dirents = getdir[0]
-            if type(dirents) == int:
-                # got here once due to infinite recursion bug
-                return
-            c = dirents.keys()
-            c.sort()
-            for child in c:
-                dirent = dirents[child]
-                if dirent.kind == svn.core.svn_node_dir:
-                    find_children_inner(children, (path + "/" + child).strip("/"))
-                else:
-                    children.append((path + "/" + child).strip("/"))
-
-        try:
-            find_children_inner(children, "")
-        except CompatibilityException:
-            self._find_children_fallback = True
-            self.reparent(self.module)
-            return _find_children_fallback(path, revnum)
-
-        self.reparent(self.module)
-        return [path + "/" + c for c in children]
+        optrev = svn.core.svn_opt_revision_t()
+        optrev.kind = svn.core.svn_opt_revision_number
+        optrev.value.number = revnum
+        rpath = '/'.join([self.base, path.strip('/')]).strip('/')
+        return ['%s/%s' % (path, x) for x in svn.client.ls(rpath, optrev, True, self.ctx, pool).keys()]