Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 3b64796

extend svn api

Comments (0)

Files changed (1)

anyvc/subversion/repo.py

 from subvertpy.ra import (
     RemoteAccess, Auth,
     get_username_provider,
+    SubversionException,
 )
 from anyvc.common.repository import Repository, Revision, join
 from anyvc.common.commit_builder import CommitBuilder
             raise IOError('%r not found' % path)
 
     def path_info(self, path):
-        return self.repo.ra.check_path(path, self.id)
+        return self.repo.ra.check_path(path.lstrip('/'), self.id)
 
     def exists(self, path):
-        kind = self.path_info(path.lstrip('/'))
+        kind = self.path_info(path)
         return kind in (subvertpy.NODE_FILE, subvertpy.NODE_DIR)
 
+    def isfile(self, path):
+        kind = self.path_info(path)
+        return kind == subvertpy.NODE_FILE
+
+    def isdir(self, path):
+        kind = self.path_info(path)
+        return kind == subvertpy.NODE_DIR
+
     def prop(self, name):
         return self.repo.ra.rev_proplist(self.id).get(name)
 
             file = root.add_file(target, join(self.repo.url, src), 1)
             file.close()
             root.delete_entry(src)
-        
+
         def add_file(file):
             parts = file.split('/')
             for i in range(1, len(parts)):
                 try:
                     root.add_directory('/'.join(parts[:i])).close()
-                except Exception as e:
+                except SubversionException as e:
                     pass
+                if e.args[-1] != 160020:
+                    raise
             try:
                 return root.add_file(file)
-            except Exception as e:
-                print e
+            except SubversionException as e:
+                if e.args[-1] != 160020:
+                    raise
                 return root.open_file(file)
 
         for file in self.contents:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.