diff --git a/docs/admin/tuning-change-large-file-dir.rst b/docs/admin/tuning-change-large-file-dir.rst --- a/docs/admin/tuning-change-large-file-dir.rst +++ b/docs/admin/tuning-change-large-file-dir.rst @@ -7,26 +7,8 @@ Change the |hg| Large Files Location :file:`/home/{user}/repos/.cache/largefiles`. If you wish to change this, use the following steps: -1. Open ishell from the terminal and use it to log into the |RCE| database by - specifying the instance :file:`rhodecode.ini` file. - -.. code-block:: bash - - # Open iShell from the terminal and set ini file - $ rccontrol ishell enterprise-1 - -2. Run the following commands, and ensure that |RCE| has write access to the - new directory: +1. Open :menuselection:`Admin --> Settings --> VCS` as super-admin. -.. code-block:: bash +In section called `Mercurial Settings` you can change where the largefiles +objects should be stored. - # Once logged into the database, use SQL to redirect - # the large files location - In [1]: from rhodecode.model.settings import SettingsModel - In [2]: SettingsModel().get_ui_by_key('usercache') - Out[2]: /mnt/hgfs/shared/workspace/xxxx/.cache/largefiles]> - - In [3]: largefiles_cache = SettingsModel().get_ui_by_key('usercache') - In [4]: largefiles_cache.ui_value = '/new/path’ - In [5]: Session().add(largefiles_cache);Session().commit() - diff --git a/rhodecode/config/utils.py b/rhodecode/config/utils.py --- a/rhodecode/config/utils.py +++ b/rhodecode/config/utils.py @@ -59,9 +59,13 @@ def initialize_test_environment(settings create_test_directory, create_test_database, create_test_repositories, create_test_index) from rhodecode.tests import TESTS_TMP_PATH + from rhodecode.lib.vcs.backends.hg import largefiles_store # test repos if test_env: create_test_directory(TESTS_TMP_PATH) + # large object stores + create_test_directory(largefiles_store(TESTS_TMP_PATH)) + create_test_database(TESTS_TMP_PATH, settings) create_test_repositories(TESTS_TMP_PATH, settings) create_test_index(TESTS_TMP_PATH, settings) diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -396,6 +396,10 @@ def ApplicationUiSettingsForm(): v.ValidPath(), v.UnicodeString(strip=True, min=1, not_empty=True) ) + largefiles_usercache = All( + v.ValidPath(), + v.UnicodeString(strip=True, min=2, not_empty=True) + ) extensions_hgsubversion = v.StringBoolean(if_missing=False) extensions_hggit = v.StringBoolean(if_missing=False) new_svn_branch = v.ValidSvnPattern(section='vcs_svn_branch') diff --git a/rhodecode/model/settings.py b/rhodecode/model/settings.py --- a/rhodecode/model/settings.py +++ b/rhodecode/model/settings.py @@ -416,6 +416,7 @@ class VcsSettingsModel(object): ('phases', 'publish')) GLOBAL_HG_SETTINGS = ( ('extensions', 'largefiles'), + ('largefiles', 'usercache'), ('phases', 'publish'), ('extensions', 'hgsubversion')) GLOBAL_SVN_SETTINGS = ( @@ -543,13 +544,18 @@ class VcsSettingsModel(object): self.repo_settings, *phases, value=safe_str(data[phases_key])) def create_or_update_global_hg_settings(self, data): - largefiles, phases, hgsubversion = self.GLOBAL_HG_SETTINGS - largefiles_key, phases_key, subversion_key = self._get_settings_keys( - self.GLOBAL_HG_SETTINGS, data) + largefiles, largefiles_store, phases, hgsubversion \ + = self.GLOBAL_HG_SETTINGS + largefiles_key, largefiles_store_key, phases_key, subversion_key \ + = self._get_settings_keys(self.GLOBAL_HG_SETTINGS, data) + self._create_or_update_ui( self.global_settings, *largefiles, value='', active=data[largefiles_key]) self._create_or_update_ui( + self.global_settings, *largefiles_store, + value=data[largefiles_store_key]) + self._create_or_update_ui( self.global_settings, *phases, value=safe_str(data[phases_key])) self._create_or_update_ui( self.global_settings, *hgsubversion, active=data[subversion_key]) 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 @@ -96,8 +96,24 @@
- ${_('Enable Largefiles extensions for all repositories.')} + % if display_globals: + ${_('Enable Largefiles extensions for all repositories.')} + % else: + ${_('Enable Largefiles extensions for this repository.')} + % endif
+ + % if display_globals: +
+
+ ${h.text('largefiles_usercache' + suffix, size=59)} +
+
+
+ ${_('Filesystem location where Mercurial largefile objects should be stored.')} +
+ % endif +
${h.checkbox('phases_publish' + suffix, 'True', **kwargs)} 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 @@ -566,6 +566,7 @@ class TestUpdateGlobalPathSetting(object class TestCreateOrUpdateGlobalHgSettings(object): FORM_DATA = { 'extensions_largefiles': False, + 'largefiles_usercache': '/example/largefiles-store', 'phases_publish': False, 'extensions_hgsubversion': False } @@ -577,6 +578,8 @@ class TestCreateOrUpdateGlobalHgSettings expected_calls = [ mock.call(model.global_settings, 'extensions', 'largefiles', active=False, value=''), + mock.call(model.global_settings, 'largefiles', 'usercache', + value='/example/largefiles-store'), mock.call(model.global_settings, 'phases', 'publish', value='False'), mock.call(model.global_settings, 'extensions', 'hgsubversion', @@ -638,6 +641,7 @@ class TestFilterUiSettings(object): 'test_tag', True), ] non_repo_settings = [ + UiSetting('largefiles', 'usercache', '/example/largefiles-store', True), UiSetting('test', 'outgoing.pull_logger', 'hook', True), UiSetting('hooks', 'test2', 'hook', True), UiSetting( @@ -928,6 +932,7 @@ class TestCreateOrUpdateRepoSettings(obj 'hooks_changegroup_push_logger': False, 'hooks_outgoing_pull_logger': False, 'extensions_largefiles': False, + 'largefiles_usercache': '/example/largefiles-store', 'phases_publish': 'false', 'rhodecode_pr_merge_enabled': False, 'rhodecode_use_outdated_comments': False,