convert: remove leading slash from ra.check_path inputs (issue 1236)
authorPatrick Mezard <pmezard@gmail.com>
Fri, 25 Jul 2008 20:43:41 +0200
changeset 6848 59c40c60d8d8
parent 6847 9d6d1fdb7d72
child 6849 1a9577da9d02
child 6850 c6bb8fae3bd2
convert: remove leading slash from ra.check_path inputs (issue 1236)
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Fri Jul 25 20:37:41 2008 +0200
+++ b/hgext/convert/subversion.py	Fri Jul 25 20:43:41 2008 +0200
@@ -251,7 +251,7 @@
     def getheads(self):
 
         def isdir(path, revnum):
-            kind = svn.ra.check_path(self.ra, path, revnum)
+            kind = self._checkpath(path, revnum)
             return kind == svn.core.svn_node_dir
 
         def getcfgpath(name, rev):
@@ -559,7 +559,7 @@
             entrypath = self.getrelpath(path)
             entry = entrypath.decode(self.encoding)
 
-            kind = svn.ra.check_path(self.ra, entrypath, revnum)
+            kind = self._checkpath(entrypath, revnum)
             if kind == svn.core.svn_node_file:
                 entries.append(self.recode(entry))
                 if not ent.copyfrom_path or not parents:
@@ -678,7 +678,7 @@
                     # print child, self.module, entrypath
                     if entrypath:
                         # Need to filter out directories here...
-                        kind = svn.ra.check_path(self.ra, entrypath, revnum)
+                        kind = self._checkpath(entrypath, revnum)
                         if kind != svn.core.svn_node_dir:
                             entries.append(self.recode(entrypath))
 
@@ -907,6 +907,11 @@
         self.ui.debug('%r is not under %r, ignoring\n' % (path, module))
         return None
 
+    def _checkpath(self, path, revnum):
+        # ra.check_path does not like leading slashes very much, it leads
+        # to PROPFIND subversion errors
+        return svn.ra.check_path(self.ra, path.strip('/'), revnum)
+
 pre_revprop_change = '''#!/bin/sh
 
 REPOS="$1"