diff --git a/rhodecode/apps/repository/views/repo_changelog.py b/rhodecode/apps/repository/views/repo_changelog.py --- a/rhodecode/apps/repository/views/repo_changelog.py +++ b/rhodecode/apps/repository/views/repo_changelog.py @@ -34,7 +34,7 @@ from rhodecode.lib.auth import ( from rhodecode.lib.ext_json import json from rhodecode.lib.graphmod import _colored, _dagwalker from rhodecode.lib.helpers import RepoPage -from rhodecode.lib.utils2 import safe_int, safe_str +from rhodecode.lib.utils2 import safe_int, safe_str, str2bool from rhodecode.lib.vcs.exceptions import ( RepositoryError, CommitDoesNotExistError, CommitError, NodeDoesNotExistError, EmptyRepositoryError) @@ -181,6 +181,7 @@ class RepoChangelogView(RepoAppView): commit_id = self.request.matchdict.get('commit_id') f_path = self._get_f_path(self.request.matchdict) + show_hidden = str2bool(self.request.GET.get('evolve')) chunk_size = 20 @@ -188,6 +189,8 @@ class RepoChangelogView(RepoAppView): c.book_name = book_name = self.request.GET.get('bookmark') or '' c.f_path = f_path c.commit_id = commit_id + c.show_hidden = show_hidden + hist_limit = safe_int(self.request.GET.get('limit')) or None p = safe_int(self.request.GET.get('page', 1), 1) @@ -227,7 +230,8 @@ class RepoChangelogView(RepoAppView): collection = list(reversed(collection)) else: collection = self.rhodecode_vcs_repo.get_commits( - branch_name=branch_name, pre_load=pre_load) + branch_name=branch_name, show_hidden=show_hidden, + pre_load=pre_load) self._load_changelog_data( c, collection, p, chunk_size, c.branch_name, @@ -279,6 +283,8 @@ class RepoChangelogView(RepoAppView): c = self.load_default_context() commit_id = self.request.matchdict.get('commit_id') f_path = self._get_f_path(self.request.matchdict) + show_hidden = str2bool(self.request.GET.get('evolve')) + chunk_size = 20 hist_limit = safe_int(self.request.GET.get('limit')) or None @@ -292,6 +298,7 @@ class RepoChangelogView(RepoAppView): c.book_name = book_name = self.request.GET.get('bookmark') or '' c.f_path = f_path c.commit_id = commit_id + c.show_hidden = show_hidden c.selected_name = branch_name or book_name if branch_name and branch_name not in self.rhodecode_vcs_repo.branches_all: @@ -307,7 +314,7 @@ class RepoChangelogView(RepoAppView): collection = list(reversed(collection)) else: collection = self.rhodecode_vcs_repo.get_commits( - branch_name=branch_name, pre_load=pre_load) + branch_name=branch_name, show_hidden=show_hidden, pre_load=pre_load) p = safe_int(self.request.GET.get('page', 1), 1) try: diff --git a/rhodecode/lib/vcs/backends/base.py b/rhodecode/lib/vcs/backends/base.py --- a/rhodecode/lib/vcs/backends/base.py +++ b/rhodecode/lib/vcs/backends/base.py @@ -298,7 +298,7 @@ class BaseRepository(object): def get_commits( self, start_id=None, end_id=None, start_date=None, end_date=None, - branch_name=None, pre_load=None): + branch_name=None, show_hidden=False, pre_load=None): """ Returns iterator of `BaseCommit` objects from start to end not inclusive. This should behave just like a list, ie. end is not @@ -309,6 +309,7 @@ class BaseRepository(object): :param start_date: :param end_date: :param branch_name: + :param show_hidden: :param pre_load: """ raise NotImplementedError diff --git a/rhodecode/lib/vcs/backends/git/repository.py b/rhodecode/lib/vcs/backends/git/repository.py --- a/rhodecode/lib/vcs/backends/git/repository.py +++ b/rhodecode/lib/vcs/backends/git/repository.py @@ -420,7 +420,7 @@ class GitRepository(BaseRepository): def get_commits( self, start_id=None, end_id=None, start_date=None, end_date=None, - branch_name=None, pre_load=None): + branch_name=None, show_hidden=False, pre_load=None): """ Returns generator of `GitCommit` objects from start to end (both are inclusive), in ascending date order. @@ -433,7 +433,8 @@ class GitRepository(BaseRepository): ``end_date`` would be filtered out from returned set :param branch_name: if specified, commits not reachable from given branch would be filtered out from returned set - + :param show_hidden: Show hidden commits such as obsolete or hidden from + Mercurial evolve :raise BranchDoesNotExistError: If given `branch_name` does not exist. :raise CommitDoesNotExistError: If commits for given `start` or diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py --- a/rhodecode/lib/vcs/backends/hg/repository.py +++ b/rhodecode/lib/vcs/backends/hg/repository.py @@ -462,7 +462,7 @@ class MercurialRepository(BaseRepository def get_commits( self, start_id=None, end_id=None, start_date=None, end_date=None, - branch_name=None, pre_load=None): + branch_name=None, show_hidden=False, pre_load=None): """ Returns generator of ``MercurialCommit`` objects from start to end (both are inclusive) @@ -475,7 +475,8 @@ class MercurialRepository(BaseRepository ``end_date`` would be filtered out from returned set :param branch_name: if specified, commits not reachable from given branch would be filtered out from returned set - + :param show_hidden: Show hidden commits such as obsolete or hidden from + Mercurial evolve :raise BranchDoesNotExistError: If given ``branch_name`` does not exist. :raise CommitDoesNotExistError: If commit for given ``start`` or @@ -510,23 +511,29 @@ class MercurialRepository(BaseRepository end_pos += 1 commit_filter = [] + if branch_name and not branch_ancestors: - commit_filter.append('branch("%s")' % branch_name) + commit_filter.append('branch("%s")' % (branch_name,)) elif branch_name and branch_ancestors: - commit_filter.append('ancestors(branch("%s"))' % branch_name) + commit_filter.append('ancestors(branch("%s"))' % (branch_name,)) + if start_date and not end_date: - commit_filter.append('date(">%s")' % start_date) + commit_filter.append('date(">%s")' % (start_date,)) if end_date and not start_date: - commit_filter.append('date("<%s")' % end_date) + commit_filter.append('date("<%s")' % (end_date,)) if start_date and end_date: commit_filter.append( 'date(">%s") and date("<%s")' % (start_date, end_date)) + if not show_hidden: + commit_filter.append('not obsolete()') + commit_filter.append('not hidden()') + # TODO: johbo: Figure out a simpler way for this solution collection_generator = CollectionGenerator if commit_filter: - commit_filter = map(safe_str, commit_filter) - revisions = self._remote.rev_range(commit_filter) + commit_filter = ' and '.join(map(safe_str, commit_filter)) + revisions = self._remote.rev_range([commit_filter]) collection_generator = MercurialIndexBasedCollectionGenerator else: revisions = self.commit_ids diff --git a/rhodecode/lib/vcs/backends/svn/repository.py b/rhodecode/lib/vcs/backends/svn/repository.py --- a/rhodecode/lib/vcs/backends/svn/repository.py +++ b/rhodecode/lib/vcs/backends/svn/repository.py @@ -264,7 +264,7 @@ class SubversionRepository(base.BaseRepo def get_commits( self, start_id=None, end_id=None, start_date=None, end_date=None, - branch_name=None, pre_load=None): + branch_name=None, show_hidden=False, pre_load=None): if self.is_empty(): raise EmptyRepositoryError("There are no commit_ids yet") self._validate_branch_name(branch_name) diff --git a/rhodecode/public/css/main.less b/rhodecode/public/css/main.less --- a/rhodecode/public/css/main.less +++ b/rhodecode/public/css/main.less @@ -100,6 +100,11 @@ input + .action-link, .action-link.first color: @grey4; } +.action-link.disabled { + color: @grey4; + cursor: inherit; +} + .clipboard-action { cursor: pointer; } diff --git a/rhodecode/templates/changelog/changelog.mako b/rhodecode/templates/changelog/changelog.mako --- a/rhodecode/templates/changelog/changelog.mako +++ b/rhodecode/templates/changelog/changelog.mako @@ -83,6 +83,17 @@ %endif ${self.breadcrumbs('breadcrumbs_light')} +