backends: don't detect backends when initializing db based vcs-instance.
This skips some calls back to vcsserver.
This commit is contained in:
parent
f76d8139cb
commit
01518d41f6
2 changed files with 11 additions and 3 deletions
|
|
@ -22,6 +22,7 @@
|
|||
VCS Backends module
|
||||
"""
|
||||
|
||||
import os
|
||||
import logging
|
||||
|
||||
from pprint import pformat
|
||||
|
|
@ -42,11 +43,18 @@ def get_vcs_instance(repo_path, *args, **kwargs):
|
|||
for the path it returns None. Arguments and keyword arguments are passed
|
||||
to the vcs backend repository class.
|
||||
"""
|
||||
explicit_vcs_alias = kwargs.pop('_vcs_alias', None)
|
||||
try:
|
||||
vcs_alias = get_scm(repo_path)[0]
|
||||
vcs_alias = explicit_vcs_alias or get_scm(repo_path)[0]
|
||||
log.debug(
|
||||
'Creating instance of %s repository from %s', vcs_alias, repo_path)
|
||||
backend = get_backend(vcs_alias)
|
||||
|
||||
if explicit_vcs_alias:
|
||||
# do final verification of existance of the path, this does the
|
||||
# same as get_scm() call which we skip in explicit_vcs_alias
|
||||
if not os.path.isdir(repo_path):
|
||||
raise VCSError("Given path %s is not a directory" % repo_path)
|
||||
except VCSError:
|
||||
log.exception(
|
||||
'Perhaps this repository is in db and not in '
|
||||
|
|
|
|||
|
|
@ -1987,12 +1987,12 @@ class Repository(Base, BaseModel):
|
|||
custom_wire = {
|
||||
'cache': cache # controls the vcs.remote cache
|
||||
}
|
||||
|
||||
repo = get_vcs_instance(
|
||||
repo_path=safe_str(self.repo_full_path),
|
||||
config=config,
|
||||
with_wire=custom_wire,
|
||||
create=False)
|
||||
create=False,
|
||||
_vcs_alias=self.repo_type)
|
||||
|
||||
return repo
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue