mercurial: allow editing largefile store from web interface.
This commit is contained in:
parent
0b8e1a6a6f
commit
aa95986678
6 changed files with 42 additions and 25 deletions
|
|
@ -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.
|
||||
1. Open :menuselection:`Admin --> Settings --> VCS` as super-admin.
|
||||
|
||||
.. 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:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# 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]: <RhodeCodeUi[largefiles]usercache=>/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()
|
||||
In section called `Mercurial Settings` you can change where the largefiles
|
||||
objects should be stored.
|
||||
|
||||
|
|
|
|||
|
|
@ -59,9 +59,13 @@ def initialize_test_environment(settings, test_env=None):
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -416,6 +416,7 @@ class VcsSettingsModel(object):
|
|||
('phases', 'publish'))
|
||||
GLOBAL_HG_SETTINGS = (
|
||||
('extensions', 'largefiles'),
|
||||
('largefiles', 'usercache'),
|
||||
('phases', 'publish'),
|
||||
('extensions', 'hgsubversion'))
|
||||
GLOBAL_SVN_SETTINGS = (
|
||||
|
|
@ -543,12 +544,17 @@ 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(
|
||||
|
|
|
|||
|
|
@ -96,8 +96,24 @@
|
|||
<label for="extensions_largefiles${suffix}">${_('Enable largefiles extension')}</label>
|
||||
</div>
|
||||
<div class="label">
|
||||
<span class="help-block">${_('Enable Largefiles extensions for all repositories.')}</span>
|
||||
% if display_globals:
|
||||
<span class="help-block">${_('Enable Largefiles extensions for all repositories.')}</span>
|
||||
% else:
|
||||
<span class="help-block">${_('Enable Largefiles extensions for this repository.')}</span>
|
||||
% endif
|
||||
</div>
|
||||
|
||||
% if display_globals:
|
||||
<div class="field">
|
||||
<div class="input">
|
||||
${h.text('largefiles_usercache' + suffix, size=59)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="label">
|
||||
<span class="help-block">${_('Filesystem location where Mercurial largefile objects should be stored.')}</span>
|
||||
</div>
|
||||
% endif
|
||||
|
||||
<div class="checkbox">
|
||||
${h.checkbox('phases_publish' + suffix, 'True', **kwargs)}
|
||||
<label for="phases_publish${suffix}">${_('Set repositories as publishing') if display_globals else _('Set repository as publishing')}</label>
|
||||
|
|
|
|||
|
|
@ -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(object):
|
|||
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(object):
|
|||
'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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue