diff --git a/rhodecode/config/utils.py b/rhodecode/config/utils.py --- a/rhodecode/config/utils.py +++ b/rhodecode/config/utils.py @@ -60,11 +60,14 @@ def initialize_test_environment(settings create_test_index) from rhodecode.tests import TESTS_TMP_PATH from rhodecode.lib.vcs.backends.hg import largefiles_store + from rhodecode.lib.vcs.backends.git import lfs_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_directory(lfs_store(TESTS_TMP_PATH)) create_test_database(TESTS_TMP_PATH, settings) create_test_repositories(TESTS_TMP_PATH, settings) diff --git a/rhodecode/lib/db_manage.py b/rhodecode/lib/db_manage.py --- a/rhodecode/lib/db_manage.py +++ b/rhodecode/lib/db_manage.py @@ -307,6 +307,7 @@ class DbManage(object): """ settings_model = SettingsModel(sa=self.sa) from rhodecode.lib.vcs.backends.hg import largefiles_store + from rhodecode.lib.vcs.backends.git import lfs_store # Build HOOKS hooks = [ @@ -345,6 +346,15 @@ class DbManage(object): self.sa.add(largefiles) + # set default lfs cache dir, defaults to + # /repo_store_location/.cache/lfs_store + lfsstore = RhodeCodeUi() + lfsstore.ui_section = 'vcs_git_lfs' + lfsstore.ui_key = 'store_location' + lfsstore.ui_value = lfs_store(repo_store_path) + + self.sa.add(lfsstore) + # enable hgsubversion disabled by default hgsubversion = RhodeCodeUi() hgsubversion.ui_section = 'extensions' diff --git a/rhodecode/lib/vcs/backends/git/__init__.py b/rhodecode/lib/vcs/backends/git/__init__.py --- a/rhodecode/lib/vcs/backends/git/__init__.py +++ b/rhodecode/lib/vcs/backends/git/__init__.py @@ -21,7 +21,7 @@ """ GIT module """ - +import os import logging from rhodecode.lib.vcs import connection @@ -47,3 +47,10 @@ def discover_git_version(raise_on_exc=Fa if raise_on_exc: raise return '' + + +def lfs_store(base_location): + """ + Return a lfs store relative to base_location + """ + return os.path.join(base_location, '.cache', 'lfs_store') diff --git a/rhodecode/tests/database/conftest.py b/rhodecode/tests/database/conftest.py --- a/rhodecode/tests/database/conftest.py +++ b/rhodecode/tests/database/conftest.py @@ -94,6 +94,7 @@ class DBBackend(object): connection_string=None): from rhodecode.lib.vcs.backends.hg import largefiles_store + from rhodecode.lib.vcs.backends.git import lfs_store self.fixture_store = os.path.join(self._store, self._type) self.db_name = db_name or self._base_db_name @@ -103,6 +104,7 @@ class DBBackend(object): self._basetemp = basetemp or tempfile.gettempdir() self._repos_location = os.path.join(self._basetemp, 'rc_test_repos') self._repos_hg_largefiles_store = largefiles_store(self._basetemp) + self._repos_git_lfs_store = lfs_store(self._basetemp) self.connection_string = connection_string @property @@ -156,10 +158,13 @@ class DBBackend(object): ini_params.extend(self._db_url) with TestINI(self._base_ini_file, ini_params, self._type, destroy=True) as _ini_file: + if not os.path.isdir(self._repos_location): os.makedirs(self._repos_location) if not os.path.isdir(self._repos_hg_largefiles_store): os.makedirs(self._repos_hg_largefiles_store) + if not os.path.isdir(self._repos_git_lfs_store): + os.makedirs(self._repos_git_lfs_store) self.execute( "paster setup-rhodecode {0} --user=marcink "