hgext/convert/subversion.py
changeset 7447 4fd92687f331
parent 7446 2d2e0be762be
child 7476 6644c111f9e9
equal deleted inserted replaced
7446:2d2e0be762be 7447:4fd92687f331
    30 # e.g. SVN 1.5 or backports. Thanks to the bzr folks for enhancing
    30 # e.g. SVN 1.5 or backports. Thanks to the bzr folks for enhancing
    31 # these bindings.
    31 # these bindings.
    32 
    32 
    33 from cStringIO import StringIO
    33 from cStringIO import StringIO
    34 
    34 
    35 from common import NoRepo, commit, converter_source, encodeargs, decodeargs
    35 from common import NoRepo, MissingTool, commit, encodeargs, decodeargs
    36 from common import commandline, converter_sink, mapfile
    36 from common import commandline, converter_source, converter_sink, mapfile
    37 
    37 
    38 try:
    38 try:
    39     from svn.core import SubversionException, Pool
    39     from svn.core import SubversionException, Pool
    40     import svn
    40     import svn
    41     import svn.client
    41     import svn.client
   153         super(svn_source, self).__init__(ui, url, rev=rev)
   153         super(svn_source, self).__init__(ui, url, rev=rev)
   154 
   154 
   155         try:
   155         try:
   156             SubversionException
   156             SubversionException
   157         except NameError:
   157         except NameError:
   158             raise NoRepo('Subversion python bindings could not be loaded')
   158             raise MissingTool(_('Subversion python bindings could not be loaded'))
       
   159 
       
   160         try:
       
   161             version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
       
   162             if version < (1, 4):
       
   163                 raise MissingTool(_('Subversion python bindings %d.%d found, '
       
   164                                     '1.4 or later required') % version)
       
   165         except AttributeError:
       
   166             raise MissingTool(_('Subversion python bindings are too old, 1.4 '
       
   167                                 'or later required'))
   159 
   168 
   160         self.encoding = locale.getpreferredencoding()
   169         self.encoding = locale.getpreferredencoding()
   161         self.lastrevs = {}
   170         self.lastrevs = {}
   162 
   171 
   163         latest = None
   172         latest = None