summaryrefslogtreecommitdiff
path: root/lib/git/refs.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2009-10-23 15:45:23 +0200
committerSebastian Thiel <byronimo@gmail.com>2009-10-23 15:45:23 +0200
commit1047b41e2e925617474e2e7c9927314f71ce7365 (patch)
tree332c33f6bf17b9e249eabf1dd7fe30f2adcac386 /lib/git/refs.py
parentddc5496506f0484e4f1331261aa8782c7e606bf2 (diff)
downloadgitpython-1047b41e2e925617474e2e7c9927314f71ce7365.tar.gz
Added TagRefernce creation and deletion including tests
Added RemoteReference deletion and test
Diffstat (limited to 'lib/git/refs.py')
-rw-r--r--lib/git/refs.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/git/refs.py b/lib/git/refs.py
index 7b58f215..0efee52e 100644
--- a/lib/git/refs.py
+++ b/lib/git/refs.py
@@ -506,7 +506,7 @@ class TagReference(Reference):
return None
@classmethod
- def create(cls, repo, path, ref, message=None, **kwargs):
+ def create(cls, repo, path, ref='HEAD', message=None, force=False, **kwargs):
"""
Create a new tag object.
@@ -523,14 +523,23 @@ class TagReference(Reference):
create an additional tag object that allows to obtain that information, i.e.::
tagref.tag.message
+ ``force``
+ If True, to force creation of a tag even though that tag already exists.
+
``**kwargs``
- Additional keyword arguments to be passed to git-tag, i.e. f to force creation
- of a tag.
+ Additional keyword arguments to be passed to git-tag
Returns
A new TagReference
"""
- raise NotImplementedError("todo")
+ args = ( path, ref )
+ if message:
+ kwargs['m'] = message
+ if force:
+ kwargs['f'] = True
+
+ repo.git.tag(*args, **kwargs)
+ return TagReference(repo, "%s/%s" % (cls._common_path_default, path))
@classmethod
def delete(cls, repo, *tags):
@@ -579,5 +588,9 @@ class RemoteReference(Head):
def delete(cls, repo, *remotes, **kwargs):
"""
Delete the given remote references.
+
+ Note
+ kwargs are given for compatability with the base class method as we
+ should not narrow the signature.
"""
repo.git.branch("-d", "-r", *remotes)