Bug #4105
closed[vcs] Recursive lookup of SVN root repo also tries to lookup hg and git repos
0%
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