#NEWLINE# def split_rev_name( name ) : #NEWLINE# #INDENT# "\n      Split a revision name into a ref name and suffix.\n\n      The suffix starts at the first '^' or '~' character.  These characters\n      may not be part of a ref name.  See git-rev-parse(1) for full details.\n\n      For example:\n          split_ref_name('HEAD^^') --> ('HEAD', '^^')\n          split_ref_name('HEAD~10') --> ('HEAD', '~')\n          split_ref_name('master') --> ('master', '')\n          split_ref_name('master^{1}') --> ('master', '^{1}')\n    " #NEWLINE# if ( name . find ( '..' ) > 0 ) : #NEWLINE# #INDENT# raise BadRevisionNameError ( name , 'specifies a commit range, not a single commit' ) #NEWLINE# #UNINDENT# caret_idx = name . find ( '^' ) #NEWLINE# tilde_idx = name . find ( '~' ) #NEWLINE# if ( caret_idx < 0 ) : #NEWLINE# #INDENT# if ( tilde_idx < 0 ) : #NEWLINE# #INDENT# return ( name , '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# idx = tilde_idx #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( tilde_idx < 0 ) : #NEWLINE# #INDENT# idx = caret_idx #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# idx = min ( caret_idx , tilde_idx ) #NEWLINE# #UNINDENT# #UNINDENT# return ( name [ : idx ] , name [ idx : ] )