diff rhodecode/lib/vcs/backends/git/repository.py @ 2198:9784a54a0f5b beta

display current heads of branches for git in changelog and shortlog
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 17 Apr 2012 21:44:26 +0200
parents 9d27481228a1
children 31ebf7010566
line wrap: on
line diff
--- a/rhodecode/lib/vcs/backends/git/repository.py	Tue Apr 17 21:41:46 2012 +0200
+++ b/rhodecode/lib/vcs/backends/git/repository.py	Tue Apr 17 21:44:26 2012 +0200
@@ -246,6 +246,19 @@
             if ref.startswith('refs/heads/') and not ref.endswith('/HEAD')]
         return OrderedDict(sorted(_branches, key=sortkey, reverse=False))
 
+    def _heads(self, reverse=False):
+        refs = self._repo.get_refs()
+        heads = {}
+
+        for key, val in refs.items():
+            for ref_key in ['refs/heads/', 'refs/remotes/origin/']:
+                if key.startswith(ref_key):
+                    n = key[len(ref_key):]
+                    if n not in ['HEAD']:
+                        heads[n] = val
+
+        return heads if reverse else dict((y,x) for x,y in heads.iteritems())
+
     def _get_tags(self):
         if not self.revisions:
             return {}