diff rhodecode/controllers/branches.py @ 2031:82a88013a3fd

merge 1.3 into stable
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 26 Feb 2012 17:25:09 +0200
parents da8f1d1b22de 89efedac4e6c
children dc2584ba5fbc
line wrap: on
line diff
--- a/rhodecode/controllers/branches.py	Sun Feb 19 20:21:14 2012 +0200
+++ b/rhodecode/controllers/branches.py	Sun Feb 26 17:25:09 2012 +0200
@@ -7,7 +7,7 @@
 
     :created_on: Apr 21, 2010
     :author: marcink
-    :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
+    :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
     :license: GPLv3, see COPYING for more details.
 """
 # This program is free software: you can redistribute it and/or modify
@@ -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')