diff --git a/rhodecode/apps/repository/tests/test_repo_files.py b/rhodecode/apps/repository/tests/test_repo_files.py --- a/rhodecode/apps/repository/tests/test_repo_files.py +++ b/rhodecode/apps/repository/tests/test_repo_files.py @@ -178,7 +178,7 @@ class TestFilesViews(object): commit_id='tip', f_path='/')) # make sure Files menu url is not tip but new commit - landing_rev = backend.repo.landing_rev[1] + landing_rev = backend.repo.landing_ref_name files_url = route_path('repo_files:default_path', repo_name=backend.repo_name, commit_id=landing_rev) diff --git a/rhodecode/apps/repository/views/repo_files.py b/rhodecode/apps/repository/views/repo_files.py --- a/rhodecode/apps/repository/views/repo_files.py +++ b/rhodecode/apps/repository/views/repo_files.py @@ -137,7 +137,7 @@ class RepoFilesView(RepoAppView): raise HTTPFound(files_url) def _get_commit_and_path(self): - default_commit_id = self.db_repo.landing_rev[1] + default_commit_id = self.db_repo.landing_ref_name default_f_path = '/' commit_id = self.request.matchdict.get( diff --git a/rhodecode/apps/repository/views/repo_forks.py b/rhodecode/apps/repository/views/repo_forks.py --- a/rhodecode/apps/repository/views/repo_forks.py +++ b/rhodecode/apps/repository/views/repo_forks.py @@ -138,10 +138,10 @@ class RepoForksView(RepoAppView, DataGri url_link = h.route_path( 'repo_compare', repo_name=fork.repo_name, - source_ref_type=self.db_repo.landing_rev[0], - source_ref=self.db_repo.landing_rev[1], - target_ref_type=self.db_repo.landing_rev[0], - target_ref=self.db_repo.landing_rev[1], + source_ref_type=self.db_repo.landing_ref_type, + source_ref=self.db_repo.landing_ref_name, + target_ref_type=self.db_repo.landing_ref_type, + target_ref=self.db_repo.landing_ref_name, _query=dict(merge=1, target_repo=f.repo_name)) return h.link_to(_('Compare fork'), url_link, class_='btn-link') diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -1758,7 +1758,7 @@ class Repository(Base, BaseModel): @hybrid_property def landing_rev(self): - # always should return [rev_type, rev] + # always should return [rev_type, rev], e.g ['branch', 'master'] if self._landing_revision: _rev_info = self._landing_revision.split(':') if len(_rev_info) < 2: @@ -1766,6 +1766,14 @@ class Repository(Base, BaseModel): return [_rev_info[0], _rev_info[1]] return [None, None] + @property + def landing_ref_type(self): + return self.landing_rev[0] + + @property + def landing_ref_name(self): + return self.landing_rev[1] + @landing_rev.setter def landing_rev(self, val): if ':' not in val: diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -365,7 +365,7 @@