def _get_branch_opts(branch, local_branch, all_local_branches, desired_upstream, git_ver=None):
 if ((branch is not None) and (branch not in all_local_branches)):
  return None
 if (git_ver is None):
  git_ver = _LooseVersion(__salt__['git.version'](versioninfo=False))
 ret = []
 if (git_ver >= _LooseVersion('1.8.0')):
  ret.extend(['--set-upstream-to', desired_upstream])
 else:
  ret.append('--set-upstream')
  ret.append((local_branch if (branch is None) else branch))
  ret.append(desired_upstream)
 return ret

def _get_branch_opts ( branch , local_branch , all_local_branches , desired_upstream , git_ver = None ) : if ( ( branch is not None ) and ( branch not in all_local_branches ) ) : return None if ( git_ver is None ) : git_ver = _LooseVersion ( __salt__ [ 'git.version' ] ( versioninfo = False ) ) ret = [ ] if ( git_ver >= _LooseVersion ( '1.8.0' ) ) : ret . extend ( [ '--set-upstream-to' , desired_upstream ] ) else : ret . append ( '--set-upstream' ) ret . append ( ( local_branch if ( branch is None ) else branch ) ) ret . append ( desired_upstream ) return ret
dry helper to build list of opts for git .