hgext/convert/subversion.py
changeset 28460 d6dbb0968c13
parent 28459 3ea62e748a18
child 28471 f106913c6a4e
--- a/hgext/convert/subversion.py	Fri Mar 11 21:55:44 2016 +0900
+++ b/hgext/convert/subversion.py	Fri Mar 11 21:55:44 2016 +0900
@@ -43,10 +43,6 @@
 # these bindings.
 
 try:
-    from svn.core import (
-        Pool,
-        SubversionException,
-    )
     import svn
     import svn.client
     import svn.core
@@ -57,6 +53,7 @@
     warnings.filterwarnings('ignore',
             module='svn.core',
             category=DeprecationWarning)
+    svn.core.SubversionException # trigger import to catch error
 
 except ImportError:
     svn = None
@@ -103,7 +100,7 @@
 def geturl(path):
     try:
         return svn.client.url_from_path(svn.core.svn_path_canonicalize(path))
-    except SubversionException:
+    except svn.core.SubversionException:
         # svn.client.url_from_path() fails with local repositories
         pass
     if os.path.isdir(path):
@@ -340,7 +337,7 @@
             self.commits = {}
             self.paths = {}
             self.uuid = svn.ra.get_uuid(self.ra)
-        except SubversionException:
+        except svn.core.SubversionException:
             ui.traceback()
             svnversion = '%d.%d.%d' % (svn.core.SVN_VER_MAJOR,
                                        svn.core.SVN_VER_MINOR,
@@ -401,7 +398,7 @@
             svn.client.ls(self.url.rstrip('/') + '/' + quote(path),
                                  optrev, False, self.ctx)
             return True
-        except SubversionException:
+        except svn.core.SubversionException:
             return False
 
     def getheads(self):
@@ -700,7 +697,7 @@
             prevmodule = self.reparent('')
             dirent = svn.ra.stat(self.ra, path.strip('/'), stop)
             self.reparent(prevmodule)
-        except SubversionException:
+        except svn.core.SubversionException:
             dirent = None
         if not dirent:
             raise SvnPathNotFound(_('%s not found up to revision %d')
@@ -972,7 +969,7 @@
                             firstcset.parents.append(latest)
                 except SvnPathNotFound:
                     pass
-        except SubversionException as xxx_todo_changeme:
+        except svn.core.SubversionException as xxx_todo_changeme:
             (inst, num) = xxx_todo_changeme.args
             if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
                 raise error.Abort(_('svn: branch has no revision %s')
@@ -999,7 +996,7 @@
                 info = info[-1]
             mode = ("svn:executable" in info) and 'x' or ''
             mode = ("svn:special" in info) and 'l' or mode
-        except SubversionException as e:
+        except svn.core.SubversionException as e:
             notfound = (svn.core.SVN_ERR_FS_NOT_FOUND,
                 svn.core.SVN_ERR_RA_DAV_PATH_NOT_FOUND)
             if e.apr_err in notfound: # File not found
@@ -1014,7 +1011,7 @@
     def _iterfiles(self, path, revnum):
         """Enumerate all files in path at revnum, recursively."""
         path = path.strip('/')
-        pool = Pool()
+        pool = svn.core.Pool()
         rpath = '/'.join([self.baseurl, quote(path)]).strip('/')
         entries = svn.client.ls(rpath, optrev(revnum), True, self.ctx, pool)
         if path: