#NEWLINE# def _get_branch_opts( branch , local_branch , all_local_branches , desired_upstream , git_ver = None ) : #NEWLINE# #INDENT# '\n    DRY helper to build list of opts for git.branch, for the purposes of\n    setting upstream tracking branch\n    ' #NEWLINE# if ( ( local_branch is not None ) and ( branch not in all_local_branches ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( git_ver is None ) : #NEWLINE# #INDENT# git_ver = _LooseVersion ( __salt__ [ 'git.version' ] ( versioninfo = False ) ) #NEWLINE# #UNINDENT# ret = [ ] #NEWLINE# if ( git_ver >= _LooseVersion ( '1.8.0' ) ) : #NEWLINE# #INDENT# ret . extend ( [ '--set-upstream-to' , desired_upstream ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ret . append ( '--set-upstream' ) #NEWLINE# ret . append ( ( local_branch if ( branch is None ) else branch ) ) #NEWLINE# ret . append ( desired_upstream ) #NEWLINE# #UNINDENT# return ret