def tracked_branch(branch=None, config=None):
 if (config is None):
  config = gitcfg.current()
 if (branch is None):
  branch = current_branch()
 if (branch is None):
  return None
 remote = config.get((u'branch.%s.remote' % branch))
 if (not remote):
  return None
 merge_ref = config.get((u'branch.%s.merge' % branch))
 if (not merge_ref):
  return None
 refs_heads = u'refs/heads/'
 if merge_ref.startswith(refs_heads):
  return ((remote + u'/') + merge_ref[len(refs_heads):])
 return None

def tracked_branch ( branch = None , config = None ) : if ( config is None ) : config = gitcfg . current ( ) if ( branch is None ) : branch = current_branch ( ) if ( branch is None ) : return None remote = config . get ( ( u'branch.%s.remote' % branch ) ) if ( not remote ) : return None merge_ref = config . get ( ( u'branch.%s.merge' % branch ) ) if ( not merge_ref ) : return None refs_heads = u'refs/heads/' if merge_ref . startswith ( refs_heads ) : return ( ( remote + u'/' ) + merge_ref [ len ( refs_heads ) : ] ) return None
return the remote branch associated with branch .