def pretxnclose(ui, repo, node=None, source=None, txnname=None, **kwargs): # Only run hooks on a `push` transaction. `commit`, etc are not relevant if txnname != b"push": return 0 checks = get_checks(ui, repo, source, get_check_classes(b'pretxnclose')) with timers(ui, b'mozhooks', b'mozhooks.pretxnclose.') as times: for check in checks: with times.timeit(check.name): check.pre(node) for rev in repo.changelog.revs(repo[node].rev()): ctx = repo[rev] for check in checks: with times.timeit(check.name): if not check.check(ctx): return 1 for check in checks: with times.timeit(check.name): if not check.post_check(): return 1 return 0
def changegroup(ui, repo, source=None, **kwargs): checks = get_checks(ui, repo, source, get_check_classes(b'changegroup')) with timers(ui, b'mozhooks', b'mozhooks.changegroup.') as times: for check in checks: with times.timeit(check.name): if not check.check(**kwargs): return 1 return 0
def pretxnchangegroup(ui, repo, node, source=None, **kwargs): checks = get_checks(ui, repo, source, get_check_classes(b'pretxnchangegroup')) with timers(ui, b'mozhooks', b'mozhooks.pretxnchangegroup.') as times: for check in checks: with times.timeit(check.name): check.pre(node) for rev in repo.changelog.revs(repo[node].rev()): ctx = repo[rev] for check in checks: with times.timeit(check.name): if not check.check(ctx): return 1 for check in checks: with times.timeit(check.name): if not check.post_check(): return 1 return 0