Checkout the configured branch/tag. We catch an "Exception" class here
        instead of a specific exception class because the exceptions raised by
        GitPython when running these functions vary in different versions of
        GitPython.
346424
def checkout(self):
        '''
        
        '''
        tgt_ref = self.get_checkout_target()
        try:
            head_sha = self.repo.rev_parse('HEAD').hexsha
        except Exception:
            # Should only happen the first time we are checking out, since
            # we fetch first before ever checking anything out.
            head_sha = None

        # 'origin/' + tgt_ref ==> matches a branch head
        # 'tags/' + tgt_ref + '@{commit}' ==> matches tag's commit
        for rev_parse_target, checkout_ref in (
                ('origin/' + tgt_ref, 'origin/' + tgt_ref),
                ('tags/' + tgt_ref, 'tags/' + tgt_ref)):
            try:
                target_sha = self.repo.rev_parse(rev_parse_target).hexsha
            except Exception:
                # ref does not exist
                continue
            else:
                if head_sha == target_sha:
                    # No need to checkout, we're already up-to-date
                    return self.check_root()

            try:
                with self.gen_lock(lock_type='checkout'):
                    self.repo.git.checkout(checkout_ref)
                    log.debug(
                        '%s remote \'%s\' has been checked out to %s',
                        self.role,
                        self.id,
                        checkout_ref
                    )
            except GitLockError as exc:
                if exc.errno == errno.EEXIST:
                    # Re-raise with a different strerror containing a
                    # more meaningful error message for the calling
                    # function.
                    raise GitLockError(
                        exc.errno,
                        'Checkout lock exists for {0} remote \'{1}\''
                        .format(self.role, self.id)
                    )
                else:
                    log.error(
                        'Error %d encountered obtaining checkout lock '
                        'for %s remote \'%s\'',
                        exc.errno,
                        self.role,
                        self.id
                    )
                    return None
            except Exception:
                continue
            return self.check_root()
        log.error(
            'Failed to checkout %s from %s remote \'%s\': remote ref does '
            'not exist', tgt_ref, self.role, self.id
        )
        return None
370717
def tag(self, tag: str, overwrite: bool = False) -> None:
        
        LOGGER.info('tagging repo: %s', tag)
        try:
            self.repo.create_tag(tag)
        except GitCommandError as exc:
            if 'already exists' in exc.stderr and overwrite:
                LOGGER.info('overwriting existing tag')
                self.remove_tag(tag)
                self.repo.create_tag(tag)
            else:
                LOGGER.exception('error while tagging repo')
                raise
1012981
function gitTag () {
      // If the tag exists, skip tagging
      if (shelljs.exec('git ls-remote --tags --exit-code ' + remoteName + ' ' + options.tag, {silent: true}).code === 0) {
        log.subhead('The tag "' + options.tag + '" already exists on remote. Skipping tagging.');
        return;
      }

      log.subhead('Tagging the local repository with ' + options.tag);
      execWrap('git tag ' + options.tag);
    }
996193
def extract_exception(*args):
    

    cls, instance, trcback = sys.exc_info()

    exceptions = filter(lambda x: issubclass(type(x), BaseException), args)
    trcbacks = filter(lambda x: issubclass(type(x), types.TracebackType), args)

    cls, instance = (type(exceptions[0]), exceptions[0]) if exceptions else (cls, instance)
    trcback = trcbacks[0] if trcbacks else trcback

    return cls, instance, trcback
663157
def _exception_raise(self):
        
        exc = self.exc_info()[:]
        try:
            exc_type, exc_value, exc_traceback = exc
        except ValueError:
            exc_type, exc_value = exc
            exc_traceback = None

        # raise exc_type(exc_value).with_traceback(exc_traceback)
        if sys.version_info[0] == 2:
            exec("raise exc_type, exc_value, exc_traceback")
        else: #  sys.version_info[0] == 3:
            if isinstance(exc_value, Exception): #hasattr(exc_value, 'with_traceback'):
                # If exc_value is an exception, then just reraise
                exec("raise exc_value.with_traceback(exc_traceback)")
            else:
                # else we'll create an exception using the value and raise that
                exec("raise exc_type(exc_value).with_traceback(exc_traceback)")
454935
function checkout(branch, localRepoDir) {
    _child_process2['default'].execSync('git checkout ' + branch, { cwd: _path2['default'].resolve(localRepoDir) });
  }
1141834
def __check_classes(self):
        
        # msg took from BaseAuthentication
        msg = (
            "Sanic JWT was not initialized properly. It did not received "
            "an instance of {}"
        )
        if not issubclass(self.authentication_class, Authentication):
            raise exceptions.InitializationFailure(
                message=msg.format("Authentication")
            )

        if not issubclass(self.configuration_class, Configuration):
            raise exceptions.InitializationFailure(
                message=msg.format("Configuration")
            )

        if not issubclass(self.responses_class, Responses):
            raise exceptions.InitializationFailure(
                message=msg.format("Responses")
            )
