Show More
@@ -30,7 +30,7 def get_repo(path=None, alias=None, crea | |||
|
30 | 30 | if path is None: |
|
31 | 31 | path = abspath(os.path.curdir) |
|
32 | 32 | try: |
|
33 |
scm, path = get_scm(path, search_ |
|
|
33 | scm, path = get_scm(path, search_up=True) | |
|
34 | 34 | path = abspath(path) |
|
35 | 35 | alias = scm |
|
36 | 36 | except VCSError: |
@@ -15,14 +15,14 from rhodecode.lib.vcs.utils.paths impor | |||
|
15 | 15 | ALIASES = ['hg', 'git'] |
|
16 | 16 | |
|
17 | 17 | |
|
18 |
def get_scm(path, search_ |
|
|
18 | def get_scm(path, search_up=False, explicit_alias=None): | |
|
19 | 19 | """ |
|
20 | 20 | Returns one of alias from ``ALIASES`` (in order of precedence same as |
|
21 | 21 | shortcuts given in ``ALIASES``) and top working dir path for the given |
|
22 | 22 | argument. If no scm-specific directory is found or more than one scm is |
|
23 | 23 | found at that directory, ``VCSError`` is raised. |
|
24 | 24 | |
|
25 |
:param search_ |
|
|
25 | :param search_up: if set to ``True``, this function would try to | |
|
26 | 26 | move up to parent directory every time no scm is recognized for the |
|
27 | 27 | currently checked path. Default: ``False``. |
|
28 | 28 | :param explicit_alias: can be one of available backend aliases, when given |
@@ -37,7 +37,7 def get_scm(path, search_recursively=Fal | |||
|
37 | 37 | return [(scm, path) for scm in get_scms_for_path(path)] |
|
38 | 38 | |
|
39 | 39 | found_scms = get_scms(path) |
|
40 |
while |
|
|
40 | while not found_scms and search_up: | |
|
41 | 41 | newpath = abspath(path, '..') |
|
42 | 42 | if newpath == path: |
|
43 | 43 | break |
General Comments 0
You need to be logged in to leave comments.
Login now