tests/test-hook
changeset 2298 4be9a79b49b1
parent 2283 e506c14382fd
child 2673 109a22f5434a
equal deleted inserted replaced
2253:ccd5f17f1eea 2298:4be9a79b49b1
    27 hg commit -m a1 -d "1 0"
    27 hg commit -m a1 -d "1 0"
    28 hg update -C 0
    28 hg update -C 0
    29 echo b > b
    29 echo b > b
    30 hg add b
    30 hg add b
    31 hg commit -m b -d '1 0'
    31 hg commit -m b -d '1 0'
    32 hg update -m 1
    32 hg merge 1
    33 hg commit -m merge -d '2 0'
    33 hg commit -m merge -d '2 0'
    34 
    34 
    35 cd ../b
    35 cd ../b
    36 hg pull ../a
    36 hg pull ../a
    37 
    37 
    58 
    58 
    59 # precommit hook can prevent commit
    59 # precommit hook can prevent commit
    60 echo 'precommit.forbid = echo precommit.forbid hook; exit 1' >> .hg/hgrc
    60 echo 'precommit.forbid = echo precommit.forbid hook; exit 1' >> .hg/hgrc
    61 hg commit -m 'fail' -d '4 0'
    61 hg commit -m 'fail' -d '4 0'
    62 hg -q tip
    62 hg -q tip
       
    63 
       
    64 # preupdate hook can prevent update
       
    65 echo 'preupdate = echo preupdate hook: p1=$HG_PARENT1 p2=$HG_PARENT2' >> .hg/hgrc
       
    66 hg update 1
       
    67 
       
    68 # update hook
       
    69 echo 'update = echo update hook: p1=$HG_PARENT1 p2=$HG_PARENT2 err=$HG_ERROR' >> .hg/hgrc
       
    70 hg update
    63 
    71 
    64 # prechangegroup hook can prevent incoming changes
    72 # prechangegroup hook can prevent incoming changes
    65 cd ../b
    73 cd ../b
    66 hg -q tip
    74 hg -q tip
    67 echo '[hooks]' > .hg/hgrc
    75 echo '[hooks]' > .hg/hgrc