changeset 6848:59c40c60d8d8

convert: remove leading slash from ra.check_path inputs (issue 1236)
author Patrick Mezard <pmezard@gmail.com>
date Fri, 25 Jul 2008 20:43:41 +0200
parents 9d6d1fdb7d72
children 1a9577da9d02 c6bb8fae3bd2
files hgext/convert/subversion.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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"