Checkout a branch by name.
345817
def checkout(self, branch_name):
        
        try:
            find(
                self.repo.branches, lambda b: b.name == branch_name
            ).checkout()
        except OrigCheckoutError as e:
            raise CheckoutError(branch_name, details=e)
116415
def look_up(name):
    """"""
    path = name.split('.')
    module = import_module('.'.join(path[:-1]))
    return getattr(module, path[-1])
1323321
def checkup_git_repo_legacy(url, name=None, base_dir='~/repos',
                            verbose=False, prefix='', postfix=''):
    ''''''
    if not name:
        match = re.match(r'.*/(.+)\.git', url)
        assert match, flo("Unable to extract repo name from '{url}'")
        name = match.group(1)
    assert name is not None, flo('Cannot extract repo name from repo: {url}')
    assert name != '', flo('Cannot extract repo name from repo: {url} (empty)')
    if verbose:
        name_blue = blue(name)
        print_msg(flo('{prefix}Checkout or update {name_blue}{postfix}'))
    if not exists(base_dir):
        run(flo('mkdir -p {base_dir}'))
    if not exists(flo('{base_dir}/{name}/.git')):
        run(flo('  &&  '.join([
                'cd {base_dir}',
                'git clone  {url}  {name}'])),
            msg='clone repo')
    else:
        if verbose:
            print_msg('update: pull from origin')
        run(flo('cd {base_dir}/{name}  &&  git pull'))
    return name
583134
def _checkout(self, treeish):
        '''
        
        '''

        return self.m(
            'checking out "%s"' % (treeish),
            cmdd=dict(cmd='git checkout %s' % (treeish), cwd=self.local),
            verbose=False
        )
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
692984
def get_by_name(account_name, bucket, region='us-west-2', json_path='accounts.json', alias=None):
    """"""
    for account in get_all_accounts(bucket, region, json_path)['accounts']:
        if 'aws' in account['type']:
            if account['name'] == account_name:
                return account
            elif alias:
                for a in account['alias']:
                    if a == account_name:
                        return account
496664
function checkoutVersionBranch () {
    exec(`git branch -q -D release/${newVersion}`);
    exec(`git checkout -q -b release/${newVersion}`);
    abortCmds.push('git checkout master');
    abortCmds.push(`git branch -D release/${newVersion}`);
  }
515660
def _get_branch(self, remotes=False):
        '''
        
        '''

        return self.m(
            'getting git branch information',
            cmdd=dict(
                cmd='git branch %s' % ('-r' if remotes else ''),
                cwd=self.local
            ),
            verbose=False
        )
648859
def handle_branch(repo, **kwargs):
    """"""
    log.info('branch: %s %s' %(repo, kwargs))
    if type(repo) in [unicode, str]:
        path = os.path.join(repo, kwargs.get('name', 'Unnamed'))
        desc = kwargs.get('desc')
        branch = Repo.new(path=path, desc=desc, bare=True)
    else:
        name = kwargs.get('name')
        path = kwargs.get('path')
        if path and not name:
            name = os.path.basename(path)
        desc = kwargs.get('desc')
        branch = repo.branch(name=name, desc=desc)
    return branch.serialize()
52870
def check(name, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('app:check', **{
        'node': ctx.repo.create_secure_service('node'),
        'name': name,
    })
125829
def checkout(config, rev):
    """"""
    with open(config, 'r'):
        main.checkout(yaml.load(open(config)), rev)
510820
def lookup_name(self, name):
        """"""

        try:
            info = self._get_by_name(self._source, name)
        except NotImplementedError:
            pass
        else:
            if info:
                return info
            return

        info = self.lookup_name_fast(name)
        if info:
            return info
        return self.lookup_name_slow(name)
718780
def get_by(self, name):
    """"""
    return next((item for item in self if item.name == name), None)
1364943
def get_branches(self, local=True, remote_branches=True):
        """"""

        if not self.repo.remotes:
            remote_branches = False

        branches = []

        if remote_branches:

            # Remote refs.
            try:
                for b in self.remote.refs:
                    name = '/'.join(b.name.split('/')[1:])

                    if name not in legit_settings.forbidden_branches:
                        branches.append(Branch(name, is_published=True))
            except (IndexError, AssertionError):
                pass

        if local:

            # Local refs.
            for b in [h.name for h in self.repo.heads]:

                if (not remote_branches) or (b not in [br.name for br in branches]):
                    if b not in legit_settings.forbidden_branches:
                        branches.append(Branch(b, is_published=False))

        return sorted(branches, key=attrgetter('name'))
680239
public void checkout(String branch) throws Exception {
        if (!branch.equals(getBranch())) {
            createBranchIfNeeded(branch);
            git.checkout().setName(branch).setStartPoint("origin/" + branch)
                .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK).call();
            // for some reason jgit needs this when branch is switched
            git.checkout().setName(branch).call();
        }
    }
409645
function listLocalBranches(repo) {
  return caller.call(repo, repo.branches).then(function (branches) {
    return branches.map(function (branch) {
      return branch.name
    })
  })
}
838944
def branch(self, name, desc=None):
        
        return Local.new(path=os.path.join(self.path, name), desc=desc, bare=True)