diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-10-24 14:12:59 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-10-26 09:44:24 +0200 |
commit | d6999f791909f22c9846e24b45a7032540894691 (patch) | |
tree | 069c4c08197a1bdf1d0097c40811b13edac7c587 /gbp | |
parent | 718f0c3dda9c9691d6e99821aca89a440d5075e7 (diff) |
Replace GitTag by GitRepository.create_tag()
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/command_wrappers.py | 23 | ||||
-rw-r--r-- | gbp/git.py | 24 |
2 files changed, 24 insertions, 23 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py index 33d6823..8d942b8 100644 --- a/gbp/command_wrappers.py +++ b/gbp/command_wrappers.py @@ -230,29 +230,6 @@ class GitCommand(Command): self.run_error = "Couldn't run git %s" % cmd -# FIXME: move to gbp.git.create_tag -class GitTag(GitCommand): - """Wrap git tag""" - def __init__(self, sign_tag=False, keyid=None): - GitCommand.__init__(self,'tag') - self.sign_tag = sign_tag - self.keyid = keyid - - def __call__(self, version, msg="Tagging %(version)s", commit=None): - self.run_error = 'Couldn\'t tag "%s"' % (version,) - if self.sign_tag: - if self.keyid: - sign_opts = [ '-u', self.keyid ] - else: - sign_opts = [ '-s' ] - else: - sign_opts = [] - cmd = sign_opts + [ '-m', msg % locals(), version] - if commit: - cmd += [ commit ] - GitCommand.__call__(self, cmd) - - def copy_from(orig_dir, filters=[]): """ copy a source tree over via tar @@ -274,6 +274,30 @@ class GitRepository(object): self._git_command("tag", [ new, old ]) self.remove_tag(old) + def create_tag(self, name, msg=None, commit=None, sign=False, keyid=None): + """ + Create a new tag. + + @param name: the tag's name + @type name: string + @param msg: The tag message. + @type msg: string + @param commit: the commit or object to create the tag at, default + is I{HEAD} + @type commit: string + @param sign: Whether to sing the tag + @type sign: bool + @param keyid: the GPG keyid used to sign the tag + @type keyid: string + """ + args = [] + args += [ '-m', msg ] if msg else [] + if sign: + args += [ '-u', keyid ] if keyid else [ '-s' ] + args += [ name ] + args += [ commit ] if commit else [] + self._git_command("tag", args) + def get_branch(self): """on what branch is the current working copy""" for line in self.__git_getoutput('branch', [ '--no-color' ])[0]: |