Show More
@@ -413,20 +413,18 b' preoutgoing hook can prevent outgoing ch' | |||||
413 | > |
|
413 | > | |
414 | > uncallable = 0 |
|
414 | > uncallable = 0 | |
415 | > |
|
415 | > | |
416 | > def printargs(args): |
|
416 | > def printargs(ui, args): | |
417 | > args.pop('ui', None) |
|
|||
418 | > args.pop('repo', None) |
|
|||
419 | > a = list(args.items()) |
|
417 | > a = list(args.items()) | |
420 | > a.sort() |
|
418 | > a.sort() | |
421 |
> |
|
419 | > ui.write('hook args:\n') | |
422 | > for k, v in a: |
|
420 | > for k, v in a: | |
423 |
> |
|
421 | > ui.write(' %s %s\n' % (k, v)) | |
424 | > |
|
422 | > | |
425 | > def passhook(**args): |
|
423 | > def passhook(ui, repo, **args): | |
426 | > printargs(args) |
|
424 | > printargs(ui, args) | |
427 | > |
|
425 | > | |
428 | > def failhook(**args): |
|
426 | > def failhook(ui, repo, **args): | |
429 | > printargs(args) |
|
427 | > printargs(ui, args) | |
430 | > return True |
|
428 | > return True | |
431 | > |
|
429 | > | |
432 | > class LocalException(Exception): |
|
430 | > class LocalException(Exception): | |
@@ -445,7 +443,7 b' preoutgoing hook can prevent outgoing ch' | |||||
445 | > ui.note('verbose output from hook\n') |
|
443 | > ui.note('verbose output from hook\n') | |
446 | > |
|
444 | > | |
447 | > def printtags(ui, repo, **args): |
|
445 | > def printtags(ui, repo, **args): | |
448 |
> |
|
446 | > ui.write('%s\n' % sorted(repo.tags())) | |
449 | > |
|
447 | > | |
450 | > class container: |
|
448 | > class container: | |
451 | > unreachable = 1 |
|
449 | > unreachable = 1 | |
@@ -629,8 +627,8 b' make sure --traceback works' | |||||
629 | $ cd c |
|
627 | $ cd c | |
630 |
|
628 | |||
631 | $ cat > hookext.py <<EOF |
|
629 | $ cat > hookext.py <<EOF | |
632 | > def autohook(**args): |
|
630 | > def autohook(ui, **args): | |
633 |
> |
|
631 | > ui.write('Automatically installed hook\n') | |
634 | > |
|
632 | > | |
635 | > def reposetup(ui, repo): |
|
633 | > def reposetup(ui, repo): | |
636 | > repo.ui.setconfig("hooks", "commit.auto", autohook) |
|
634 | > repo.ui.setconfig("hooks", "commit.auto", autohook) | |
@@ -666,8 +664,8 b' test python hook configured with python:' | |||||
666 |
|
664 | |||
667 | $ cd hooks |
|
665 | $ cd hooks | |
668 | $ cat > testhooks.py <<EOF |
|
666 | $ cat > testhooks.py <<EOF | |
669 | > def testhook(**args): |
|
667 | > def testhook(ui, **args): | |
670 |
> |
|
668 | > ui.write('hook works\n') | |
671 | > EOF |
|
669 | > EOF | |
672 | $ echo '[hooks]' > ../repo/.hg/hgrc |
|
670 | $ echo '[hooks]' > ../repo/.hg/hgrc | |
673 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc |
|
671 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc |
General Comments 0
You need to be logged in to leave comments.
Login now