##// END OF EJS Templates
convert: fix relative import of stdlib module in subversion...
FUJIWARA Katsunori -
r28460:d6dbb096 default
parent child Browse files
Show More
@@ -43,10 +43,6 b' NoRepo = common.NoRepo'
43 # these bindings.
43 # these bindings.
44
44
45 try:
45 try:
46 from svn.core import (
47 Pool,
48 SubversionException,
49 )
50 import svn
46 import svn
51 import svn.client
47 import svn.client
52 import svn.core
48 import svn.core
@@ -57,6 +53,7 b' try:'
57 warnings.filterwarnings('ignore',
53 warnings.filterwarnings('ignore',
58 module='svn.core',
54 module='svn.core',
59 category=DeprecationWarning)
55 category=DeprecationWarning)
56 svn.core.SubversionException # trigger import to catch error
60
57
61 except ImportError:
58 except ImportError:
62 svn = None
59 svn = None
@@ -103,7 +100,7 b' def quote(s):'
103 def geturl(path):
100 def geturl(path):
104 try:
101 try:
105 return svn.client.url_from_path(svn.core.svn_path_canonicalize(path))
102 return svn.client.url_from_path(svn.core.svn_path_canonicalize(path))
106 except SubversionException:
103 except svn.core.SubversionException:
107 # svn.client.url_from_path() fails with local repositories
104 # svn.client.url_from_path() fails with local repositories
108 pass
105 pass
109 if os.path.isdir(path):
106 if os.path.isdir(path):
@@ -340,7 +337,7 b' class svn_source(converter_source):'
340 self.commits = {}
337 self.commits = {}
341 self.paths = {}
338 self.paths = {}
342 self.uuid = svn.ra.get_uuid(self.ra)
339 self.uuid = svn.ra.get_uuid(self.ra)
343 except SubversionException:
340 except svn.core.SubversionException:
344 ui.traceback()
341 ui.traceback()
345 svnversion = '%d.%d.%d' % (svn.core.SVN_VER_MAJOR,
342 svnversion = '%d.%d.%d' % (svn.core.SVN_VER_MAJOR,
346 svn.core.SVN_VER_MINOR,
343 svn.core.SVN_VER_MINOR,
@@ -401,7 +398,7 b' class svn_source(converter_source):'
401 svn.client.ls(self.url.rstrip('/') + '/' + quote(path),
398 svn.client.ls(self.url.rstrip('/') + '/' + quote(path),
402 optrev, False, self.ctx)
399 optrev, False, self.ctx)
403 return True
400 return True
404 except SubversionException:
401 except svn.core.SubversionException:
405 return False
402 return False
406
403
407 def getheads(self):
404 def getheads(self):
@@ -700,7 +697,7 b' class svn_source(converter_source):'
700 prevmodule = self.reparent('')
697 prevmodule = self.reparent('')
701 dirent = svn.ra.stat(self.ra, path.strip('/'), stop)
698 dirent = svn.ra.stat(self.ra, path.strip('/'), stop)
702 self.reparent(prevmodule)
699 self.reparent(prevmodule)
703 except SubversionException:
700 except svn.core.SubversionException:
704 dirent = None
701 dirent = None
705 if not dirent:
702 if not dirent:
706 raise SvnPathNotFound(_('%s not found up to revision %d')
703 raise SvnPathNotFound(_('%s not found up to revision %d')
@@ -972,7 +969,7 b' class svn_source(converter_source):'
972 firstcset.parents.append(latest)
969 firstcset.parents.append(latest)
973 except SvnPathNotFound:
970 except SvnPathNotFound:
974 pass
971 pass
975 except SubversionException as xxx_todo_changeme:
972 except svn.core.SubversionException as xxx_todo_changeme:
976 (inst, num) = xxx_todo_changeme.args
973 (inst, num) = xxx_todo_changeme.args
977 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
974 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
978 raise error.Abort(_('svn: branch has no revision %s')
975 raise error.Abort(_('svn: branch has no revision %s')
@@ -999,7 +996,7 b' class svn_source(converter_source):'
999 info = info[-1]
996 info = info[-1]
1000 mode = ("svn:executable" in info) and 'x' or ''
997 mode = ("svn:executable" in info) and 'x' or ''
1001 mode = ("svn:special" in info) and 'l' or mode
998 mode = ("svn:special" in info) and 'l' or mode
1002 except SubversionException as e:
999 except svn.core.SubversionException as e:
1003 notfound = (svn.core.SVN_ERR_FS_NOT_FOUND,
1000 notfound = (svn.core.SVN_ERR_FS_NOT_FOUND,
1004 svn.core.SVN_ERR_RA_DAV_PATH_NOT_FOUND)
1001 svn.core.SVN_ERR_RA_DAV_PATH_NOT_FOUND)
1005 if e.apr_err in notfound: # File not found
1002 if e.apr_err in notfound: # File not found
@@ -1014,7 +1011,7 b' class svn_source(converter_source):'
1014 def _iterfiles(self, path, revnum):
1011 def _iterfiles(self, path, revnum):
1015 """Enumerate all files in path at revnum, recursively."""
1012 """Enumerate all files in path at revnum, recursively."""
1016 path = path.strip('/')
1013 path = path.strip('/')
1017 pool = Pool()
1014 pool = svn.core.Pool()
1018 rpath = '/'.join([self.baseurl, quote(path)]).strip('/')
1015 rpath = '/'.join([self.baseurl, quote(path)]).strip('/')
1019 entries = svn.client.ls(rpath, optrev(revnum), True, self.ctx, pool)
1016 entries = svn.client.ls(rpath, optrev(revnum), True, self.ctx, pool)
1020 if path:
1017 if path:
General Comments 0
You need to be logged in to leave comments. Login now