Ticket #6796: unsupported_vcs-r7031.diff
| File unsupported_vcs-r7031.diff, 3.9 KB (added by cboos, 7 months ago) |
|---|
-
trac/versioncontrol/api.py
34 34 class IRepositoryConnector(Interface): 35 35 """Provide support for a specific version control system.""" 36 36 37 error = None # place holder for storing relevant error message 38 37 39 def get_supported_types(): 38 40 """Return the types of version control systems that are supported. 39 41 … … 42 44 43 45 If multiple provider match a given type, the `priority` is used to 44 46 choose between them (highest number is highest priority). 47 48 If the `priority` returned is negative, this indicates that the 49 connector for the given `repotype` indeed exists but can't be 50 used for some reason. The `error` property can then be used to 51 store an error message or exception relevant to the problem detected. 45 52 """ 46 53 47 54 def get_repository(repos_type, repos_dir, authname): … … 79 86 self.get_repository(req.authname).sync() 80 87 except TracError, e: 81 88 add_warning(req, _("Can't synchronize with the repository " 82 "(%(error)s)", error=e.message)) 89 "(%(error)s). Look in the Trac log for more " 90 "information.", error=e.message)) 91 83 92 return handler 84 93 85 94 def post_process_request(self, req, template, content_type): … … 125 134 if repos_type == self.repository_type 126 135 ] 127 136 if candidates: 128 self._connector = max(candidates)[1] 137 prio, connector = max(candidates) 138 if prio < 0: # error condition 139 raise TracError( 140 _('Unsupported version control system "%(name)s"' 141 ': "%(error)s" ', name=self.repository_type, 142 error=connector.error)) 143 self._connector = connector 129 144 else: 130 145 raise TracError( 131 _('Unsupported version control system "%(name)s" .'132 'C heck that the Python support libraries for'133 ' "%(name)s" are correctly installed.',146 _('Unsupported version control system "%(name)s": ' 147 'Can\'t find an appropriate component, maybe the ' 148 'corresponding plugin was not enabled? ', 134 149 name=self.repository_type)) 135 150 tid = threading._get_ident() 136 151 if tid in self._cache: -
trac/versioncontrol/svn_fs.py
244 244 below that path will be included. 245 245 """) 246 246 247 error = None 248 247 249 def __init__(self): 248 250 self._version = None 249 251 250 252 try: 251 253 _import_svn() 252 254 self.log.debug('Subversion bindings imported') 253 except ImportError: 255 except ImportError, e: 256 self.error = e 254 257 self.log.info('Failed to load Subversion bindings', exc_info=True) 255 self.has_subversion = False256 258 else: 257 self.has_subversion = True258 259 Pool() 259 260 260 261 def get_supported_types(self): 261 if self.has_subversion: 262 yield ("direct-svnfs", 4) 263 yield ("svnfs", 4) 264 yield ("svn", 2) 262 prio = 1 263 if self.error: 264 prio = -1 265 yield ("direct-svnfs", prio*4) 266 yield ("svnfs", prio*4) 267 yield ("svn", prio*2) 265 268 266 269 def get_repository(self, type, dir, authname): 267 270 """Return a `SubversionRepository`.
