#NEWLINE# def _doClone( self , source , cloneSource , branch , repo , dbLog ) : #NEWLINE# #INDENT# args = ( 'git' , 'ls-remote' , cloneSource , branch ) #NEWLINE# output = check_output ( args , cwd = repo , stderr = DEVNULL ) #NEWLINE# if ( len ( output ) == 0 ) : #NEWLINE# #INDENT# syslog ( LOG_WARNING , ( "No branch '%s' in '%s'" % ( branch , source ) ) ) #NEWLINE# return [ ] #NEWLINE# #UNINDENT# gitVersOut = check_output ( ( 'git' , '--version' ) , stderr = DEVNULL ) . decode ( 'utf-8' ) #NEWLINE# if ( gitVersOut [ : 12 ] == 'git version ' ) : #NEWLINE# #INDENT# gitVers = LooseVersion ( gitVersOut [ 12 : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# gitVers = LooseVersion ( '0' ) #NEWLINE# #UNINDENT# if ( ( len ( dbLog ) == 0 ) or ( gitVers < LooseVersion ( '1.9' ) ) ) : #NEWLINE# #INDENT# depth = None #NEWLINE# args = ( 'git' , 'clone' , '-q' , '-b' , branch , cloneSource , repo ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# output = output . decode ( 'utf-8' ) #NEWLINE# if ( output [ : 40 ] == dbLog [ ( - 1 ) ] . hash ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# depth = 5 #NEWLINE# args = ( 'git' , 'clone' , '-q' , '--depth' , str ( depth ) , '-b' , branch , cloneSource , repo ) #NEWLINE# #UNINDENT# lastGitLogLen = 0 #NEWLINE# while True : #NEWLINE# #INDENT# check_call ( args , cwd = repo , stdout = DEVNULL , stderr = DEVNULL ) #NEWLINE# try : #NEWLINE# #INDENT# return self . _catchUp ( repo , branch , dbLog , source , lastGitLogLen ) #NEWLINE# #UNINDENT# except NewCommitsNotReachedError as e : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# lastGitLogLen = e . gitLogLen #NEWLINE# depth += 10 #NEWLINE# args = ( 'git' , 'fetch' , '--depth' , str ( depth ) ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# return self . _catchUp ( repo , branch , [ ] , source , lastGitLogLen )