changeset 2975:e0da2c0ecee1 beta

fixes #625 Git-Tags are not displayed in Shortlog - improved git extraction of git tags if they are associated to a commit - added not implemented tags() function for git changesets
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 29 Oct 2012 22:26:44 +0100
parents b7db20657e35
children 45a8e0051280
files rhodecode/lib/vcs/backends/git/changeset.py rhodecode/lib/vcs/backends/git/repository.py
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/git/changeset.py	Mon Oct 29 21:29:52 2012 +0100
+++ b/rhodecode/lib/vcs/backends/git/changeset.py	Mon Oct 29 22:26:44 2012 +0100
@@ -46,8 +46,7 @@
         self.revision = repository.revisions.index(revision)
 
         self.message = safe_unicode(commit.message)
-        #self.branch = None
-        self.tags = []
+
         self.nodes = {}
         self._paths = {}
 
@@ -72,6 +71,14 @@
         return self.changed, self.added, self.removed
 
     @LazyProperty
+    def tags(self):
+        _tags = []
+        for tname, tsha in self.repository.tags.iteritems():
+            if tsha == self.raw_id:
+                _tags.append(tname)
+        return _tags
+
+    @LazyProperty
     def branch(self):
 
         heads = self.repository._heads(reverse=False)
--- a/rhodecode/lib/vcs/backends/git/repository.py	Mon Oct 29 21:29:52 2012 +0100
+++ b/rhodecode/lib/vcs/backends/git/repository.py	Mon Oct 29 22:26:44 2012 +0100
@@ -18,7 +18,7 @@
 import urllib
 import urllib2
 from dulwich.repo import Repo, NotGitRepository
-#from dulwich.config import ConfigFile
+from dulwich.objects import Tag
 from string import Template
 from subprocess import Popen, PIPE
 from rhodecode.lib.vcs.backends.base import BaseRepository
@@ -401,6 +401,10 @@
             for k, type_ in keys:
                 if ref.startswith(k):
                     _key = ref[len(k):]
+                    if type_ == 'T':
+                        obj = self._repo.get_object(sha)
+                        if isinstance(obj, Tag):
+                            sha = self._repo.get_object(sha).object[1]
                     _refs[_key] = [sha, type_]
                     break
         return _refs