##// END OF EJS Templates
Change git & hg hooks to post. They shouldn't block as they are used just for logging actions. Futhermore post hooks have access to changesets, so it's much better flexible
marcink -
r2407:8a68e029 beta
parent child Browse files
Show More
@@ -138,7 +138,7 b' def log_push_action(ui, repo, **kwargs):'
138 138
139 139 stop, start = get_revs(repo, [node + ':'])
140 140 h = binascii.hexlify
141 revs = (h(repo[r].node()) for r in xrange(start, stop + 1))
141 revs = [h(repo[r].node()) for r in xrange(start, stop + 1)]
142 142 elif scm == 'git':
143 143 revs = kwargs.get('_git_revs', [])
144 144 if '_git_revs' in kwargs:
@@ -198,7 +198,7 b' def log_create_repository(repository_dic'
198 198
199 199 def handle_git_post_receive(repo_path, revs, env):
200 200 """
201 A really hacky method that is runned by git pre-receive hook and logs
201 A really hacky method that is runned by git post-receive hook and logs
202 202 an push action together with pushed revisions. It's runned by subprocess
203 203 thus needs all info to be able to create a temp pylons enviroment, connect
204 204 to database and run the logging code. Hacky as sh**t but works. ps.
@@ -271,7 +271,7 b' class SimpleGit(BaseVCSController):'
271 271
272 272 def _handle_githooks(self, repo_name, action, baseui, environ):
273 273 """
274 Handles pull action, push is handled by pre-receive hook
274 Handles pull action, push is handled by post-receive hook
275 275 """
276 276 from rhodecode.lib.hooks import log_pull_action
277 277 service = environ['QUERY_STRING'].split('=')
@@ -238,7 +238,7 b' class RhodeCodeUi(Base, BaseModel):'
238 238
239 239 HOOK_UPDATE = 'changegroup.update'
240 240 HOOK_REPO_SIZE = 'changegroup.repo_size'
241 HOOK_PUSH = 'pretxnchangegroup.push_logger'
241 HOOK_PUSH = 'changegroup.push_logger'
242 242 HOOK_PULL = 'preoutgoing.pull_logger'
243 243
244 244 ui_id = Column("ui_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
@@ -731,7 +731,7 b' def ApplicationUiSettingsForm():'
731 731 paths_root_path = All(ValidPath(), UnicodeString(strip=True, min=1, not_empty=True))
732 732 hooks_changegroup_update = OneOf(['True', 'False'], if_missing=False)
733 733 hooks_changegroup_repo_size = OneOf(['True', 'False'], if_missing=False)
734 hooks_pretxnchangegroup_push_logger = OneOf(['True', 'False'], if_missing=False)
734 hooks_changegroup_push_logger = OneOf(['True', 'False'], if_missing=False)
735 735 hooks_preoutgoing_pull_logger = OneOf(['True', 'False'], if_missing=False)
736 736
737 737 return _ApplicationUiSettingsForm
@@ -476,7 +476,7 b' class RepoModel(BaseModel):'
476 476 tmpl = pkg_resources.resource_string(
477 477 'rhodecode', jn('config', 'pre_receive_tmpl.py')
478 478 )
479 _hook_file = jn(loc, 'pre-receive')
479 _hook_file = jn(loc, 'post-receive')
480 480 with open(_hook_file, 'wb') as f:
481 481 f.write(tmpl)
482 482 os.chmod(_hook_file, 0555)
@@ -148,8 +148,8 b''
148 148 <label for="hooks_changegroup_repo_size">${_('Show repository size after push')}</label>
149 149 </div>
150 150 <div class="checkbox">
151 ${h.checkbox('hooks_pretxnchangegroup_push_logger','True')}
152 <label for="hooks_pretxnchangegroup_push_logger">${_('Log user push commands')}</label>
151 ${h.checkbox('hooks_changegroup_push_logger','True')}
152 <label for="hooks_changegroup_push_logger">${_('Log user push commands')}</label>
153 153 </div>
154 154 <div class="checkbox">
155 155 ${h.checkbox('hooks_preoutgoing_pull_logger','True')}
General Comments 0
You need to be logged in to leave comments. Login now