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