#NEWLINE# def checklock( pth ) : #NEWLINE# #INDENT# 'Check if file is locked.' #NEWLINE# lock_msg = '' #NEWLINE# lock_type = NO_LOCK #NEWLINE# lock_token = None #NEWLINE# last_token = None #NEWLINE# url = geturl ( pth ) #NEWLINE# for obj in [ pth , url ] : #NEWLINE# #INDENT# output = info ( pth ) #NEWLINE# search_targets = [ 'owner' , 'created' , 'token' ] #NEWLINE# keys = searchinfo ( output , * search_targets ) #NEWLINE# owner = keys . get ( search_targets [ 0 ] ) #NEWLINE# when = keys . get ( search_targets [ 1 ] ) #NEWLINE# lock_token = keys . get ( search_targets [ 2 ] ) #NEWLINE# if ( owner is not None ) : #NEWLINE# #INDENT# msg = ( "SVN (checklock): %s was locked by '%s' at %s" % ( pth , owner , when ) ) #NEWLINE# if ( obj == pth ) : #NEWLINE# #INDENT# lock_type = ORPHAN_LOCK #NEWLINE# last_token = lock_token #NEWLINE# lock_token = None #NEWLINE# lock_msg = ( msg + ' : BAD LOCK' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( obj == url ) and ( last_token is not None ) and ( obj == lock_token ) ) : #NEWLINE# #INDENT# lock_type = LOCAL_LOCK #NEWLINE# lock_msg = ( msg + ' : LOCAL LOCK' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( obj == url ) and ( last_token is None ) ) : #NEWLINE# #INDENT# lock_type = REMOTE_LOCK #NEWLINE# lock_msg = ( msg + ' : REMOTE LOCK' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return ( lock_msg , lock_type )