Show More
@@ -36,3 +36,4 b' be788a89a939ebd63606220064bd624fa9d5c9c9' | |||||
36 | 15c90a04098a373ac761fab07695fd80dde3bcdb v4.11.5 |
|
36 | 15c90a04098a373ac761fab07695fd80dde3bcdb v4.11.5 | |
37 | 77aff155b3251cc00394a49f5e8f2c99e33149a7 v4.11.6 |
|
37 | 77aff155b3251cc00394a49f5e8f2c99e33149a7 v4.11.6 | |
38 | c218a1ce5d370c2e671d42a91684b3fc2c91b81d v4.12.0 |
|
38 | c218a1ce5d370c2e671d42a91684b3fc2c91b81d v4.12.0 | |
|
39 | 80085fb846cc948195a5c76b579ca34cbc49b59b v4.12.1 |
@@ -25,7 +25,7 b' def main():' | |||||
25 | # this allows simply push to this repo even without rhodecode |
|
25 | # this allows simply push to this repo even without rhodecode | |
26 | sys.exit(0) |
|
26 | sys.exit(0) | |
27 |
|
27 | |||
28 | if os.environ.get('RC_SKIP_HOOKS'): |
|
28 | if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_GIT_HOOKS'): | |
29 | sys.exit(0) |
|
29 | sys.exit(0) | |
30 |
|
30 | |||
31 | repo_path = os.getcwd() |
|
31 | repo_path = os.getcwd() |
@@ -25,7 +25,7 b' def main():' | |||||
25 | # this allows simply push to this repo even without rhodecode |
|
25 | # this allows simply push to this repo even without rhodecode | |
26 | sys.exit(0) |
|
26 | sys.exit(0) | |
27 |
|
27 | |||
28 | if os.environ.get('RC_SKIP_HOOKS'): |
|
28 | if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_GIT_HOOKS'): | |
29 | sys.exit(0) |
|
29 | sys.exit(0) | |
30 |
|
30 | |||
31 | repo_path = os.getcwd() |
|
31 | repo_path = os.getcwd() |
@@ -26,7 +26,7 b' def main():' | |||||
26 | # this allows simply push to this repo even without rhodecode |
|
26 | # this allows simply push to this repo even without rhodecode | |
27 | sys.exit(0) |
|
27 | sys.exit(0) | |
28 |
|
28 | |||
29 | if os.environ.get('RC_SKIP_HOOKS'): |
|
29 | if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_SVN_HOOKS'): | |
30 | sys.exit(0) |
|
30 | sys.exit(0) | |
31 | repo_path = os.getcwd() |
|
31 | repo_path = os.getcwd() | |
32 | push_data = sys.argv[1:] |
|
32 | push_data = sys.argv[1:] |
@@ -29,7 +29,7 b' def main():' | |||||
29 | # exit with success if we cannot import vcsserver.hooks !! |
|
29 | # exit with success if we cannot import vcsserver.hooks !! | |
30 | # this allows simply push to this repo even without rhodecode |
|
30 | # this allows simply push to this repo even without rhodecode | |
31 | sys.exit(0) |
|
31 | sys.exit(0) | |
32 | if os.environ.get('RC_SKIP_HOOKS'): |
|
32 | if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_SVN_HOOKS'): | |
33 | sys.exit(0) |
|
33 | sys.exit(0) | |
34 | repo_path = os.getcwd() |
|
34 | repo_path = os.getcwd() | |
35 | push_data = sys.argv[1:] |
|
35 | push_data = sys.argv[1:] |
@@ -485,17 +485,33 b' def git_post_receive(unused_repo_path, r' | |||||
485 | return _call_hook('post_push', extras, GitMessageWriter()) |
|
485 | return _call_hook('post_push', extras, GitMessageWriter()) | |
486 |
|
486 | |||
487 |
|
487 | |||
|
488 | def _get_extras_from_txn_id(path, txn_id): | |||
|
489 | extras = {} | |||
|
490 | try: | |||
|
491 | cmd = ['svnlook', 'pget', | |||
|
492 | '-t', txn_id, | |||
|
493 | '--revprop', path, 'rc-scm-extras'] | |||
|
494 | stdout, stderr = subprocessio.run_command( | |||
|
495 | cmd, env=os.environ.copy()) | |||
|
496 | extras = json.loads(base64.urlsafe_b64decode(stdout)) | |||
|
497 | except Exception: | |||
|
498 | log.exception('Failed to extract extras info from txn_id') | |||
|
499 | ||||
|
500 | return extras | |||
|
501 | ||||
|
502 | ||||
488 | def svn_pre_commit(repo_path, commit_data, env): |
|
503 | def svn_pre_commit(repo_path, commit_data, env): | |
489 | path, txn_id = commit_data |
|
504 | path, txn_id = commit_data | |
490 | branches = [] |
|
505 | branches = [] | |
491 | tags = [] |
|
506 | tags = [] | |
492 |
|
507 | |||
493 | cmd = ['svnlook', 'pget', |
|
508 | if env.get('RC_SCM_DATA'): | |
494 | '-t', txn_id, |
|
509 | extras = json.loads(env['RC_SCM_DATA']) | |
495 | '--revprop', path, 'rc-scm-extras'] |
|
510 | else: | |
496 | stdout, stderr = subprocessio.run_command( |
|
511 | # fallback method to read from TXN-ID stored data | |
497 | cmd, env=os.environ.copy()) |
|
512 | extras = _get_extras_from_txn_id(path, txn_id) | |
498 | extras = json.loads(base64.urlsafe_b64decode(stdout)) |
|
513 | if not extras: | |
|
514 | return 0 | |||
499 |
|
515 | |||
500 | extras['commit_ids'] = [] |
|
516 | extras['commit_ids'] = [] | |
501 | extras['txn_id'] = txn_id |
|
517 | extras['txn_id'] = txn_id | |
@@ -504,10 +520,25 b' def svn_pre_commit(repo_path, commit_dat' | |||||
504 | 'bookmarks': [], |
|
520 | 'bookmarks': [], | |
505 | 'tags': tags, |
|
521 | 'tags': tags, | |
506 | } |
|
522 | } | |
507 | sys.stderr.write(str(extras)) |
|
523 | ||
508 | return _call_hook('pre_push', extras, SvnMessageWriter()) |
|
524 | return _call_hook('pre_push', extras, SvnMessageWriter()) | |
509 |
|
525 | |||
510 |
|
526 | |||
|
527 | def _get_extras_from_commit_id(commit_id, path): | |||
|
528 | extras = {} | |||
|
529 | try: | |||
|
530 | cmd = ['svnlook', 'pget', | |||
|
531 | '-r', commit_id, | |||
|
532 | '--revprop', path, 'rc-scm-extras'] | |||
|
533 | stdout, stderr = subprocessio.run_command( | |||
|
534 | cmd, env=os.environ.copy()) | |||
|
535 | extras = json.loads(base64.urlsafe_b64decode(stdout)) | |||
|
536 | except Exception: | |||
|
537 | log.exception('Failed to extract extras info from commit_id') | |||
|
538 | ||||
|
539 | return extras | |||
|
540 | ||||
|
541 | ||||
511 | def svn_post_commit(repo_path, commit_data, env): |
|
542 | def svn_post_commit(repo_path, commit_data, env): | |
512 | """ |
|
543 | """ | |
513 | commit_data is path, rev, txn_id |
|
544 | commit_data is path, rev, txn_id | |
@@ -516,13 +547,13 b' def svn_post_commit(repo_path, commit_da' | |||||
516 | branches = [] |
|
547 | branches = [] | |
517 | tags = [] |
|
548 | tags = [] | |
518 |
|
549 | |||
519 | cmd = ['svnlook', 'pget', |
|
550 | if env.get('RC_SCM_DATA'): | |
520 | '-r', commit_id, |
|
551 | extras = json.loads(env['RC_SCM_DATA']) | |
521 | '--revprop', path, 'rc-scm-extras'] |
|
552 | else: | |
522 | stdout, stderr = subprocessio.run_command( |
|
553 | # fallback method to read from TXN-ID stored data | |
523 | cmd, env=os.environ.copy()) |
|
554 | extras = _get_extras_from_commit_id(commit_id, path) | |
524 |
|
555 | if not extras: | ||
525 | extras = json.loads(base64.urlsafe_b64decode(stdout)) |
|
556 | return 0 | |
526 |
|
557 | |||
527 | extras['commit_ids'] = [commit_id] |
|
558 | extras['commit_ids'] = [commit_id] | |
528 | extras['txn_id'] = txn_id |
|
559 | extras['txn_id'] = txn_id | |
@@ -535,9 +566,7 b' def svn_post_commit(repo_path, commit_da' | |||||
535 | if 'repo_size' in extras['hooks']: |
|
566 | if 'repo_size' in extras['hooks']: | |
536 | try: |
|
567 | try: | |
537 | _call_hook('repo_size', extras, SvnMessageWriter()) |
|
568 | _call_hook('repo_size', extras, SvnMessageWriter()) | |
538 | except: |
|
569 | except Exception: | |
539 | pass |
|
570 | pass | |
540 |
|
571 | |||
541 | return _call_hook('post_push', extras, SvnMessageWriter()) |
|
572 | return _call_hook('post_push', extras, SvnMessageWriter()) | |
542 |
|
||||
543 |
|
General Comments 0
You need to be logged in to leave comments.
Login now