##// END OF EJS Templates
mercurial: allow editing largefile store from web interface.
marcink -
r1563:d4c84e02 default
parent child Browse files
Show More
@@ -7,26 +7,8 b' Change the |hg| Large Files Location'
7 :file:`/home/{user}/repos/.cache/largefiles`. If you wish to change this, use
7 :file:`/home/{user}/repos/.cache/largefiles`. If you wish to change this, use
8 the following steps:
8 the following steps:
9
9
10 1. Open ishell from the terminal and use it to log into the |RCE| database by
10 1. Open :menuselection:`Admin --> Settings --> VCS` as super-admin.
11 specifying the instance :file:`rhodecode.ini` file.
12
13 .. code-block:: bash
14
15 # Open iShell from the terminal and set ini file
16 $ rccontrol ishell enterprise-1
17
18 2. Run the following commands, and ensure that |RCE| has write access to the
19 new directory:
20
11
21 .. code-block:: bash
12 In section called `Mercurial Settings` you can change where the largefiles
13 objects should be stored.
22
14
23 # Once logged into the database, use SQL to redirect
24 # the large files location
25 In [1]: from rhodecode.model.settings import SettingsModel
26 In [2]: SettingsModel().get_ui_by_key('usercache')
27 Out[2]: <RhodeCodeUi[largefiles]usercache=>/mnt/hgfs/shared/workspace/xxxx/.cache/largefiles]>
28
29 In [3]: largefiles_cache = SettingsModel().get_ui_by_key('usercache')
30 In [4]: largefiles_cache.ui_value = '/new/path’
31 In [5]: Session().add(largefiles_cache);Session().commit()
32
@@ -59,9 +59,13 b' def initialize_test_environment(settings'
59 create_test_directory, create_test_database, create_test_repositories,
59 create_test_directory, create_test_database, create_test_repositories,
60 create_test_index)
60 create_test_index)
61 from rhodecode.tests import TESTS_TMP_PATH
61 from rhodecode.tests import TESTS_TMP_PATH
62 from rhodecode.lib.vcs.backends.hg import largefiles_store
62 # test repos
63 # test repos
63 if test_env:
64 if test_env:
64 create_test_directory(TESTS_TMP_PATH)
65 create_test_directory(TESTS_TMP_PATH)
66 # large object stores
67 create_test_directory(largefiles_store(TESTS_TMP_PATH))
68
65 create_test_database(TESTS_TMP_PATH, settings)
69 create_test_database(TESTS_TMP_PATH, settings)
66 create_test_repositories(TESTS_TMP_PATH, settings)
70 create_test_repositories(TESTS_TMP_PATH, settings)
67 create_test_index(TESTS_TMP_PATH, settings)
71 create_test_index(TESTS_TMP_PATH, settings)
@@ -396,6 +396,10 b' def ApplicationUiSettingsForm():'
396 v.ValidPath(),
396 v.ValidPath(),
397 v.UnicodeString(strip=True, min=1, not_empty=True)
397 v.UnicodeString(strip=True, min=1, not_empty=True)
398 )
398 )
399 largefiles_usercache = All(
400 v.ValidPath(),
401 v.UnicodeString(strip=True, min=2, not_empty=True)
402 )
399 extensions_hgsubversion = v.StringBoolean(if_missing=False)
403 extensions_hgsubversion = v.StringBoolean(if_missing=False)
400 extensions_hggit = v.StringBoolean(if_missing=False)
404 extensions_hggit = v.StringBoolean(if_missing=False)
401 new_svn_branch = v.ValidSvnPattern(section='vcs_svn_branch')
405 new_svn_branch = v.ValidSvnPattern(section='vcs_svn_branch')
@@ -416,6 +416,7 b' class VcsSettingsModel(object):'
416 ('phases', 'publish'))
416 ('phases', 'publish'))
417 GLOBAL_HG_SETTINGS = (
417 GLOBAL_HG_SETTINGS = (
418 ('extensions', 'largefiles'),
418 ('extensions', 'largefiles'),
419 ('largefiles', 'usercache'),
419 ('phases', 'publish'),
420 ('phases', 'publish'),
420 ('extensions', 'hgsubversion'))
421 ('extensions', 'hgsubversion'))
421 GLOBAL_SVN_SETTINGS = (
422 GLOBAL_SVN_SETTINGS = (
@@ -543,13 +544,18 b' class VcsSettingsModel(object):'
543 self.repo_settings, *phases, value=safe_str(data[phases_key]))
544 self.repo_settings, *phases, value=safe_str(data[phases_key]))
544
545
545 def create_or_update_global_hg_settings(self, data):
546 def create_or_update_global_hg_settings(self, data):
546 largefiles, phases, hgsubversion = self.GLOBAL_HG_SETTINGS
547 largefiles, largefiles_store, phases, hgsubversion \
547 largefiles_key, phases_key, subversion_key = self._get_settings_keys(
548 = self.GLOBAL_HG_SETTINGS
548 self.GLOBAL_HG_SETTINGS, data)
549 largefiles_key, largefiles_store_key, phases_key, subversion_key \
550 = self._get_settings_keys(self.GLOBAL_HG_SETTINGS, data)
551
549 self._create_or_update_ui(
552 self._create_or_update_ui(
550 self.global_settings, *largefiles, value='',
553 self.global_settings, *largefiles, value='',
551 active=data[largefiles_key])
554 active=data[largefiles_key])
552 self._create_or_update_ui(
555 self._create_or_update_ui(
556 self.global_settings, *largefiles_store,
557 value=data[largefiles_store_key])
558 self._create_or_update_ui(
553 self.global_settings, *phases, value=safe_str(data[phases_key]))
559 self.global_settings, *phases, value=safe_str(data[phases_key]))
554 self._create_or_update_ui(
560 self._create_or_update_ui(
555 self.global_settings, *hgsubversion, active=data[subversion_key])
561 self.global_settings, *hgsubversion, active=data[subversion_key])
@@ -96,8 +96,24 b''
96 <label for="extensions_largefiles${suffix}">${_('Enable largefiles extension')}</label>
96 <label for="extensions_largefiles${suffix}">${_('Enable largefiles extension')}</label>
97 </div>
97 </div>
98 <div class="label">
98 <div class="label">
99 <span class="help-block">${_('Enable Largefiles extensions for all repositories.')}</span>
99 % if display_globals:
100 <span class="help-block">${_('Enable Largefiles extensions for all repositories.')}</span>
101 % else:
102 <span class="help-block">${_('Enable Largefiles extensions for this repository.')}</span>
103 % endif
100 </div>
104 </div>
105
106 % if display_globals:
107 <div class="field">
108 <div class="input">
109 ${h.text('largefiles_usercache' + suffix, size=59)}
110 </div>
111 </div>
112 <div class="label">
113 <span class="help-block">${_('Filesystem location where Mercurial largefile objects should be stored.')}</span>
114 </div>
115 % endif
116
101 <div class="checkbox">
117 <div class="checkbox">
102 ${h.checkbox('phases_publish' + suffix, 'True', **kwargs)}
118 ${h.checkbox('phases_publish' + suffix, 'True', **kwargs)}
103 <label for="phases_publish${suffix}">${_('Set repositories as publishing') if display_globals else _('Set repository as publishing')}</label>
119 <label for="phases_publish${suffix}">${_('Set repositories as publishing') if display_globals else _('Set repository as publishing')}</label>
@@ -566,6 +566,7 b' class TestUpdateGlobalPathSetting(object'
566 class TestCreateOrUpdateGlobalHgSettings(object):
566 class TestCreateOrUpdateGlobalHgSettings(object):
567 FORM_DATA = {
567 FORM_DATA = {
568 'extensions_largefiles': False,
568 'extensions_largefiles': False,
569 'largefiles_usercache': '/example/largefiles-store',
569 'phases_publish': False,
570 'phases_publish': False,
570 'extensions_hgsubversion': False
571 'extensions_hgsubversion': False
571 }
572 }
@@ -577,6 +578,8 b' class TestCreateOrUpdateGlobalHgSettings'
577 expected_calls = [
578 expected_calls = [
578 mock.call(model.global_settings, 'extensions', 'largefiles',
579 mock.call(model.global_settings, 'extensions', 'largefiles',
579 active=False, value=''),
580 active=False, value=''),
581 mock.call(model.global_settings, 'largefiles', 'usercache',
582 value='/example/largefiles-store'),
580 mock.call(model.global_settings, 'phases', 'publish',
583 mock.call(model.global_settings, 'phases', 'publish',
581 value='False'),
584 value='False'),
582 mock.call(model.global_settings, 'extensions', 'hgsubversion',
585 mock.call(model.global_settings, 'extensions', 'hgsubversion',
@@ -638,6 +641,7 b' class TestFilterUiSettings(object):'
638 'test_tag', True),
641 'test_tag', True),
639 ]
642 ]
640 non_repo_settings = [
643 non_repo_settings = [
644 UiSetting('largefiles', 'usercache', '/example/largefiles-store', True),
641 UiSetting('test', 'outgoing.pull_logger', 'hook', True),
645 UiSetting('test', 'outgoing.pull_logger', 'hook', True),
642 UiSetting('hooks', 'test2', 'hook', True),
646 UiSetting('hooks', 'test2', 'hook', True),
643 UiSetting(
647 UiSetting(
@@ -928,6 +932,7 b' class TestCreateOrUpdateRepoSettings(obj'
928 'hooks_changegroup_push_logger': False,
932 'hooks_changegroup_push_logger': False,
929 'hooks_outgoing_pull_logger': False,
933 'hooks_outgoing_pull_logger': False,
930 'extensions_largefiles': False,
934 'extensions_largefiles': False,
935 'largefiles_usercache': '/example/largefiles-store',
931 'phases_publish': 'false',
936 'phases_publish': 'false',
932 'rhodecode_pr_merge_enabled': False,
937 'rhodecode_pr_merge_enabled': False,
933 'rhodecode_use_outdated_comments': False,
938 'rhodecode_use_outdated_comments': False,
General Comments 0
You need to be logged in to leave comments. Login now