The name of the branch that's currently checked out in the working tree (a string or :data:`None`).
489278
def current_branch(self):
        """"""
        output = self.context.capture('git', 'rev-parse', '--abbrev-ref', 'HEAD', check=False, silent=True)
        return output if output != 'HEAD' else None
1208617
def get_branches(self):
        """"""
        if self.else_branch:
            return [self.then_branch, self.else_branch]
        return [self.then_branch]
450582
def branch(self, name):
        
        json = None
        if name:
            url = self._build_url('branches', name, base_url=self._api)
            json = self._json(self._get(url), 200)
        return Branch(json, self) if json else None
1069977
def branches(self):
		
		# get all remote branches
		refs = filter(lambda l: isinstance(l, git.RemoteReference), self.repo.references)
		# filter out HEAD branch
		refs = filter(lambda l: l.name != "origin/HEAD", refs)
		# filter out all branches not starting with 'origin/'
		refs = filter(lambda l: l.name.startswith("origin/"), refs)
		for ref in refs:
			self.refs[ref.name[7:]] = ref

		# remove 'origin/' prefix
		return map(lambda l: l.name[7:], refs)
663851
def _tree_filename(self):
        
        if self.Parameters['--out']:
            aln_filename = self._absolute(self.Parameters['--out'].Value)
        else:
            raise ValueError, "No tree output file specified."
        return aln_filename
1098279
def _branch_name(cls, version):
    
    suffix = version.public[len(version.base_version):]
    components = version.base_version.split('.') + [suffix]
    if suffix == '' or suffix.startswith('rc'):
      # An un-suffixed, or suffixed-with-rc version is a release from a stable branch.
      return '{}.{}.x'.format(*components[:2])
    elif suffix.startswith('.dev'):
      # Suffixed `dev` release version in master.
      return 'master'
    else:
      raise ValueError('Unparseable pants version number: {}'.format(version))
944048
def get_branch(self, branch):
        
        assert isinstance(branch, (str, unicode)), branch
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.url + "/branches/" + branch
        )
        return github.Branch.Branch(self._requester, headers, data, completed=True)
224932
static Node getRootOfQualifiedName(Node qName) {
    for (Node current = qName; true; current = current.getFirstChild()) {
      if (current.isName() || current.isThis() || current.isSuper()) {
        return current;
      }
      checkState(current.isGetProp(), "Not a getprop node: ", current);
    }
  }
308860
def checkout(branch_name, opts = {})
      args = []
      args << '--no-track' if opts[:no_track]
      args << '-b' if opts[:new_branch]
      args << branch_name
      args << opts[:new_branch] if opts[:new_branch]
      branches = branches()
      command(:checkout, args)

      branches << GitBranch.new(branch_name, opts[:new_branch] != nil, self)

      if block_given?
        yield
        command(:checkout, branches.current.name)
        branches.current
      else
        branches[branch_name]
      end
    end
765603
def assert_on_branch(branch_name):
    # type: (str) -> None
    
    branch = git.current_branch(refresh=True)

    if branch.name != branch_name:
        if context.get('pretend', False):
            log.info("Would assert that you're on a <33>{}<32> branch",
                     branch_name)
        else:
            log.err("You're not on a <33>{}<31> branch!", branch_name)
            sys.exit(1)
89590
def checkout_branch(self, branch_name):
        
        cmd = [
            "git",
            "checkout",
            "-b",
            self.get_cherry_pick_branch(branch_name),
            f"{self.upstream}/{branch_name}",
        ]
        try:
            self.run_cmd(cmd)
        except subprocess.CalledProcessError as err:
            click.echo(
                f"Error checking out the branch {self.get_cherry_pick_branch(branch_name)}."
            )
            click.echo(err.output)
            raise BranchCheckoutException(
                f"Error checking out the branch {self.get_cherry_pick_branch(branch_name)}."
            )
780205
function getBranchValue(branchXml, key) {
    return branchXml.hasOwnProperty(key) ? branchXml[key][0].$.value : null;
  }
533943
def subtree(self, event, create = False):
        '''
        
        '''
        current = self
        for i in range(self.depth, len(event.indices)):
            if not hasattr(current, 'index'):
                return current
            ind = event.indices[i]
            if create:
                current = current.index.setdefault(ind, EventTree(current, self.branch))
                current.parentIndex = ind
            else:
                current = current.index.get(ind)
                if current is None:
                    return None
        return current
1195810
def status
      if current_build && current_build.building?
        "building"
      elsif build = completed_builds.first
        if build.green?
          "green"
        elsif build.red?
          "red"
        end
      elsif completed_builds.empty? || builds.empty?
        "no build"
      else
        raise Error, "unexpected branch status: #{id.inspect}"
      end
    end
597007
def is_branch?(branch)
      branch_names = self.branches.map {|b| b.name}
      branch_names.include?(branch)
    end
147236
def branch_exists(self, branch):
        """"""
        try:
            git(self.gitdir, self.gitwd, "rev-parse", branch)
        except sh.ErrorReturnCode:
            return False
        return True
1176852
def local_branches
      @local_branches ||= begin
        branches = []
        if not git.branches.local.empty?
          branches << git.branches.local.select{ |b| b.current }[0].name
          branches << git.branches.local.select{ |b| not b.current }.map{ |b| b.name }
        end
        branches.flatten
      end
    end