hgext/convert/subversion.py
changeset 25660 328739ea70c3
parent 24856 5c1364b7e5ac
child 25748 baea47cafe75
equal deleted inserted replaced
25659:d60678a567a9 25660:328739ea70c3
   124                        strict_node_history,
   124                        strict_node_history,
   125                        receiver)
   125                        receiver)
   126     except IOError:
   126     except IOError:
   127         # Caller may interrupt the iteration
   127         # Caller may interrupt the iteration
   128         pickle.dump(None, fp, protocol)
   128         pickle.dump(None, fp, protocol)
   129     except Exception, inst:
   129     except Exception as inst:
   130         pickle.dump(str(inst), fp, protocol)
   130         pickle.dump(str(inst), fp, protocol)
   131     else:
   131     else:
   132         pickle.dump(None, fp, protocol)
   132         pickle.dump(None, fp, protocol)
   133     fp.close()
   133     fp.close()
   134     # With large history, cleanup process goes crazy and suddenly
   134     # With large history, cleanup process goes crazy and suddenly
   214 def httpcheck(ui, path, proto):
   214 def httpcheck(ui, path, proto):
   215     try:
   215     try:
   216         opener = urllib2.build_opener()
   216         opener = urllib2.build_opener()
   217         rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path))
   217         rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path))
   218         data = rsp.read()
   218         data = rsp.read()
   219     except urllib2.HTTPError, inst:
   219     except urllib2.HTTPError as inst:
   220         if inst.code != 404:
   220         if inst.code != 404:
   221             # Except for 404 we cannot know for sure this is not an svn repo
   221             # Except for 404 we cannot know for sure this is not an svn repo
   222             ui.warn(_('svn: cannot probe remote repository, assume it could '
   222             ui.warn(_('svn: cannot probe remote repository, assume it could '
   223                       'be a subversion repository. Use --source-type if you '
   223                       'be a subversion repository. Use --source-type if you '
   224                       'know better.\n'))
   224                       'know better.\n'))
   942                         latest = self.latest(self.module, firstrevnum - 1)
   942                         latest = self.latest(self.module, firstrevnum - 1)
   943                         if latest:
   943                         if latest:
   944                             firstcset.parents.append(latest)
   944                             firstcset.parents.append(latest)
   945                 except SvnPathNotFound:
   945                 except SvnPathNotFound:
   946                     pass
   946                     pass
   947         except SubversionException, (inst, num):
   947         except SubversionException as xxx_todo_changeme:
       
   948             (inst, num) = xxx_todo_changeme.args
   948             if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
   949             if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
   949                 raise util.Abort(_('svn: branch has no revision %s')
   950                 raise util.Abort(_('svn: branch has no revision %s')
   950                                  % to_revnum)
   951                                  % to_revnum)
   951             raise
   952             raise
   952 
   953 
   968             io.close()
   969             io.close()
   969             if isinstance(info, list):
   970             if isinstance(info, list):
   970                 info = info[-1]
   971                 info = info[-1]
   971             mode = ("svn:executable" in info) and 'x' or ''
   972             mode = ("svn:executable" in info) and 'x' or ''
   972             mode = ("svn:special" in info) and 'l' or mode
   973             mode = ("svn:special" in info) and 'l' or mode
   973         except SubversionException, e:
   974         except SubversionException as e:
   974             notfound = (svn.core.SVN_ERR_FS_NOT_FOUND,
   975             notfound = (svn.core.SVN_ERR_FS_NOT_FOUND,
   975                 svn.core.SVN_ERR_RA_DAV_PATH_NOT_FOUND)
   976                 svn.core.SVN_ERR_RA_DAV_PATH_NOT_FOUND)
   976             if e.apr_err in notfound: # File not found
   977             if e.apr_err in notfound: # File not found
   977                 return None, None
   978                 return None, None
   978             raise
   979             raise