changeset 1698:8fdabc8cce1a beta

fixes GIT issues with branch page
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 18 Nov 2011 16:31:36 +0200
parents 23bf79f4e8d4
children 623b228cf325
files rhodecode/controllers/branches.py
diffstat 1 files changed, 13 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/branches.py	Fri Nov 18 15:35:32 2011 +0200
+++ b/rhodecode/controllers/branches.py	Fri Nov 18 16:31:36 2011 +0200
@@ -46,33 +46,30 @@
     def index(self):
 
         def _branchtags(localrepo):
-
-            bt = {}
             bt_closed = {}
-
             for bn, heads in localrepo.branchmap().iteritems():
                 tip = heads[-1]
-                if 'close' not in localrepo.changelog.read(tip)[5]:
-                    bt[bn] = tip
-                else:
+                if 'close' in localrepo.changelog.read(tip)[5]:
                     bt_closed[bn] = tip
-            return bt, bt_closed
+            return bt_closed
 
+        cs_g = c.rhodecode_repo.get_changeset
 
-        bt, bt_closed = _branchtags(c.rhodecode_repo._repo)
-        cs_g = c.rhodecode_repo.get_changeset
-        _branches = [(safe_unicode(n), cs_g(binascii.hexlify(h)),) for n, h in
-                     bt.items()]
+        c.repo_closed_branches = {}
+        if c.rhodecode_db_repo.repo_type == 'hg':
+            bt_closed = _branchtags(c.rhodecode_repo._repo)
+            _closed_branches = [(safe_unicode(n), cs_g(binascii.hexlify(h)),)
+                                for n, h in bt_closed.items()]
 
-        _closed_branches = [(safe_unicode(n), cs_g(binascii.hexlify(h)),) for n, h in
-                     bt_closed.items()]
+            c.repo_closed_branches = OrderedDict(sorted(_closed_branches,
+                                                    key=lambda ctx: ctx[0],
+                                                    reverse=False))
 
+        _branches = [(safe_unicode(n), cs_g(h))
+                     for n, h in c.rhodecode_repo.branches.items()]
         c.repo_branches = OrderedDict(sorted(_branches,
                                              key=lambda ctx: ctx[0],
                                              reverse=False))
-        c.repo_closed_branches = OrderedDict(sorted(_closed_branches,
-                                                    key=lambda ctx: ctx[0],
-                                                    reverse=False))
 
 
         return render('branches/branches.html')