gists: define and use explicit Mercurial backend to speed up creation and fetching of backend repo
This commit is contained in:
parent
7b4415eaf1
commit
ba0940ba94
3 changed files with 10 additions and 3 deletions
|
|
@ -67,7 +67,6 @@ class GistView(BaseAppView):
|
|||
(Gist.ACL_LEVEL_PUBLIC, _("Can be accessed by anonymous users"))
|
||||
]
|
||||
|
||||
|
||||
return c
|
||||
|
||||
@LoginRequired()
|
||||
|
|
|
|||
|
|
@ -4260,9 +4260,16 @@ class Gist(Base, BaseModel):
|
|||
# SCM functions
|
||||
|
||||
def scm_instance(self, **kwargs):
|
||||
"""
|
||||
Get explicit Mercurial repository used
|
||||
:param kwargs:
|
||||
:return:
|
||||
"""
|
||||
from rhodecode.model.gist import GistModel
|
||||
full_repo_path = os.path.join(self.base_path(), self.gist_access_id)
|
||||
return get_vcs_instance(
|
||||
repo_path=safe_str(full_repo_path), create=False)
|
||||
repo_path=safe_str(full_repo_path), create=False,
|
||||
_vcs_alias=GistModel.vcs_backend)
|
||||
|
||||
|
||||
class ExternalIdentity(Base, BaseModel):
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ GIST_METADATA_FILE = '.rc_gist_metadata'
|
|||
|
||||
class GistModel(BaseModel):
|
||||
cls = Gist
|
||||
vcs_backend = 'hg'
|
||||
|
||||
def _get_gist(self, gist):
|
||||
"""
|
||||
|
|
@ -145,7 +146,7 @@ class GistModel(BaseModel):
|
|||
gist_repo_path = os.path.join(GIST_STORE_LOC, gist_id)
|
||||
log.debug('Creating new %s GIST repo in %s', gist_type, gist_repo_path)
|
||||
repo = RepoModel()._create_filesystem_repo(
|
||||
repo_name=gist_id, repo_type='hg', repo_group=GIST_STORE_LOC,
|
||||
repo_name=gist_id, repo_type=self.vcs_backend, repo_group=GIST_STORE_LOC,
|
||||
use_global_config=True)
|
||||
|
||||
# now create single multifile commit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue