view tests/test-hup.t @ 23291:03d2d6931836

transaction: allow registering a temporary transaction file During the transaction, files may be created to store or expose data involved in the transaction (eg: changelog index data are written in a 'changelog.i.a' for hooks). But we do not have an official way to record such file creation and make sure they are cleaned up. The lack of clean-up is currently okay because there is a single file involved and a single producer/consumer. However, as we want to expose more data (bookmarks, phases, obsmarker) we need something more solid. The 'backupentries' mechanism could handle that. Temporary files can be encoded as a backup of nothing '('', <temporarypath>)'. We "need" to attach it to the same mechanism as we use to be able to use temporary transaction files outside of .'store/' and 'backupentries' is expected to gain such feature. This changeset makes it clear that we should rename 'backupentries' to something more generic.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 05 Nov 2014 09:27:08 +0000
parents 581d3bc03aad
children
line wrap: on
line source

#require serve fifo

Test hangup signal in the middle of transaction

  $ hg init
  $ mkfifo p
  $ hg serve --stdio < p 1>out 2>&1 &
  $ P=$!

Do test while holding fifo open

  $ (
  > echo lock
  > echo addchangegroup
  > start=`date +%s`
  > # 10 second seems much enough to let the server catch up
  > deadline=`expr $start + 10`
  > while [ ! -s .hg/store/journal ]; do
  >     sleep 0;
  >     if [ `date +%s` -gt $deadline ]; then
  >         echo "transaction did not start after 10 seconds" >&2;
  >         exit 1;
  >     fi
  > done
  > kill -HUP $P
  > ) > p

  $ wait
  $ cat out
  0
  0
  adding changesets
  transaction abort!
  rollback completed
  killed!

  $ ls -1d .hg/* .hg/store/*
  .hg/00changelog.i
  .hg/journal.bookmarks
  .hg/journal.branch
  .hg/journal.desc
  .hg/journal.dirstate
  .hg/requires
  .hg/store
  .hg/store/00changelog.i
  .hg/store/00changelog.i.a
  .hg/store/journal.phaseroots