Show More
@@ -15,10 +15,16 b'' | |||||
15 | # along with this program; if not, write to the Free Software Foundation, |
|
15 | # along with this program; if not, write to the Free Software Foundation, | |
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 |
|
17 | |||
18 |
import |
|
18 | import os | |
19 |
|
19 | |||
20 |
|
20 | |||
21 | __version__ = pkgutil.get_data('vcsserver', 'VERSION').strip().decode() |
|
21 | def get_version(): | |
|
22 | here = os.path.abspath(os.path.dirname(__file__)) | |||
|
23 | ver_file = os.path.join(here, "VERSION") | |||
|
24 | with open(ver_file, "rt") as f: | |||
|
25 | version = f.read().strip() | |||
|
26 | ||||
|
27 | return version | |||
22 |
|
28 | |||
23 | # link to config for pyramid |
|
29 | # link to config for pyramid | |
24 | CONFIG = {} |
|
30 | CONFIG = {} |
@@ -87,7 +87,7 b' def install_git_hooks(repo_path, bare, e' | |||||
87 | log.debug('writing git %s hook file at %s !', h_type, _hook_file) |
|
87 | log.debug('writing git %s hook file at %s !', h_type, _hook_file) | |
88 | try: |
|
88 | try: | |
89 | with open(_hook_file, 'wb') as f: |
|
89 | with open(_hook_file, 'wb') as f: | |
90 |
template = template.replace(b'_TMPL_', safe_bytes(vcsserver. |
|
90 | template = template.replace(b'_TMPL_', safe_bytes(vcsserver.get_version())) | |
91 | template = template.replace(b'_DATE_', safe_bytes(timestamp)) |
|
91 | template = template.replace(b'_DATE_', safe_bytes(timestamp)) | |
92 | template = template.replace(b'_ENV_', safe_bytes(executable)) |
|
92 | template = template.replace(b'_ENV_', safe_bytes(executable)) | |
93 | template = template.replace(b'_PATH_', safe_bytes(path)) |
|
93 | template = template.replace(b'_PATH_', safe_bytes(path)) | |
@@ -140,7 +140,7 b' def install_svn_hooks(repo_path, executa' | |||||
140 |
|
140 | |||
141 | try: |
|
141 | try: | |
142 | with open(_hook_file, 'wb') as f: |
|
142 | with open(_hook_file, 'wb') as f: | |
143 |
template = template.replace(b'_TMPL_', safe_bytes(vcsserver. |
|
143 | template = template.replace(b'_TMPL_', safe_bytes(vcsserver.get_version())) | |
144 | template = template.replace(b'_DATE_', safe_bytes(timestamp)) |
|
144 | template = template.replace(b'_DATE_', safe_bytes(timestamp)) | |
145 | template = template.replace(b'_ENV_', safe_bytes(executable)) |
|
145 | template = template.replace(b'_ENV_', safe_bytes(executable)) | |
146 | template = template.replace(b'_PATH_', safe_bytes(path)) |
|
146 | template = template.replace(b'_PATH_', safe_bytes(path)) |
@@ -465,7 +465,7 b' class HTTPApplication:' | |||||
465 |
|
465 | |||
466 | return { |
|
466 | return { | |
467 | "status": "OK", |
|
467 | "status": "OK", | |
468 |
"vcsserver_version": vcsserver. |
|
468 | "vcsserver_version": vcsserver.get_version(), | |
469 | "platform": _platform_id, |
|
469 | "platform": _platform_id, | |
470 | "pid": os.getpid(), |
|
470 | "pid": os.getpid(), | |
471 | } |
|
471 | } | |
@@ -495,7 +495,7 b' class HTTPApplication:' | |||||
495 | resp = { |
|
495 | resp = { | |
496 | 'id': payload.get('id'), |
|
496 | 'id': payload.get('id'), | |
497 | 'result': dict( |
|
497 | 'result': dict( | |
498 |
version=vcsserver. |
|
498 | version=vcsserver.get_version(), | |
499 | config=server_config, |
|
499 | config=server_config, | |
500 | app_config=app_config, |
|
500 | app_config=app_config, | |
501 | environ=environ, |
|
501 | environ=environ, |
@@ -1178,8 +1178,8 b' class HgRemote(RemoteBase):' | |||||
1178 | @reraise_safe_exceptions |
|
1178 | @reraise_safe_exceptions | |
1179 | def get_hooks_info(self, wire): |
|
1179 | def get_hooks_info(self, wire): | |
1180 | return { |
|
1180 | return { | |
1181 |
'pre_version': vcsserver. |
|
1181 | 'pre_version': vcsserver.get_version(), | |
1182 |
'post_version': vcsserver. |
|
1182 | 'post_version': vcsserver.get_version(), | |
1183 | } |
|
1183 | } | |
1184 |
|
1184 | |||
1185 | @reraise_safe_exceptions |
|
1185 | @reraise_safe_exceptions |
@@ -82,7 +82,7 b' class BaseInstallHooks:' | |||||
82 | content = hook_file.read() |
|
82 | content = hook_file.read() | |
83 |
|
83 | |||
84 | expected_env = '#!{}'.format(executable) |
|
84 | expected_env = '#!{}'.format(executable) | |
85 |
expected_rc_version = "\nRC_HOOK_VER = '{}'\n".format(vcsserver. |
|
85 | expected_rc_version = "\nRC_HOOK_VER = '{}'\n".format(vcsserver.get_version()) | |
86 | assert content.strip().startswith(expected_env) |
|
86 | assert content.strip().startswith(expected_env) | |
87 | assert expected_rc_version in content |
|
87 | assert expected_rc_version in content | |
88 |
|
88 |
@@ -76,7 +76,7 b' class RequestWrapperTween:' | |||||
76 | repo_name = call_context.get('X-RC-Repo-Name', '') |
|
76 | repo_name = call_context.get('X-RC-Repo-Name', '') | |
77 |
|
77 | |||
78 | count = request.request_count() |
|
78 | count = request.request_count() | |
79 |
_ver_ = vcsserver. |
|
79 | _ver_ = vcsserver.get_version() | |
80 | _path = safe_str(get_access_path(request.environ)) |
|
80 | _path = safe_str(get_access_path(request.environ)) | |
81 |
|
81 | |||
82 | ip = '127.0.0.1' |
|
82 | ip = '127.0.0.1' |
General Comments 0
You need to be logged in to leave comments.
Login now