# HG changeset patch # User Mads Kiilerich # Date 1370345201 -7200 # Node ID 218ed589e44aa685761da5541b59e7489a96b595 # Parent 18121c5425b84917234a243c86dc3a985b3948ed branch selectors: show closed branches too It would be even better if they were fetched dynamically somehow and perhaps placed in a sub sub menu ... but showing them in the list is often better than not showing them at all. diff -r 18121c5425b8 -r 218ed589e44a rhodecode/controllers/changelog.py --- a/rhodecode/controllers/changelog.py Tue Jun 18 21:54:28 2013 +0200 +++ b/rhodecode/controllers/changelog.py Tue Jun 04 13:26:41 2013 +0200 @@ -176,6 +176,10 @@ c.branch_name = branch_name c.branch_filters = [('', _('All Branches'))] + \ [(k, k) for k in c.rhodecode_repo.branches.keys()] + if c.rhodecode_repo.closed_branches: + prefix = _('(closed)') + ' ' + c.branch_filters += [('-', '-')] + \ + [(k, prefix + k) for k in c.rhodecode_repo.closed_branches.keys()] _revs = [] if not f_path: _revs = [x.revision for x in c.pagination] diff -r 18121c5425b8 -r 218ed589e44a rhodecode/lib/vcs/backends/git/repository.py --- a/rhodecode/lib/vcs/backends/git/repository.py Tue Jun 18 21:54:28 2013 +0200 +++ b/rhodecode/lib/vcs/backends/git/repository.py Tue Jun 04 13:26:41 2013 +0200 @@ -371,6 +371,10 @@ return OrderedDict(sorted(_branches, key=sortkey, reverse=False)) @LazyProperty + def closed_branches(self): + return {} + + @LazyProperty def tags(self): return self._get_tags() diff -r 18121c5425b8 -r 218ed589e44a rhodecode/lib/vcs/backends/hg/repository.py --- a/rhodecode/lib/vcs/backends/hg/repository.py Tue Jun 18 21:54:28 2013 +0200 +++ b/rhodecode/lib/vcs/backends/hg/repository.py Tue Jun 04 13:26:41 2013 +0200 @@ -101,18 +101,23 @@ return self._get_branches() @LazyProperty + def closed_branches(self): + return self._get_branches(normal=False, closed=True) + + @LazyProperty def allbranches(self): """ List all branches, including closed branches. """ return self._get_branches(closed=True) - def _get_branches(self, closed=False): + def _get_branches(self, normal=True, closed=False): """ Get's branches for this repository Returns only not closed branches by default :param closed: return also closed branches for mercurial + :param normal: return also normal branches """ if self._empty: @@ -135,6 +140,8 @@ else: bt[bn] = tip + if not normal: + return bt_closed if closed: bt.update(bt_closed) return bt diff -r 18121c5425b8 -r 218ed589e44a rhodecode/templates/switch_to_list.html --- a/rhodecode/templates/switch_to_list.html Tue Jun 18 21:54:28 2013 +0200 +++ b/rhodecode/templates/switch_to_list.html Tue Jun 04 13:26:41 2013 +0200 @@ -11,6 +11,17 @@ %endif +%if c.rhodecode_repo.closed_branches.values(): +
  • + ${h.link_to('%s (%s)' % (_('Closed Branches'),len(c.rhodecode_repo.closed_branches.values()),),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')} + +
  • +%endif
  • ${h.link_to('%s (%s)' % (_('Tags'),len(c.rhodecode_repo.tags.values()),),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')}