diff --git a/kallithea/controllers/changelog.py b/kallithea/controllers/changelog.py --- a/kallithea/controllers/changelog.py +++ b/kallithea/controllers/changelog.py @@ -145,6 +145,9 @@ class ChangelogController(BaseRepoContro return redirect(url('changelog_file_home', repo_name=c.repo_name, revision=branch_name, f_path=f_path or '')) + if revision == 'tip': + revision = None + c.changelog_for_path = f_path try: @@ -164,13 +167,13 @@ class ChangelogController(BaseRepoContro redirect(h.url('changelog_home', repo_name=repo_name)) collection = list(reversed(collection)) else: - collection = c.db_repo_scm_instance.get_changesets(start=0, + collection = c.db_repo_scm_instance.get_changesets(start=0, end=revision, branch_name=branch_name) c.total_cs = len(collection) c.pagination = RepoPage(collection, page=p, item_count=c.total_cs, items_per_page=c.size, branch=branch_name,) - collection = list(c.pagination) + page_revisions = [x.raw_id for x in c.pagination] c.comments = c.db_repo.get_comments(page_revisions) c.statuses = c.db_repo.statuses(page_revisions) @@ -194,6 +197,8 @@ class ChangelogController(BaseRepoContro _revs = [x.revision for x in c.pagination] self._graph(c.db_repo_scm_instance, _revs, c.total_cs, c.size, p) + c.revision = revision # requested revision ref + c.first_revision = c.pagination[0] # pagination is never empty here! return render('changelog/changelog.html') @LoginRequired() diff --git a/kallithea/controllers/files.py b/kallithea/controllers/files.py --- a/kallithea/controllers/files.py +++ b/kallithea/controllers/files.py @@ -136,11 +136,11 @@ class FilesController(BaseRepoController if post_revision: cs = self.__get_cs_or_redirect(post_revision, repo_name) + c.revision = revision c.changeset = self.__get_cs_or_redirect(revision, repo_name) c.branch = request.GET.get('branch', None) c.f_path = f_path c.annotate = annotate - c.changeset = self.__get_cs_or_redirect(revision, repo_name) cur_rev = c.changeset.revision # prev link diff --git a/kallithea/templates/base/base.html b/kallithea/templates/base/base.html --- a/kallithea/templates/base/base.html +++ b/kallithea/templates/base/base.html @@ -98,7 +98,8 @@ %def> -<%def name="repo_context_bar(current=None)"> +<%def name="repo_context_bar(current=None, rev=None)"> + <% rev = None if rev == 'tip' else rev %> <% def follow_class(): if c.repository_following: @@ -143,8 +144,12 @@ -->