diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2011-06-07 21:36:42 +0200 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2011-06-07 21:36:42 +0200 |
| commit | 58a930a632c867b65b9a3802e2f4190cf32e33ee (patch) | |
| tree | 95b1311a3a4bfcdf4c2dba66f360e6985184013e /git/objects/tag.py | |
| parent | a98e0af511b728030c12bf8633b077866bb74e47 (diff) | |
| parent | f6897c78be5a5530129df50742cb6cabfb8609c9 (diff) | |
| download | GitPython-58a930a632c867b65b9a3802e2f4190cf32e33ee.tar.gz GitPython-58a930a632c867b65b9a3802e2f4190cf32e33ee.zip | |
Merge branch 'gitdbmerger'
Diffstat (limited to 'git/objects/tag.py')
| -rw-r--r-- | git/objects/tag.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/git/objects/tag.py b/git/objects/tag.py index c7d02abe..5dcd9bf9 100644 --- a/git/objects/tag.py +++ b/git/objects/tag.py @@ -5,24 +5,28 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php """ Module containing all object based types. """ import base -from gitdb.util import hex_to_bin +from git.util import RepoAliasMixin +from git.util import hex_to_bin from util import ( - get_object_type_by_name, - parse_actor_and_date - ) + get_object_type_by_name, + parse_actor_and_date + ) +from git.typ import ObjectType __all__ = ("TagObject", ) -class TagObject(base.Object): +class TagObject(base.Object, RepoAliasMixin): """Non-Lightweight tag carrying additional information about an object we are pointing to.""" - type = "tag" + type = ObjectType.tag + type_id = ObjectType.tag_id + __slots__ = ( "object", "tag", "tagger", "tagged_date", "tagger_tz_offset", "message" ) - def __init__(self, repo, binsha, object=None, tag=None, + def __init__(self, odb, binsha, object=None, tag=None, tagger=None, tagged_date=None, tagger_tz_offset=None, message=None): """Initialize a tag object with additional data - :param repo: repository this object is located in + :param odb: repository this object is located in :param binsha: 20 byte SHA1 :param object: Object instance of object we are pointing to :param tag: name of this tag @@ -32,7 +36,7 @@ class TagObject(base.Object): it into a different format :param tagged_tz_offset: int_seconds_west_of_utc is the timezone that the authored_date is in, in a format similar to time.altzone""" - super(TagObject, self).__init__(repo, binsha ) + super(TagObject, self).__init__(odb, binsha ) if object is not None: self.object = object if tag is not None: @@ -49,12 +53,12 @@ class TagObject(base.Object): def _set_cache_(self, attr): """Cache all our attributes at once""" if attr in TagObject.__slots__: - ostream = self.repo.odb.stream(self.binsha) + ostream = self.odb.stream(self.binsha) lines = ostream.read().splitlines() obj, hexsha = lines[0].split(" ") # object <hexsha> type_token, type_name = lines[1].split(" ") # type <type_name> - self.object = get_object_type_by_name(type_name)(self.repo, hex_to_bin(hexsha)) + self.object = get_object_type_by_name(type_name)(self.odb, hex_to_bin(hexsha)) self.tag = lines[2][4:] # tag <tag name> |
