##// END OF EJS Templates
gists: define and use explicit Mercurial backend to speed up creation and fetching of backend repo
marcink -
r3536:5ee2c115 default
parent child Browse files
Show More
@@ -67,7 +67,6 b' class GistView(BaseAppView):'
67 (Gist.ACL_LEVEL_PUBLIC, _("Can be accessed by anonymous users"))
67 (Gist.ACL_LEVEL_PUBLIC, _("Can be accessed by anonymous users"))
68 ]
68 ]
69
69
70
71 return c
70 return c
72
71
73 @LoginRequired()
72 @LoginRequired()
@@ -4260,9 +4260,16 b' class Gist(Base, BaseModel):'
4260 # SCM functions
4260 # SCM functions
4261
4261
4262 def scm_instance(self, **kwargs):
4262 def scm_instance(self, **kwargs):
4263 """
4264 Get explicit Mercurial repository used
4265 :param kwargs:
4266 :return:
4267 """
4268 from rhodecode.model.gist import GistModel
4263 full_repo_path = os.path.join(self.base_path(), self.gist_access_id)
4269 full_repo_path = os.path.join(self.base_path(), self.gist_access_id)
4264 return get_vcs_instance(
4270 return get_vcs_instance(
4265 repo_path=safe_str(full_repo_path), create=False)
4271 repo_path=safe_str(full_repo_path), create=False,
4272 _vcs_alias=GistModel.vcs_backend)
4266
4273
4267
4274
4268 class ExternalIdentity(Base, BaseModel):
4275 class ExternalIdentity(Base, BaseModel):
@@ -47,6 +47,7 b" GIST_METADATA_FILE = '.rc_gist_metadata'"
47
47
48 class GistModel(BaseModel):
48 class GistModel(BaseModel):
49 cls = Gist
49 cls = Gist
50 vcs_backend = 'hg'
50
51
51 def _get_gist(self, gist):
52 def _get_gist(self, gist):
52 """
53 """
@@ -145,7 +146,7 b' class GistModel(BaseModel):'
145 gist_repo_path = os.path.join(GIST_STORE_LOC, gist_id)
146 gist_repo_path = os.path.join(GIST_STORE_LOC, gist_id)
146 log.debug('Creating new %s GIST repo in %s', gist_type, gist_repo_path)
147 log.debug('Creating new %s GIST repo in %s', gist_type, gist_repo_path)
147 repo = RepoModel()._create_filesystem_repo(
148 repo = RepoModel()._create_filesystem_repo(
148 repo_name=gist_id, repo_type='hg', repo_group=GIST_STORE_LOC,
149 repo_name=gist_id, repo_type=self.vcs_backend, repo_group=GIST_STORE_LOC,
149 use_global_config=True)
150 use_global_config=True)
150
151
151 # now create single multifile commit
152 # now create single multifile commit
General Comments 0
You need to be logged in to leave comments. Login now