Project

General

Profile

Actions

Bug #4105

closed

[vcs] Recursive lookup of SVN root repo also tries to lookup hg and git repos

Added by Martin Bornhold over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Start date:
18.07.2016
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

Description

When checking if a path is a valid repository we have to treat the SVN case in a special way. SVN allows to also access subdirectories as if they were a repository. This results in commit-requests to paths like this "/all-repos/svn-repo/subdir1/subdir2/". To find the root repository directory "all-repos/svn-repo" we have to check upwards all path elements until we find a directory which is not a SVN repository (assuming that the the initial path is a SVN repository).

The log output looks like we are not only checking on SVN repositories but also HG and GIT when going upwards the path. And we are also doing this if the initial path is not a SVN repository. This may lead to an invalid return value of the "is_valid_repository" method. Imagine a case where the "/all-repos" directory itself is a repository. If we are checking "is_valid_repo_path('/all-repos/no-repo-here')" it will tell us that there is a valid repository at "/all-repos" instead of "not there is no repo at '/all-repos/no-repo-here'"

This is exactly what happens on jenkins, all repos are stored in another repo. This is the log output from jenkins:

=================================== FAILURES ===================================
______________________________ test_get_repo_err _______________________________

    def test_get_repo_err():
        blank_repo_path = os.path.join(TESTS_TMP_PATH, 'blank-error-repo')
        if os.path.isdir(blank_repo_path):
            shutil.rmtree(blank_repo_path)

        os.mkdir(blank_repo_path)
>       pytest.raises(VCSError, get_repo, blank_repo_path)
E       Failed: DID NOT RAISE

rhodecode/tests/vcs/test_vcs.py:101: Failed
------------------------------ Captured log call -------------------------------
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121/tmp/rc_test_TplK5u/blank-error-repo
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19c34d0, connected, for PYRO:git_remote@localhost:42034>@assert_correct_path
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121/tmp/rc_test_TplK5u/blank-error-repo
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19c3590, connected, for PYRO:svn_remote@localhost:42034>@is_path_valid_repository
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121/tmp/rc_test_TplK5u
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19c34d0, connected, for PYRO:git_remote@localhost:42034>@assert_correct_path
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121/tmp/rc_test_TplK5u
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19c3590, connected, for PYRO:svn_remote@localhost:42034>@is_path_valid_repository
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121/tmp
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19c34d0, connected, for PYRO:git_remote@localhost:42034>@assert_correct_path
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121/tmp
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19c3590, connected, for PYRO:svn_remote@localhost:42034>@is_path_valid_repository
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19c34d0, connected, for PYRO:git_remote@localhost:42034>@assert_correct_path
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19c3590, connected, for PYRO:svn_remote@localhost:42034>@is_path_valid_repository
client.py                  183 DEBUG    RepoMaker call on /home/jenkins/workspace/rhodecode-enterprise-commits/jenkins-rhodecode-enterprise-commits-121
client.py                  271 DEBUG    Calling <Pyro4.core.Proxy at 0x7fd6c19a7ed0, connected, for PYRO:hg_remote@localhost:42034>@localrepository
Actions #1

Updated by Martin Bornhold over 8 years ago

  • Status changed from New to In Progress
Actions #2

Updated by Martin Bornhold over 8 years ago

  • Status changed from In Progress to Resolved

The code which causes the error is trying to lookup the vcs repo instance for a given path. The problem is that it does not stop at the root dir of repositories. In a case where this root dir itself is contained in a repository it returns unwanted results.

While fixing this it turns out that it is used only at rhodecode.models.db.Gist.scm_instance but there is no need here to look upwards the path to find a repo. Therfore i refactored the code to remove the unused parts which are causing trouble.

Fix included in https://internal-code.rhodecode.com/rhodecode-enterprise-ce/pull-request/2475

Actions #3

Updated by Marcin Kuzminski [CTO] over 8 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF