ssh: handle subrepos better
This commit is contained in:
parent
1f15dd1741
commit
5df5d7893b
1 changed files with 15 additions and 4 deletions
|
|
@ -93,12 +93,21 @@ class SshWrapper(object):
|
|||
return conn
|
||||
|
||||
def maybe_translate_repo_uid(self, repo_name):
|
||||
_org_name = repo_name
|
||||
if _org_name.startswith('_'):
|
||||
# remove format of _ID/subrepo
|
||||
_org_name = _org_name.split('/', 1)[0]
|
||||
|
||||
if repo_name.startswith('_'):
|
||||
from rhodecode.model.repo import RepoModel
|
||||
org_repo_name = repo_name
|
||||
log.debug('translating UID repo %s', org_repo_name)
|
||||
by_id_match = RepoModel().get_repo_by_id(repo_name)
|
||||
if by_id_match:
|
||||
repo_name = by_id_match.repo_name
|
||||
return repo_name
|
||||
log.debug('translation of UID repo %s got `%s`', org_repo_name, repo_name)
|
||||
|
||||
return repo_name, _org_name
|
||||
|
||||
def get_repo_details(self, mode):
|
||||
vcs_type = mode if mode in ['svn', 'hg', 'git'] else None
|
||||
|
|
@ -107,14 +116,16 @@ class SshWrapper(object):
|
|||
hg_match = self.hg_cmd_pat.match(self.command)
|
||||
if hg_match is not None:
|
||||
vcs_type = 'hg'
|
||||
repo_name = self.maybe_translate_repo_uid(hg_match.group(1).strip('/'))
|
||||
repo_id = hg_match.group(1).strip('/')
|
||||
repo_name, org_name = self.maybe_translate_repo_uid(repo_id)
|
||||
return vcs_type, repo_name, mode
|
||||
|
||||
git_match = self.git_cmd_pat.match(self.command)
|
||||
if git_match is not None:
|
||||
vcs_type = 'git'
|
||||
repo_name = self.maybe_translate_repo_uid(git_match.group(2).strip('/'))
|
||||
mode = git_match.group(1)
|
||||
vcs_type = 'git'
|
||||
repo_id = git_match.group(2).strip('/')
|
||||
repo_name, org_name = self.maybe_translate_repo_uid(repo_id)
|
||||
return vcs_type, repo_name, mode
|
||||
|
||||
svn_match = self.svn_cmd_pat.match(self.command)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue