changeset 5010:6b2d8caf87b2

convert svn: try to extract URL from source if it is a working directory
author Brendan Cully <brendan@kublai.com>
date Thu, 26 Jul 2007 10:57:26 -0700
parents 30570c2f576f
children 780051cca03c
files hgext/convert/subversion.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Thu Jul 26 10:43:01 2007 -0700
+++ b/hgext/convert/subversion.py	Thu Jul 26 10:57:26 2007 -0700
@@ -28,15 +28,21 @@
 
 try:
     from svn.core import SubversionException, Pool
+    import svn
+    import svn.client
     import svn.core
     import svn.ra
     import svn.delta
-    import svn
     import transport
 except ImportError:
     pass
 
 def geturl(path):
+    try:
+        #extract URL from working directory
+        return svn.client.url_from_path(path)
+    except SubversionException:
+        pass
     if os.path.isdir(path):
         return 'file://%s' % os.path.normpath(os.path.abspath(path))
     return path
@@ -92,7 +98,7 @@
             self.files = {}
             self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding)
         except SubversionException, e:
-            raise NoRepo("couldn't open SVN repo %s" % url)
+            raise NoRepo("couldn't open SVN repo %s" % self.url)
 
         try:
             self.get_blacklist()