tests/test-pending.t
changeset 16975 921458360270
parent 16107 a3dcc59054ca
child 24822 8678b1eafbcf
equal deleted inserted replaced
16974:01ed5bb5cd41 16975:921458360270
     1   $ "$TESTDIR/hghave" system-sh || exit 80
       
     2 
       
     3 Verify that pending changesets are seen by pretxn* hooks but not by other
     1 Verify that pending changesets are seen by pretxn* hooks but not by other
     4 processes that access the destination repo while the hooks are running.
     2 processes that access the destination repo while the hooks are running.
     5 
     3 
     6 The hooks (python and external) both reject changesets after some think time,
     4 The hooks (python and external) both reject changesets after some think time,
     7 during which another process runs pull.  Each hook creates a file ('notify') to
     5 during which another process runs pull.  Each hook creates a file ('notify') to
    60   > EOF
    58   > EOF
    61 
    59 
    62 external hook
    60 external hook
    63 
    61 
    64   $ cat <<EOF > reject.sh
    62   $ cat <<EOF > reject.sh
    65   > #! /bin/sh
       
    66   > printf 'hook '; hg tip --template '{node}\\n'
    63   > printf 'hook '; hg tip --template '{node}\\n'
    67   > # create the notify file so caller knows we're running
    64   > # create the notify file so caller knows we're running
    68   > fpath=$d/notify
    65   > fpath=$d/notify
    69   > touch \$fpath
    66   > touch \$fpath
    70   > # wait for ack - caller should delete the notify file
    67   > # wait for ack - caller should delete the notify file
    73   >     sleep 1
    70   >     sleep 1
    74   >     i=\`expr \$i - 1\`
    71   >     i=\`expr \$i - 1\`
    75   > done
    72   > done
    76   > exit 1 # reject the changesets
    73   > exit 1 # reject the changesets
    77   > EOF
    74   > EOF
    78   $ chmod +x reject.sh
       
    79 
    75 
    80 create repos
    76 create repos
    81 
    77 
    82   $ hg init parent
    78   $ hg init parent
    83   $ hg clone -q parent child-push
    79   $ hg clone -q parent child-push
   105 
   101 
   106 test external hook
   102 test external hook
   107 
   103 
   108   $ cat <<EOF > parent/.hg/hgrc
   104   $ cat <<EOF > parent/.hg/hgrc
   109   > [hooks]
   105   > [hooks]
   110   > pretxnchangegroup = $d/reject.sh
   106   > pretxnchangegroup = sh $d/reject.sh
   111   > EOF
   107   > EOF
   112 
   108 
   113   $ dotest
   109   $ dotest
   114   push 29b62aeb769fdf78d8d9c5f28b017f76d7ef824b
   110   push 29b62aeb769fdf78d8d9c5f28b017f76d7ef824b
   115   hook 29b62aeb769fdf78d8d9c5f28b017f76d7ef824b
   111   hook 29b62aeb769fdf78d8d9c5f28b017f76d7ef824b