##// 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 1902 "id": 237,
1903 1903 "result": {
1904 1904 "extensions_largefiles": true,
1905 "extensions_evolve": true,
1905 1906 "hooks_changegroup_push_logger": true,
1906 1907 "hooks_changegroup_repo_size": false,
1907 1908 "hooks_outgoing_pull_logger": true,
@@ -363,6 +363,14 b' class DbManage(object):'
363 363 hgsubversion.ui_active = False
364 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 374 # enable hggit disabled by default
367 375 hggit = RhodeCodeUi()
368 376 hggit.ui_section = 'extensions'
@@ -171,6 +171,16 b' class MercurialCommit(base.BaseCommit):'
171 171 return safe_unicode(phase_text)
172 172
173 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 184 def children(self):
175 185 """
176 186 Returns list of child commits.
@@ -384,6 +384,7 b' class _BaseVcsSettingsForm(formencode.Sc'
384 384
385 385 # hg
386 386 extensions_largefiles = v.StringBoolean(if_missing=False)
387 extensions_evolve = v.StringBoolean(if_missing=False)
387 388 phases_publish = v.StringBoolean(if_missing=False)
388 389 rhodecode_hg_use_rebase_for_merging = v.StringBoolean(if_missing=False)
389 390
@@ -415,15 +415,16 b' class VcsSettingsModel(object):'
415 415 ('hooks', 'outgoing.pull_logger'),)
416 416 HG_SETTINGS = (
417 417 ('extensions', 'largefiles'),
418 ('phases', 'publish'),)
418 ('phases', 'publish'),
419 ('extensions', 'evolve'),)
419 420 GIT_SETTINGS = (
420 421 ('vcs_git_lfs', 'enabled'),)
421
422 422 GLOBAL_HG_SETTINGS = (
423 423 ('extensions', 'largefiles'),
424 424 ('largefiles', 'usercache'),
425 425 ('phases', 'publish'),
426 ('extensions', 'hgsubversion'))
426 ('extensions', 'hgsubversion'),
427 ('extensions', 'evolve'),)
427 428 GLOBAL_GIT_SETTINGS = (
428 429 ('vcs_git_lfs', 'enabled'),
429 430 ('vcs_git_lfs', 'store_location'))
@@ -546,22 +547,26 b' class VcsSettingsModel(object):'
546 547
547 548 @assert_repo_settings
548 549 def create_or_update_repo_hg_settings(self, data):
549 largefiles, phases = \
550 largefiles, phases, evolve = \
550 551 self.HG_SETTINGS
551 largefiles_key, phases_key = \
552 largefiles_key, phases_key, evolve_key = \
552 553 self._get_settings_keys(self.HG_SETTINGS, data)
553 554
554 555 self._create_or_update_ui(
555 556 self.repo_settings, *largefiles, value='',
556 557 active=data[largefiles_key])
557 558 self._create_or_update_ui(
559 self.repo_settings, *evolve, value='',
560 active=data[evolve_key])
561 self._create_or_update_ui(
558 562 self.repo_settings, *phases, value=safe_str(data[phases_key]))
559 563
560 564 def create_or_update_global_hg_settings(self, data):
561 largefiles, largefiles_store, phases, hgsubversion \
565 largefiles, largefiles_store, phases, hgsubversion, evolve \
562 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 568 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS, data)
569
565 570 self._create_or_update_ui(
566 571 self.global_settings, *largefiles, value='',
567 572 active=data[largefiles_key])
@@ -572,6 +577,9 b' class VcsSettingsModel(object):'
572 577 self.global_settings, *phases, value=safe_str(data[phases_key]))
573 578 self._create_or_update_ui(
574 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 584 def create_or_update_repo_git_settings(self, data):
577 585 # NOTE(marcink): # comma make unpack work properly
@@ -108,6 +108,11 b' table.dataTable {'
108 108 &.td-hash {
109 109 min-width: 80px;
110 110 width: 200px;
111
112 .obsolete {
113 text-decoration: line-through;
114 color: lighten(@grey2,25%);
115 }
111 116 }
112 117
113 118 &.td-time {
@@ -130,6 +130,19 b''
130 130 <span class="help-block">${_('Requires hgsubversion library to be installed. Allows cloning remote SVN repositories and migrates them to Mercurial type.')}</span>
131 131 </div>
132 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 146 </div>
134 147 </div>
135 148 ## LABS for HG
@@ -46,13 +46,28 b''
46 46 <td class="td-hash">
47 47 <code>
48 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 50 </a>
51 51 % if hasattr(commit, 'phase'):
52 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 54 % endif
55 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 71 </code>
57 72 </td>
58 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 37 <code>
38 38 ${h.show_id(c.commit)}
39 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 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 57 </code>
43 58 </h4>
44 59 </span>
@@ -581,6 +581,7 b' class TestVcsSettings(object):'
581 581 'hooks_changegroup_push_logger': False,
582 582 'hooks_outgoing_pull_logger': False,
583 583 'extensions_largefiles': False,
584 'extensions_evolve': False,
584 585 'phases_publish': 'False',
585 586 'rhodecode_pr_merge_enabled': False,
586 587 'rhodecode_use_outdated_comments': False,
@@ -275,6 +275,23 b' class TestAdminSettingsVcs(object):'
275 275 'value="True" checked="checked" />')
276 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 295 def test_has_a_section_for_pull_request_settings(self, app):
279 296 response = app.get(url('admin_settings_vcs'))
280 297 response.mustcontain('Pull Request Settings')
@@ -500,7 +500,8 b' class TestCreateOrUpdateUi(object):'
500 500 def test_update(self, repo_stub, settings_util):
501 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 505 section = 'test-section'
505 506 key = 'test-key'
506 507 settings_util.create_repo_rhodecode_ui(
@@ -519,6 +520,7 b' class TestCreateOrUpdateUi(object):'
519 520 class TestCreateOrUpdateRepoHgSettings(object):
520 521 FORM_DATA = {
521 522 'extensions_largefiles': False,
523 'extensions_evolve': False,
522 524 'phases_publish': False
523 525 }
524 526
@@ -529,6 +531,8 b' class TestCreateOrUpdateRepoHgSettings(o'
529 531 expected_calls = [
530 532 mock.call(model.repo_settings, 'extensions', 'largefiles',
531 533 active=False, value=''),
534 mock.call(model.repo_settings, 'extensions', 'evolve',
535 active=False, value=''),
532 536 mock.call(model.repo_settings, 'phases', 'publish', value='False'),
533 537 ]
534 538 assert expected_calls == create_mock.call_args_list
@@ -574,7 +578,8 b' class TestCreateOrUpdateGlobalHgSettings'
574 578 'extensions_largefiles': False,
575 579 'largefiles_usercache': '/example/largefiles-store',
576 580 'phases_publish': False,
577 'extensions_hgsubversion': False
581 'extensions_hgsubversion': False,
582 'extensions_evolve': False
578 583 }
579 584
580 585 def test_creates_repo_hg_settings_when_data_is_correct(self):
@@ -589,7 +594,9 b' class TestCreateOrUpdateGlobalHgSettings'
589 594 mock.call(model.global_settings, 'phases', 'publish',
590 595 value='False'),
591 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 601 assert expected_calls == create_mock.call_args_list
595 602
@@ -957,6 +964,7 b' class TestCreateOrUpdateRepoSettings(obj'
957 964 'hooks_changegroup_push_logger': False,
958 965 'hooks_outgoing_pull_logger': False,
959 966 'extensions_largefiles': False,
967 'extensions_evolve': False,
960 968 'largefiles_usercache': '/example/largefiles-store',
961 969 'vcs_git_lfs_enabled': False,
962 970 'vcs_git_lfs_store_location': '/',
General Comments 0
You need to be logged in to leave comments. Login now