示例#1
0
    def names(self):
        """List git tags in the repository."""
        try:
            tags_list = [x.name for x in self.git_repo.repo.tags]
        except git.GitCommandError as ex:
            repo_path = self.git_repo.repo.working_dir
            msg = f"Error listing tags for {repo_path}. Error: {ex}"
            raise exceptions.TaggingException(msg) from ex

        return tags_list
示例#2
0
    def delete(self, name):
        """Delete tag from local repository

           :param str name: Tag name to delete
        """
        try:
            self.git_repo.git.tag("-d", name)
        except git.GitCommandError as ex:
            msg = f"Error deleting tag {name}. Error: {ex}"
            raise exceptions.TaggingException(msg) from ex
示例#3
0
    def delete(self, name):
        """Delete tag from local repository

           :param str name: Tag name to delete
        """
        try:
            self.git_repo.git.tag("-d", name)
        except git.GitCommandError as ex:
            msg = "Error deleting tag {name}. Error: {error}".format(name=name,
                                                                     error=ex)
            raise_from(exceptions.TaggingException(msg), ex)
示例#4
0
    def names(self):
        """List git tags in the repository."""
        try:
            tags_list = [x.name for x in self.git_repo.repo.tags]
        except git.GitCommandError as ex:
            repo_path = self.git_repo.repo.working_dir
            msg = "Error listing tags for {repo}. Error: {error}".format(
                error=ex, repo=repo_path)
            raise_from(exceptions.TaggingException(msg), ex)

        return tags_list
示例#5
0
    def create(self, name, reference):
        """Create a new tag to the target reference.

           :param str name: New tag's name
           :param str reference: What the tag should point to
        """
        try:
            self.git_repo.repo.create_tag(name, reference)
        except git.GitCommandError as ex:
            msg = f"Error creating tag {name} on {reference}. Error: {ex}"
            raise exceptions.TaggingException(msg) from ex
示例#6
0
    def create(self, name, reference):
        """Create a new tag to the target reference.

           :param str name: New tag's name
           :param str reference: What the tag should point to
        """
        try:
            self.git_repo.repo.create_tag(name, reference)
        except git.GitCommandError as ex:
            msg = "Error creating tag {name} on {ref}. Error: {error}".format(
                name=name, ref=reference, error=ex)
            raise_from(exceptions.TaggingException(msg), ex)