##// END OF EJS Templates
ssh: handle subrepos better
super-admin -
r4703:3248f2d8 stable
parent child Browse files
Show More
@@ -93,12 +93,21 b' class SshWrapper(object):'
93 return conn
93 return conn
94
94
95 def maybe_translate_repo_uid(self, repo_name):
95 def maybe_translate_repo_uid(self, repo_name):
96 _org_name = repo_name
97 if _org_name.startswith('_'):
98 # remove format of _ID/subrepo
99 _org_name = _org_name.split('/', 1)[0]
100
96 if repo_name.startswith('_'):
101 if repo_name.startswith('_'):
97 from rhodecode.model.repo import RepoModel
102 from rhodecode.model.repo import RepoModel
103 org_repo_name = repo_name
104 log.debug('translating UID repo %s', org_repo_name)
98 by_id_match = RepoModel().get_repo_by_id(repo_name)
105 by_id_match = RepoModel().get_repo_by_id(repo_name)
99 if by_id_match:
106 if by_id_match:
100 repo_name = by_id_match.repo_name
107 repo_name = by_id_match.repo_name
101 return repo_name
108 log.debug('translation of UID repo %s got `%s`', org_repo_name, repo_name)
109
110 return repo_name, _org_name
102
111
103 def get_repo_details(self, mode):
112 def get_repo_details(self, mode):
104 vcs_type = mode if mode in ['svn', 'hg', 'git'] else None
113 vcs_type = mode if mode in ['svn', 'hg', 'git'] else None
@@ -107,14 +116,16 b' class SshWrapper(object):'
107 hg_match = self.hg_cmd_pat.match(self.command)
116 hg_match = self.hg_cmd_pat.match(self.command)
108 if hg_match is not None:
117 if hg_match is not None:
109 vcs_type = 'hg'
118 vcs_type = 'hg'
110 repo_name = self.maybe_translate_repo_uid(hg_match.group(1).strip('/'))
119 repo_id = hg_match.group(1).strip('/')
120 repo_name, org_name = self.maybe_translate_repo_uid(repo_id)
111 return vcs_type, repo_name, mode
121 return vcs_type, repo_name, mode
112
122
113 git_match = self.git_cmd_pat.match(self.command)
123 git_match = self.git_cmd_pat.match(self.command)
114 if git_match is not None:
124 if git_match is not None:
125 mode = git_match.group(1)
115 vcs_type = 'git'
126 vcs_type = 'git'
116 repo_name = self.maybe_translate_repo_uid(git_match.group(2).strip('/'))
127 repo_id = git_match.group(2).strip('/')
117 mode = git_match.group(1)
128 repo_name, org_name = self.maybe_translate_repo_uid(repo_id)
118 return vcs_type, repo_name, mode
129 return vcs_type, repo_name, mode
119
130
120 svn_match = self.svn_cmd_pat.match(self.command)
131 svn_match = self.svn_cmd_pat.match(self.command)
General Comments 0
You need to be logged in to leave comments. Login now