diff hgsubversion/svnwrap/svn_swig_wrapper.py @ 499:1fd3cfa47c5e

Support for single-directory clones.
author Augie Fackler <durin42@gmail.com>
date Fri, 16 Oct 2009 23:33:41 -0400
parents b71507d7becc
children 925ff8c5989c
line wrap: on
line diff
--- a/hgsubversion/svnwrap/svn_swig_wrapper.py
+++ b/hgsubversion/svnwrap/svn_swig_wrapper.py
@@ -345,7 +345,8 @@ class SubversionRepo(object):
           dir: the directory to list, no leading slash
           rev: the revision at which to list the directory, defaults to HEAD
         """
-        if dir[-1] == '/':
+        # TODO this should just not accept leading slashes like the docstring says
+        if dir and dir[-1] == '/':
             dir = dir[:-1]
         if revision is None:
             revision = self.HEAD
@@ -555,6 +556,7 @@ class SubversionRepo(object):
         otherwise. If the file does not exist at this revision, raise
         IOError.
         """
+        assert not path.startswith('/')
         mode = ''
         try:
             out = cStringIO.StringIO()
@@ -633,7 +635,9 @@ class SubversionRepo(object):
     def path2url(self, path):
         """Build svn URL for path, URL-escaping path.
         """
-        assert path[0] != '/'
+        if not path or path == '.':
+            return self.svn_url
+        assert path[0] != '/', path
         return '/'.join((self.svn_url,
                          urllib.quote(path).rstrip('/'),
                          ))