##// END OF EJS Templates
backends: don't detect backends when initializing db based vcs-instance....
marcink -
r1127:ed2556a8 default
parent child Browse files
Show More
@@ -22,6 +22,7 b''
22 VCS Backends module
22 VCS Backends module
23 """
23 """
24
24
25 import os
25 import logging
26 import logging
26
27
27 from pprint import pformat
28 from pprint import pformat
@@ -42,11 +43,18 b' def get_vcs_instance(repo_path, *args, *'
42 for the path it returns None. Arguments and keyword arguments are passed
43 for the path it returns None. Arguments and keyword arguments are passed
43 to the vcs backend repository class.
44 to the vcs backend repository class.
44 """
45 """
46 explicit_vcs_alias = kwargs.pop('_vcs_alias', None)
45 try:
47 try:
46 vcs_alias = get_scm(repo_path)[0]
48 vcs_alias = explicit_vcs_alias or get_scm(repo_path)[0]
47 log.debug(
49 log.debug(
48 'Creating instance of %s repository from %s', vcs_alias, repo_path)
50 'Creating instance of %s repository from %s', vcs_alias, repo_path)
49 backend = get_backend(vcs_alias)
51 backend = get_backend(vcs_alias)
52
53 if explicit_vcs_alias:
54 # do final verification of existance of the path, this does the
55 # same as get_scm() call which we skip in explicit_vcs_alias
56 if not os.path.isdir(repo_path):
57 raise VCSError("Given path %s is not a directory" % repo_path)
50 except VCSError:
58 except VCSError:
51 log.exception(
59 log.exception(
52 'Perhaps this repository is in db and not in '
60 'Perhaps this repository is in db and not in '
@@ -1987,12 +1987,12 b' class Repository(Base, BaseModel):'
1987 custom_wire = {
1987 custom_wire = {
1988 'cache': cache # controls the vcs.remote cache
1988 'cache': cache # controls the vcs.remote cache
1989 }
1989 }
1990
1991 repo = get_vcs_instance(
1990 repo = get_vcs_instance(
1992 repo_path=safe_str(self.repo_full_path),
1991 repo_path=safe_str(self.repo_full_path),
1993 config=config,
1992 config=config,
1994 with_wire=custom_wire,
1993 with_wire=custom_wire,
1995 create=False)
1994 create=False,
1995 _vcs_alias=self.repo_type)
1996
1996
1997 return repo
1997 return repo
1998
1998
General Comments 0
You need to be logged in to leave comments. Login now