comparison tests/test-hook.t @ 33721:24849d53697d

tests: clean up many print statements to be print functions instead Differential Revision: https://phab.mercurial-scm.org/D294
author Augie Fackler <augie@google.com>
date Thu, 15 Jun 2017 14:22:25 -0400
parents be49f3fdcd10
children 10e162bb9bf5
comparison
equal deleted inserted replaced
33720:27fb986e54d0 33721:24849d53697d
407 [255] 407 [255]
408 408
409 $ cd "$TESTTMP/b" 409 $ cd "$TESTTMP/b"
410 410
411 $ cat > hooktests.py <<EOF 411 $ cat > hooktests.py <<EOF
412 > from __future__ import print_function
412 > from mercurial import error 413 > from mercurial import error
413 > 414 >
414 > uncallable = 0 415 > uncallable = 0
415 > 416 >
416 > def printargs(args): 417 > def printargs(args):
417 > args.pop('ui', None) 418 > args.pop('ui', None)
418 > args.pop('repo', None) 419 > args.pop('repo', None)
419 > a = list(args.items()) 420 > a = list(args.items())
420 > a.sort() 421 > a.sort()
421 > print 'hook args:' 422 > print('hook args:')
422 > for k, v in a: 423 > for k, v in a:
423 > print ' ', k, v 424 > print(' ', k, v)
424 > 425 >
425 > def passhook(**args): 426 > def passhook(**args):
426 > printargs(args) 427 > printargs(args)
427 > 428 >
428 > def failhook(**args): 429 > def failhook(**args):
443 > 444 >
444 > def verbosehook(ui, **args): 445 > def verbosehook(ui, **args):
445 > ui.note('verbose output from hook\n') 446 > ui.note('verbose output from hook\n')
446 > 447 >
447 > def printtags(ui, repo, **args): 448 > def printtags(ui, repo, **args):
448 > print sorted(repo.tags()) 449 > print(sorted(repo.tags()))
449 > 450 >
450 > class container: 451 > class container:
451 > unreachable = 1 452 > unreachable = 1
452 > EOF 453 > EOF
453 454
628 $ hg init c 629 $ hg init c
629 $ cd c 630 $ cd c
630 631
631 $ cat > hookext.py <<EOF 632 $ cat > hookext.py <<EOF
632 > def autohook(**args): 633 > def autohook(**args):
633 > print "Automatically installed hook" 634 > print("Automatically installed hook")
634 > 635 >
635 > def reposetup(ui, repo): 636 > def reposetup(ui, repo):
636 > repo.ui.setconfig("hooks", "commit.auto", autohook) 637 > repo.ui.setconfig("hooks", "commit.auto", autohook)
637 > EOF 638 > EOF
638 $ echo '[extensions]' >> .hg/hgrc 639 $ echo '[extensions]' >> .hg/hgrc
665 $ mkdir hooks 666 $ mkdir hooks
666 667
667 $ cd hooks 668 $ cd hooks
668 $ cat > testhooks.py <<EOF 669 $ cat > testhooks.py <<EOF
669 > def testhook(**args): 670 > def testhook(**args):
670 > print 'hook works' 671 > print('hook works')
671 > EOF 672 > EOF
672 $ echo '[hooks]' > ../repo/.hg/hgrc 673 $ echo '[hooks]' > ../repo/.hg/hgrc
673 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc 674 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
674 675
675 $ cd ../repo 676 $ cd ../repo