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