##// END OF EJS Templates
ssh: use pre-compiled backends for faster matching of vcs detection.
super-admin -
r4702:c3d9862a stable
parent child Browse files
Show More
@@ -34,6 +34,9 b' log = logging.getLogger(__name__)'
34 34
35 35
36 36 class SshWrapper(object):
37 hg_cmd_pat = re.compile(r'^hg\s+\-R\s+(\S+)\s+serve\s+\-\-stdio$')
38 git_cmd_pat = re.compile(r'^git-(receive-pack|upload-pack)\s\'[/]?(\S+?)(|\.git)\'$')
39 svn_cmd_pat = re.compile(r'^svnserve -t')
37 40
38 41 def __init__(self, command, connection_info, mode,
39 42 user, user_id, key_id, shell, ini_path, env):
@@ -101,24 +104,20 b' class SshWrapper(object):'
101 104 vcs_type = mode if mode in ['svn', 'hg', 'git'] else None
102 105 repo_name = None
103 106
104 hg_pattern = r'^hg\s+\-R\s+(\S+)\s+serve\s+\-\-stdio$'
105 hg_match = re.match(hg_pattern, self.command)
107 hg_match = self.hg_cmd_pat.match(self.command)
106 108 if hg_match is not None:
107 109 vcs_type = 'hg'
108 110 repo_name = self.maybe_translate_repo_uid(hg_match.group(1).strip('/'))
109 111 return vcs_type, repo_name, mode
110 112
111 git_pattern = r'^git-(receive-pack|upload-pack)\s\'[/]?(\S+?)(|\.git)\'$'
112 git_match = re.match(git_pattern, self.command)
113 git_match = self.git_cmd_pat.match(self.command)
113 114 if git_match is not None:
114 115 vcs_type = 'git'
115 116 repo_name = self.maybe_translate_repo_uid(git_match.group(2).strip('/'))
116 117 mode = git_match.group(1)
117 118 return vcs_type, repo_name, mode
118 119
119 svn_pattern = r'^svnserve -t'
120 svn_match = re.match(svn_pattern, self.command)
121
120 svn_match = self.svn_cmd_pat.match(self.command)
122 121 if svn_match is not None:
123 122 vcs_type = 'svn'
124 123 # Repo name should be extracted from the input stream, we're unable to
General Comments 0
You need to be logged in to leave comments. Login now