original_docstring: 
              DRY function for checking out either a branch or a tag
              
docstring: DRY function for checking out either a branch or a tag
docstring_tokens: DRY function for checking out either a branch or a tag
code: def _perform_checkout(checkout_ref, branch=True):
              '''
              DRY function for checking out either a branch or a tag
              '''
              try:
                  with self.gen_lock(lock_type='checkout'):
                      # Checkout the local branch corresponding to the
                      # remote ref.
                      self.repo.checkout(checkout_ref)
                      if branch:
                          self.repo.reset(oid, pygit2.GIT_RESET_HARD)
                  return True
              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 False
code_tokens: def _perform_checkout ( checkout_ref , branch = True ) : try : with self . gen_lock ( lock_type = 'checkout' ) : self . repo . checkout ( checkout_ref ) if branch : self . repo . reset ( oid , pygit2 . GIT_RESET_HARD ) return True except GitLockError as exc : if exc . errno == errno . EEXIST : 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 False
short_docstring: DRY function for checking out either a branch or a tag
short_docstring_tokens: DRY function for checking out either a branch or a tag
comment: '''
              DRY function for checking out either a branch or a tag
              '''$SEP$# Checkout the local branch corresponding to the$SEP$# remote ref.$SEP$# Re-raise with a different strerror containing a$SEP$# more meaningful error message for the calling$SEP$# function.