# HG changeset patch # User Marcin Kuzminski # Date 2017-05-10 16:33:59 # Node ID 4d2afefb9a2f9dc0a83f16e108612dc34d799ca7 # Parent c2645bad9a35622c63286e47ede1b3e2b9145443 mercurial-evolve: enable evolve setting on repositories. diff --git a/rhodecode/api/views/repo_api.py b/rhodecode/api/views/repo_api.py --- a/rhodecode/api/views/repo_api.py +++ b/rhodecode/api/views/repo_api.py @@ -1902,6 +1902,7 @@ def get_repo_settings(request, apiuser, "id": 237, "result": { "extensions_largefiles": true, + "extensions_evolve": true, "hooks_changegroup_push_logger": true, "hooks_changegroup_repo_size": false, "hooks_outgoing_pull_logger": true, diff --git a/rhodecode/lib/db_manage.py b/rhodecode/lib/db_manage.py --- a/rhodecode/lib/db_manage.py +++ b/rhodecode/lib/db_manage.py @@ -363,6 +363,14 @@ class DbManage(object): hgsubversion.ui_active = False self.sa.add(hgsubversion) + # enable hgevolve disabled by default + hgevolve = RhodeCodeUi() + hgevolve.ui_section = 'extensions' + hgevolve.ui_key = 'evolve' + hgevolve.ui_value = '' + hgevolve.ui_active = False + self.sa.add(hgevolve) + # enable hggit disabled by default hggit = RhodeCodeUi() hggit.ui_section = 'extensions' diff --git a/rhodecode/lib/vcs/backends/hg/commit.py b/rhodecode/lib/vcs/backends/hg/commit.py --- a/rhodecode/lib/vcs/backends/hg/commit.py +++ b/rhodecode/lib/vcs/backends/hg/commit.py @@ -171,6 +171,16 @@ class MercurialCommit(base.BaseCommit): return safe_unicode(phase_text) @LazyProperty + def obsolete(self): + obsolete = self._remote.ctx_obsolete(self.idx) + return obsolete + + @LazyProperty + def hidden(self): + hidden = self._remote.ctx_hidden(self.idx) + return hidden + + @LazyProperty def children(self): """ Returns list of child commits. diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -384,6 +384,7 @@ class _BaseVcsSettingsForm(formencode.Sc # hg extensions_largefiles = v.StringBoolean(if_missing=False) + extensions_evolve = v.StringBoolean(if_missing=False) phases_publish = v.StringBoolean(if_missing=False) rhodecode_hg_use_rebase_for_merging = v.StringBoolean(if_missing=False) diff --git a/rhodecode/model/settings.py b/rhodecode/model/settings.py --- a/rhodecode/model/settings.py +++ b/rhodecode/model/settings.py @@ -415,15 +415,16 @@ class VcsSettingsModel(object): ('hooks', 'outgoing.pull_logger'),) HG_SETTINGS = ( ('extensions', 'largefiles'), - ('phases', 'publish'),) + ('phases', 'publish'), + ('extensions', 'evolve'),) GIT_SETTINGS = ( ('vcs_git_lfs', 'enabled'),) - GLOBAL_HG_SETTINGS = ( ('extensions', 'largefiles'), ('largefiles', 'usercache'), ('phases', 'publish'), - ('extensions', 'hgsubversion')) + ('extensions', 'hgsubversion'), + ('extensions', 'evolve'),) GLOBAL_GIT_SETTINGS = ( ('vcs_git_lfs', 'enabled'), ('vcs_git_lfs', 'store_location')) @@ -546,22 +547,26 @@ class VcsSettingsModel(object): @assert_repo_settings def create_or_update_repo_hg_settings(self, data): - largefiles, phases = \ + largefiles, phases, evolve = \ self.HG_SETTINGS - largefiles_key, phases_key = \ + largefiles_key, phases_key, evolve_key = \ self._get_settings_keys(self.HG_SETTINGS, data) self._create_or_update_ui( self.repo_settings, *largefiles, value='', active=data[largefiles_key]) self._create_or_update_ui( + self.repo_settings, *evolve, value='', + active=data[evolve_key]) + self._create_or_update_ui( self.repo_settings, *phases, value=safe_str(data[phases_key])) def create_or_update_global_hg_settings(self, data): - largefiles, largefiles_store, phases, hgsubversion \ + largefiles, largefiles_store, phases, hgsubversion, evolve \ = self.GLOBAL_HG_SETTINGS - largefiles_key, largefiles_store_key, phases_key, subversion_key \ + largefiles_key, largefiles_store_key, phases_key, subversion_key, evolve_key \ = self._get_settings_keys(self.GLOBAL_HG_SETTINGS, data) + self._create_or_update_ui( self.global_settings, *largefiles, value='', active=data[largefiles_key]) @@ -572,6 +577,9 @@ class VcsSettingsModel(object): self.global_settings, *phases, value=safe_str(data[phases_key])) self._create_or_update_ui( self.global_settings, *hgsubversion, active=data[subversion_key]) + self._create_or_update_ui( + self.global_settings, *evolve, value='', + active=data[evolve_key]) def create_or_update_repo_git_settings(self, data): # NOTE(marcink): # comma make unpack work properly diff --git a/rhodecode/public/css/tables.less b/rhodecode/public/css/tables.less --- a/rhodecode/public/css/tables.less +++ b/rhodecode/public/css/tables.less @@ -108,6 +108,11 @@ table.dataTable { &.td-hash { min-width: 80px; width: 200px; + + .obsolete { + text-decoration: line-through; + color: lighten(@grey2,25%); + } } &.td-time { diff --git a/rhodecode/templates/base/vcs_settings.mako b/rhodecode/templates/base/vcs_settings.mako --- a/rhodecode/templates/base/vcs_settings.mako +++ b/rhodecode/templates/base/vcs_settings.mako @@ -130,6 +130,19 @@ ${_('Requires hgsubversion library to be installed. Allows cloning remote SVN repositories and migrates them to Mercurial type.')} % endif + +
+ ${h.checkbox('extensions_evolve' + suffix, 'True', **kwargs)} + +
+
+ % if display_globals: + ${_('Enable evolve extension for all repositories.')} + % else: + ${_('Enable evolve extension for this repository.')} + % endif +
+ ## LABS for HG diff --git a/rhodecode/templates/changelog/changelog_elements.mako b/rhodecode/templates/changelog/changelog_elements.mako --- a/rhodecode/templates/changelog/changelog_elements.mako +++ b/rhodecode/templates/changelog/changelog_elements.mako @@ -46,13 +46,28 @@ - ${h.show_id(commit)} + ${h.show_id(commit)} % if hasattr(commit, 'phase'): % if commit.phase != 'public': - ${commit.phase} + ${commit.phase} % endif % endif + + ## obsolete commits + % if hasattr(commit, 'obsolete'): + % if commit.obsolete: + ${_('obsolete')} + % endif + % endif + + ## hidden commits + % if hasattr(commit, 'hidden'): + % if commit.hidden: + ${_('hidden')} + % endif + % endif + diff --git a/rhodecode/templates/changeset/changeset.mako b/rhodecode/templates/changeset/changeset.mako --- a/rhodecode/templates/changeset/changeset.mako +++ b/rhodecode/templates/changeset/changeset.mako @@ -37,8 +37,23 @@ ${h.show_id(c.commit)} % if hasattr(c.commit, 'phase'): - ${c.commit.phase} + ${c.commit.phase} + % endif + + ## obsolete commits + % if hasattr(c.commit, 'obsolete'): + % if c.commit.obsolete: + ${_('obsolete')} + % endif % endif + + ## hidden commits + % if hasattr(c.commit, 'hidden'): + % if c.commit.hidden: + ${_('hidden')} + % endif + % endif + diff --git a/rhodecode/tests/functional/test_admin_repos.py b/rhodecode/tests/functional/test_admin_repos.py --- a/rhodecode/tests/functional/test_admin_repos.py +++ b/rhodecode/tests/functional/test_admin_repos.py @@ -581,6 +581,7 @@ class TestVcsSettings(object): 'hooks_changegroup_push_logger': False, 'hooks_outgoing_pull_logger': False, 'extensions_largefiles': False, + 'extensions_evolve': False, 'phases_publish': 'False', 'rhodecode_pr_merge_enabled': False, 'rhodecode_use_outdated_comments': False, diff --git a/rhodecode/tests/functional/test_admin_settings.py b/rhodecode/tests/functional/test_admin_settings.py --- a/rhodecode/tests/functional/test_admin_settings.py +++ b/rhodecode/tests/functional/test_admin_settings.py @@ -275,6 +275,23 @@ class TestAdminSettingsVcs(object): 'value="True" checked="checked" />') response.mustcontain(extensions_input) + def test_extensions_hgevolve(self, app, form_defaults, csrf_token): + form_defaults.update({ + 'csrf_token': csrf_token, + 'extensions_evolve': 'True', + }) + response = app.post( + url('admin_settings_vcs'), + params=form_defaults, + status=302) + + response = response.follow() + extensions_input = ( + '') + response.mustcontain(extensions_input) + def test_has_a_section_for_pull_request_settings(self, app): response = app.get(url('admin_settings_vcs')) response.mustcontain('Pull Request Settings') diff --git a/rhodecode/tests/models/settings/test_vcs_settings.py b/rhodecode/tests/models/settings/test_vcs_settings.py --- a/rhodecode/tests/models/settings/test_vcs_settings.py +++ b/rhodecode/tests/models/settings/test_vcs_settings.py @@ -500,7 +500,8 @@ class TestCreateOrUpdateUi(object): def test_update(self, repo_stub, settings_util): model = VcsSettingsModel(repo=repo_stub.repo_name) - largefiles, phases = model.HG_SETTINGS + largefiles, phases, evolve = model.HG_SETTINGS + section = 'test-section' key = 'test-key' settings_util.create_repo_rhodecode_ui( @@ -519,6 +520,7 @@ class TestCreateOrUpdateUi(object): class TestCreateOrUpdateRepoHgSettings(object): FORM_DATA = { 'extensions_largefiles': False, + 'extensions_evolve': False, 'phases_publish': False } @@ -529,6 +531,8 @@ class TestCreateOrUpdateRepoHgSettings(o expected_calls = [ mock.call(model.repo_settings, 'extensions', 'largefiles', active=False, value=''), + mock.call(model.repo_settings, 'extensions', 'evolve', + active=False, value=''), mock.call(model.repo_settings, 'phases', 'publish', value='False'), ] assert expected_calls == create_mock.call_args_list @@ -574,7 +578,8 @@ class TestCreateOrUpdateGlobalHgSettings 'extensions_largefiles': False, 'largefiles_usercache': '/example/largefiles-store', 'phases_publish': False, - 'extensions_hgsubversion': False + 'extensions_hgsubversion': False, + 'extensions_evolve': False } def test_creates_repo_hg_settings_when_data_is_correct(self): @@ -589,7 +594,9 @@ class TestCreateOrUpdateGlobalHgSettings mock.call(model.global_settings, 'phases', 'publish', value='False'), mock.call(model.global_settings, 'extensions', 'hgsubversion', - active=False) + active=False), + mock.call(model.global_settings, 'extensions', 'evolve', + active=False, value='') ] assert expected_calls == create_mock.call_args_list @@ -957,6 +964,7 @@ class TestCreateOrUpdateRepoSettings(obj 'hooks_changegroup_push_logger': False, 'hooks_outgoing_pull_logger': False, 'extensions_largefiles': False, + 'extensions_evolve': False, 'largefiles_usercache': '/example/largefiles-store', 'vcs_git_lfs_enabled': False, 'vcs_git_lfs_store_location': '/',