##// END OF EJS Templates
feat(ssh-wrapper): added pre/post pull hooks on top of git for ssh backend....
super-admin -
r5302:399d1dbe default
parent child Browse files
Show More
@@ -118,6 +118,7 b' class VcsServer(object):'
118 if extras:
118 if extras:
119 scm_data.update(extras)
119 scm_data.update(extras)
120 os.putenv("RC_SCM_DATA", json.dumps(scm_data))
120 os.putenv("RC_SCM_DATA", json.dumps(scm_data))
121 return scm_data
121
122
122 def get_root_store(self):
123 def get_root_store(self):
123 root_store = self.store
124 root_store = self.store
@@ -16,10 +16,11 b''
16 # RhodeCode Enterprise Edition, including its added features, Support services,
16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 import os
20 import sys
19 import sys
21 import logging
20 import logging
21 import subprocess
22
22
23 from vcsserver import hooks
23 from .base import VcsServer
24 from .base import VcsServer
24
25
25 log = logging.getLogger(__name__)
26 log = logging.getLogger(__name__)
@@ -50,9 +51,22 b' class GitTunnelWrapper(object):'
50 if exit_code:
51 if exit_code:
51 return exit_code
52 return exit_code
52
53
53 self.server.update_environment(action=action, extras=extras)
54 scm_extras = self.server.update_environment(action=action, extras=extras)
55
56 hook_response = hooks.git_pre_pull(scm_extras)
57 pre_pull_messages = hook_response.output
58 sys.stdout.write(pre_pull_messages)
59
54 self.create_hooks_env()
60 self.create_hooks_env()
55 return os.system(self.command())
61 result = subprocess.run(self.command(), shell=True)
62 result = result.returncode
63
64 # Upload-pack == clone
65 if action == "pull":
66 hook_response = hooks.git_post_pull(scm_extras)
67 post_pull_messages = hook_response.output
68 sys.stderr.write(post_pull_messages)
69 return result
56
70
57
71
58 class GitServer(VcsServer):
72 class GitServer(VcsServer):
General Comments 0
You need to be logged in to leave comments. Login now