#NEWLINE# def get_repository( self , type , dir , params ) : #NEWLINE# #INDENT# 'GitRepository factory method' #NEWLINE# assert ( type == 'git' ) #NEWLINE# if ( not ( 4 <= self . shortrev_len <= 40 ) ) : #NEWLINE# #INDENT# raise TracError ( _ ( '%(option)s must be in the range [4..40]' , option = '[git] shortrev_len' ) ) #NEWLINE# #UNINDENT# if ( not ( 4 <= self . wiki_shortrev_len <= 40 ) ) : #NEWLINE# #INDENT# raise TracError ( _ ( '%(option)s must be in the range [4..40]' , option = '[git] wikishortrev_len' ) ) #NEWLINE# #UNINDENT# if ( not self . _version ) : #NEWLINE# #INDENT# raise TracError ( _ ( 'GIT backend not available' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not self . _version [ 'v_compatible' ] ) : #NEWLINE# #INDENT# raise TracError ( _ ( 'GIT version %(hasver)s installed not compatible (need >= %(needsver)s)' , hasver = self . _version [ 'v_str' ] , needsver = self . _version [ 'v_min_str' ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# if self . trac_user_rlookup : #NEWLINE# #INDENT# def rlookup_uid( email ) : #NEWLINE# #INDENT# "Reverse map 'real name <user@domain.tld>' addresses to trac\n                user ids.\n\n                :return: `None` if lookup failed\n                " #NEWLINE# try : #NEWLINE# #INDENT# ( _ , email ) = email . rsplit ( '<' , 1 ) #NEWLINE# ( email , _ ) = email . split ( '>' , 1 ) #NEWLINE# email = email . lower ( ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# for ( _uid , _name , _email ) in self . env . get_known_users ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( email == _email . lower ( ) ) : #NEWLINE# #INDENT# return _uid #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# def rlookup_uid( _ ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# repos = GitRepository ( self . env , dir , params , self . log , persistent_cache = self . persistent_cache , git_bin = self . git_bin , git_fs_encoding = self . git_fs_encoding , shortrev_len = self . shortrev_len , rlookup_uid = rlookup_uid , use_committer_id = self . use_committer_id , use_committer_time = self . use_committer_time ) #NEWLINE# if self . cached_repository : #NEWLINE# #INDENT# repos = GitCachedRepository ( self . env , repos , self . log ) #NEWLINE# self . log . debug ( "enabled CachedRepository for '%s'" , dir ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . log . debug ( "disabled CachedRepository for '%s'" , dir ) #NEWLINE# #UNINDENT# return repos