##// END OF EJS Templates
mercurial-evolve: enable evolve setting on repositories.
marcink -
r1738:4d2afefb default
parent child Browse files
Show More
@@ -1902,6 +1902,7 b' def get_repo_settings(request, apiuser, '
1902 "id": 237,
1902 "id": 237,
1903 "result": {
1903 "result": {
1904 "extensions_largefiles": true,
1904 "extensions_largefiles": true,
1905 "extensions_evolve": true,
1905 "hooks_changegroup_push_logger": true,
1906 "hooks_changegroup_push_logger": true,
1906 "hooks_changegroup_repo_size": false,
1907 "hooks_changegroup_repo_size": false,
1907 "hooks_outgoing_pull_logger": true,
1908 "hooks_outgoing_pull_logger": true,
@@ -363,6 +363,14 b' class DbManage(object):'
363 hgsubversion.ui_active = False
363 hgsubversion.ui_active = False
364 self.sa.add(hgsubversion)
364 self.sa.add(hgsubversion)
365
365
366 # enable hgevolve disabled by default
367 hgevolve = RhodeCodeUi()
368 hgevolve.ui_section = 'extensions'
369 hgevolve.ui_key = 'evolve'
370 hgevolve.ui_value = ''
371 hgevolve.ui_active = False
372 self.sa.add(hgevolve)
373
366 # enable hggit disabled by default
374 # enable hggit disabled by default
367 hggit = RhodeCodeUi()
375 hggit = RhodeCodeUi()
368 hggit.ui_section = 'extensions'
376 hggit.ui_section = 'extensions'
@@ -171,6 +171,16 b' class MercurialCommit(base.BaseCommit):'
171 return safe_unicode(phase_text)
171 return safe_unicode(phase_text)
172
172
173 @LazyProperty
173 @LazyProperty
174 def obsolete(self):
175 obsolete = self._remote.ctx_obsolete(self.idx)
176 return obsolete
177
178 @LazyProperty
179 def hidden(self):
180 hidden = self._remote.ctx_hidden(self.idx)
181 return hidden
182
183 @LazyProperty
174 def children(self):
184 def children(self):
175 """
185 """
176 Returns list of child commits.
186 Returns list of child commits.
@@ -384,6 +384,7 b' class _BaseVcsSettingsForm(formencode.Sc'
384
384
385 # hg
385 # hg
386 extensions_largefiles = v.StringBoolean(if_missing=False)
386 extensions_largefiles = v.StringBoolean(if_missing=False)
387 extensions_evolve = v.StringBoolean(if_missing=False)
387 phases_publish = v.StringBoolean(if_missing=False)
388 phases_publish = v.StringBoolean(if_missing=False)
388 rhodecode_hg_use_rebase_for_merging = v.StringBoolean(if_missing=False)
389 rhodecode_hg_use_rebase_for_merging = v.StringBoolean(if_missing=False)
389
390
@@ -415,15 +415,16 b' class VcsSettingsModel(object):'
415 ('hooks', 'outgoing.pull_logger'),)
415 ('hooks', 'outgoing.pull_logger'),)
416 HG_SETTINGS = (
416 HG_SETTINGS = (
417 ('extensions', 'largefiles'),
417 ('extensions', 'largefiles'),
418 ('phases', 'publish'),)
418 ('phases', 'publish'),
419 ('extensions', 'evolve'),)
419 GIT_SETTINGS = (
420 GIT_SETTINGS = (
420 ('vcs_git_lfs', 'enabled'),)
421 ('vcs_git_lfs', 'enabled'),)
421
422 GLOBAL_HG_SETTINGS = (
422 GLOBAL_HG_SETTINGS = (
423 ('extensions', 'largefiles'),
423 ('extensions', 'largefiles'),
424 ('largefiles', 'usercache'),
424 ('largefiles', 'usercache'),
425 ('phases', 'publish'),
425 ('phases', 'publish'),
426 ('extensions', 'hgsubversion'))
426 ('extensions', 'hgsubversion'),
427 ('extensions', 'evolve'),)
427 GLOBAL_GIT_SETTINGS = (
428 GLOBAL_GIT_SETTINGS = (
428 ('vcs_git_lfs', 'enabled'),
429 ('vcs_git_lfs', 'enabled'),
429 ('vcs_git_lfs', 'store_location'))
430 ('vcs_git_lfs', 'store_location'))
@@ -546,22 +547,26 b' class VcsSettingsModel(object):'
546
547
547 @assert_repo_settings
548 @assert_repo_settings
548 def create_or_update_repo_hg_settings(self, data):
549 def create_or_update_repo_hg_settings(self, data):
549 largefiles, phases = \
550 largefiles, phases, evolve = \
550 self.HG_SETTINGS
551 self.HG_SETTINGS
551 largefiles_key, phases_key = \
552 largefiles_key, phases_key, evolve_key = \
552 self._get_settings_keys(self.HG_SETTINGS, data)
553 self._get_settings_keys(self.HG_SETTINGS, data)
553
554
554 self._create_or_update_ui(
555 self._create_or_update_ui(
555 self.repo_settings, *largefiles, value='',
556 self.repo_settings, *largefiles, value='',
556 active=data[largefiles_key])
557 active=data[largefiles_key])
557 self._create_or_update_ui(
558 self._create_or_update_ui(
559 self.repo_settings, *evolve, value='',
560 active=data[evolve_key])
561 self._create_or_update_ui(
558 self.repo_settings, *phases, value=safe_str(data[phases_key]))
562 self.repo_settings, *phases, value=safe_str(data[phases_key]))
559
563
560 def create_or_update_global_hg_settings(self, data):
564 def create_or_update_global_hg_settings(self, data):
561 largefiles, largefiles_store, phases, hgsubversion \
565 largefiles, largefiles_store, phases, hgsubversion, evolve \
562 = self.GLOBAL_HG_SETTINGS
566 = self.GLOBAL_HG_SETTINGS
563 largefiles_key, largefiles_store_key, phases_key, subversion_key \
567 largefiles_key, largefiles_store_key, phases_key, subversion_key, evolve_key \
564 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS, data)
568 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS, data)
569
565 self._create_or_update_ui(
570 self._create_or_update_ui(
566 self.global_settings, *largefiles, value='',
571 self.global_settings, *largefiles, value='',
567 active=data[largefiles_key])
572 active=data[largefiles_key])
@@ -572,6 +577,9 b' class VcsSettingsModel(object):'
572 self.global_settings, *phases, value=safe_str(data[phases_key]))
577 self.global_settings, *phases, value=safe_str(data[phases_key]))
573 self._create_or_update_ui(
578 self._create_or_update_ui(
574 self.global_settings, *hgsubversion, active=data[subversion_key])
579 self.global_settings, *hgsubversion, active=data[subversion_key])
580 self._create_or_update_ui(
581 self.global_settings, *evolve, value='',
582 active=data[evolve_key])
575
583
576 def create_or_update_repo_git_settings(self, data):
584 def create_or_update_repo_git_settings(self, data):
577 # NOTE(marcink): # comma make unpack work properly
585 # NOTE(marcink): # comma make unpack work properly
@@ -108,6 +108,11 b' table.dataTable {'
108 &.td-hash {
108 &.td-hash {
109 min-width: 80px;
109 min-width: 80px;
110 width: 200px;
110 width: 200px;
111
112 .obsolete {
113 text-decoration: line-through;
114 color: lighten(@grey2,25%);
115 }
111 }
116 }
112
117
113 &.td-time {
118 &.td-time {
@@ -130,6 +130,19 b''
130 <span class="help-block">${_('Requires hgsubversion library to be installed. Allows cloning remote SVN repositories and migrates them to Mercurial type.')}</span>
130 <span class="help-block">${_('Requires hgsubversion library to be installed. Allows cloning remote SVN repositories and migrates them to Mercurial type.')}</span>
131 </div>
131 </div>
132 % endif
132 % endif
133
134 <div class="checkbox">
135 ${h.checkbox('extensions_evolve' + suffix, 'True', **kwargs)}
136 <label for="extensions_evolve${suffix}">${_('Enable evolve extension')}</label>
137 </div>
138 <div class="label">
139 % if display_globals:
140 <span class="help-block">${_('Enable evolve extension for all repositories.')}</span>
141 % else:
142 <span class="help-block">${_('Enable evolve extension for this repository.')}</span>
143 % endif
144 </div>
145
133 </div>
146 </div>
134 </div>
147 </div>
135 ## LABS for HG
148 ## LABS for HG
@@ -46,13 +46,28 b''
46 <td class="td-hash">
46 <td class="td-hash">
47 <code>
47 <code>
48 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id)}">
48 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id)}">
49 <span class="commit_hash">${h.show_id(commit)}</span>
49 <span class="${'commit_hash obsolete' if getattr(commit, 'obsolete', None) else 'commit_hash'}">${h.show_id(commit)}</span>
50 </a>
50 </a>
51 % if hasattr(commit, 'phase'):
51 % if hasattr(commit, 'phase'):
52 % if commit.phase != 'public':
52 % if commit.phase != 'public':
53 <span class="tag phase-${commit.phase} tooltip" title="${_('commit phase')}">${commit.phase}</span>
53 <span class="tag phase-${commit.phase} tooltip" title="${_('Commit phase')}">${commit.phase}</span>
54 % endif
54 % endif
55 % endif
55 % endif
56
57 ## obsolete commits
58 % if hasattr(commit, 'obsolete'):
59 % if commit.obsolete:
60 <span class="tag obsolete-${commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
61 % endif
62 % endif
63
64 ## hidden commits
65 % if hasattr(commit, 'hidden'):
66 % if commit.hidden:
67 <span class="tag obsolete-${commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
68 % endif
69 % endif
70
56 </code>
71 </code>
57 </td>
72 </td>
58 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_('Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
73 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_('Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
@@ -37,8 +37,23 b''
37 <code>
37 <code>
38 ${h.show_id(c.commit)}
38 ${h.show_id(c.commit)}
39 % if hasattr(c.commit, 'phase'):
39 % if hasattr(c.commit, 'phase'):
40 <span class="tag phase-${c.commit.phase} tooltip" title="${_('commit phase')}">${c.commit.phase}</span>
40 <span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">${c.commit.phase}</span>
41 % endif
42
43 ## obsolete commits
44 % if hasattr(c.commit, 'obsolete'):
45 % if c.commit.obsolete:
46 <span class="tag obsolete-${c.commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
47 % endif
41 % endif
48 % endif
49
50 ## hidden commits
51 % if hasattr(c.commit, 'hidden'):
52 % if c.commit.hidden:
53 <span class="tag hidden-${c.commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
54 % endif
55 % endif
56
42 </code>
57 </code>
43 </h4>
58 </h4>
44 </span>
59 </span>
@@ -581,6 +581,7 b' class TestVcsSettings(object):'
581 'hooks_changegroup_push_logger': False,
581 'hooks_changegroup_push_logger': False,
582 'hooks_outgoing_pull_logger': False,
582 'hooks_outgoing_pull_logger': False,
583 'extensions_largefiles': False,
583 'extensions_largefiles': False,
584 'extensions_evolve': False,
584 'phases_publish': 'False',
585 'phases_publish': 'False',
585 'rhodecode_pr_merge_enabled': False,
586 'rhodecode_pr_merge_enabled': False,
586 'rhodecode_use_outdated_comments': False,
587 'rhodecode_use_outdated_comments': False,
@@ -275,6 +275,23 b' class TestAdminSettingsVcs(object):'
275 'value="True" checked="checked" />')
275 'value="True" checked="checked" />')
276 response.mustcontain(extensions_input)
276 response.mustcontain(extensions_input)
277
277
278 def test_extensions_hgevolve(self, app, form_defaults, csrf_token):
279 form_defaults.update({
280 'csrf_token': csrf_token,
281 'extensions_evolve': 'True',
282 })
283 response = app.post(
284 url('admin_settings_vcs'),
285 params=form_defaults,
286 status=302)
287
288 response = response.follow()
289 extensions_input = (
290 '<input id="extensions_evolve" '
291 'name="extensions_evolve" type="checkbox" '
292 'value="True" checked="checked" />')
293 response.mustcontain(extensions_input)
294
278 def test_has_a_section_for_pull_request_settings(self, app):
295 def test_has_a_section_for_pull_request_settings(self, app):
279 response = app.get(url('admin_settings_vcs'))
296 response = app.get(url('admin_settings_vcs'))
280 response.mustcontain('Pull Request Settings')
297 response.mustcontain('Pull Request Settings')
@@ -500,7 +500,8 b' class TestCreateOrUpdateUi(object):'
500 def test_update(self, repo_stub, settings_util):
500 def test_update(self, repo_stub, settings_util):
501 model = VcsSettingsModel(repo=repo_stub.repo_name)
501 model = VcsSettingsModel(repo=repo_stub.repo_name)
502
502
503 largefiles, phases = model.HG_SETTINGS
503 largefiles, phases, evolve = model.HG_SETTINGS
504
504 section = 'test-section'
505 section = 'test-section'
505 key = 'test-key'
506 key = 'test-key'
506 settings_util.create_repo_rhodecode_ui(
507 settings_util.create_repo_rhodecode_ui(
@@ -519,6 +520,7 b' class TestCreateOrUpdateUi(object):'
519 class TestCreateOrUpdateRepoHgSettings(object):
520 class TestCreateOrUpdateRepoHgSettings(object):
520 FORM_DATA = {
521 FORM_DATA = {
521 'extensions_largefiles': False,
522 'extensions_largefiles': False,
523 'extensions_evolve': False,
522 'phases_publish': False
524 'phases_publish': False
523 }
525 }
524
526
@@ -529,6 +531,8 b' class TestCreateOrUpdateRepoHgSettings(o'
529 expected_calls = [
531 expected_calls = [
530 mock.call(model.repo_settings, 'extensions', 'largefiles',
532 mock.call(model.repo_settings, 'extensions', 'largefiles',
531 active=False, value=''),
533 active=False, value=''),
534 mock.call(model.repo_settings, 'extensions', 'evolve',
535 active=False, value=''),
532 mock.call(model.repo_settings, 'phases', 'publish', value='False'),
536 mock.call(model.repo_settings, 'phases', 'publish', value='False'),
533 ]
537 ]
534 assert expected_calls == create_mock.call_args_list
538 assert expected_calls == create_mock.call_args_list
@@ -574,7 +578,8 b' class TestCreateOrUpdateGlobalHgSettings'
574 'extensions_largefiles': False,
578 'extensions_largefiles': False,
575 'largefiles_usercache': '/example/largefiles-store',
579 'largefiles_usercache': '/example/largefiles-store',
576 'phases_publish': False,
580 'phases_publish': False,
577 'extensions_hgsubversion': False
581 'extensions_hgsubversion': False,
582 'extensions_evolve': False
578 }
583 }
579
584
580 def test_creates_repo_hg_settings_when_data_is_correct(self):
585 def test_creates_repo_hg_settings_when_data_is_correct(self):
@@ -589,7 +594,9 b' class TestCreateOrUpdateGlobalHgSettings'
589 mock.call(model.global_settings, 'phases', 'publish',
594 mock.call(model.global_settings, 'phases', 'publish',
590 value='False'),
595 value='False'),
591 mock.call(model.global_settings, 'extensions', 'hgsubversion',
596 mock.call(model.global_settings, 'extensions', 'hgsubversion',
592 active=False)
597 active=False),
598 mock.call(model.global_settings, 'extensions', 'evolve',
599 active=False, value='')
593 ]
600 ]
594 assert expected_calls == create_mock.call_args_list
601 assert expected_calls == create_mock.call_args_list
595
602
@@ -957,6 +964,7 b' class TestCreateOrUpdateRepoSettings(obj'
957 'hooks_changegroup_push_logger': False,
964 'hooks_changegroup_push_logger': False,
958 'hooks_outgoing_pull_logger': False,
965 'hooks_outgoing_pull_logger': False,
959 'extensions_largefiles': False,
966 'extensions_largefiles': False,
967 'extensions_evolve': False,
960 'largefiles_usercache': '/example/largefiles-store',
968 'largefiles_usercache': '/example/largefiles-store',
961 'vcs_git_lfs_enabled': False,
969 'vcs_git_lfs_enabled': False,
962 'vcs_git_lfs_store_location': '/',
970 'vcs_git_lfs_store_location': '/',
General Comments 0
You need to be logged in to leave comments. Login now