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