44109
def checkout
      begin
        svn_session() do |ctx|
           ctx.checkout(@svn_repo_master, @svn_repo_working_copy)
        end
      #rescue Svn::Error::RaLocalReposOpenFailed,
      #       Svn::Error::FsAlreadyExists,
      #rescue Errno::EACCES => e
      rescue Exception => err
        raise RepoAccessError, err.message
      end
    end
70604
def checkout(repo, ref):
    """"""
    # Delete local branch if it exists, remote branch will be tracked
    # automatically. This prevents stale local branches from causing problems.
    # It also avoids problems with appending origin/ to refs as that doesn't
    # work with tags, SHAs, and upstreams not called origin.
    if ref in repo.branches:
        # eg delete master but leave origin/master
        log.warn("Removing local branch {b} for repo {r}".format(b=ref,
                                                                 r=repo))
        # Can't delete currently checked out branch, so make sure head is
        # detached before deleting.

        repo.head.reset(index=True, working_tree=True)
        repo.git.checkout(repo.head.commit.hexsha)
        repo.delete_head(ref, '--force')

    log.info("Checkout out repo {repo} to ref {ref}".format(repo=repo,
                                                            ref=ref))
    repo.head.reset(index=True, working_tree=True)
    repo.git.checkout(ref)
    repo.head.reset(index=True, working_tree=True)
    sha = repo.head.commit.hexsha
    log.info("Current SHA for repo {repo} is {sha}".format(repo=repo, sha=sha))
1083444
def run(self):
        
        try:
            if self.should_fetch:
                self.fetch()

            self.rebase_all_branches()

            if self.with_bundler():
                self.check_bundler()

            if self.settings['push.auto']:
                self.push()

        except GitError as error:
            self.print_error(error)

            # Used for test cases
            if self.testing:
                raise
            else:  # pragma: no cover
                sys.exit(1)
105071
public Ref checkoutTag(Git git, String tag) {
        try {
            return git.checkout()
                .setName("tags/" + tag).call();
        } catch (GitAPIException e) {
            throw new IllegalStateException(e);
        }
    }
664343
private function checkAndRegisterLineBreakErrors(): void
    {
        $tokens = $this->getTagTokens();
        $prevToken = [];
        $tagCounts = $this->docTagHelper->getTagCounts($tokens);
        $withReturn = false;

        foreach ($tokens as $tokenPos => $token) {
            $thisTagContent = $token['content'];
            $isReturn = $thisTagContent === '@return';

            $isGroupSwitch =
                // Did we switch the tag ...
                $prevToken && ($prevToken['content'] !== $thisTagContent) &&
                // ... but do we skip singles or are we entering the return block which should contain only 1 tag.
                (($tagCounts[$thisTagContent] !== 1) || ($isReturn && !$withReturn));

            // Insert new line between groups or before the return tag if there is no line break already.
            if ($isGroupSwitch && (($prevToken['line'] + 1) === $token['line'])) {
                $isFixing = $this->file->addFixableWarning(
                    static::MESSAGE_MISSING_NEWLINE_BETWEEN_TAGS,
                    $tokenPos,
                    static::CODE_MISSING_NEWLINE_BETWEEN_TAGS,
                    [
                        $prevToken['content']
                    ]
                );

                if ($isFixing) {
                    $this->insertNewLine($token);
                }
            }

            $prevToken = $token;
            // Return should be the last element, so this is ok.
            $withReturn = $isReturn;
        }
    }
497831
def run!
      story = @configuration.story
      fail("Could not find story associated with branch") unless story
      Git.clean_working_tree?
      Git.push(story.branch_name, set_upstream: true)
      unless story.release?
        print "Creating pull-request on Github... "
        pull_request_params = story.params_for_pull_request.merge(project: @configuration.project)
        @configuration.github_client.create_pullrequest(pull_request_params)
        puts 'OK'
      end
      return 0
    end
342002
def checkout(lancet, force, issue):
    
    issue = get_issue(lancet, issue)

    # Get the working branch
    branch = get_branch(lancet, issue, create=force)

    with taskstatus("Checking out working branch") as ts:
        if not branch:
            ts.abort("Working branch not found")
        lancet.repo.checkout(branch.name)
        ts.ok('Checked out "{}"', branch.name)
1001789
void checkout(File project, String branch) {
		try {
			String currentBranch = currentBranch(project);
			if (currentBranch.equals(branch)) {
				log.info("Won't check out the same branch. Skipping");
				return;
			}
			log.info("Checking out branch [" + branch + "]");
			checkoutBranch(project, branch);
			log.info("Successfully checked out the branch [" + branch + "]");
		}
		catch (Exception e) {
			throw new IllegalStateException(e);
		}
	}
411826
def _pull_branch_from_origin(self):
        
        try:
            ## self.repo.git.pull()
            subprocess.check_call(["git", "pull", "origin", self.branch])
        except Exception as inst:
            sys.exit("""
        Your HEAD commit conflicts with origin/{tag}. 
        Resolve, merge, and rerun versioner.py
        """)
393696
def create_from_pybankid_exception(cls, exception):
        
        return cls(
            "{0}: {1}".format(exception.__class__.__name__, str(exception)),
            _exception_class_to_status_code.get(exception.__class__),
        )