tests/test-hooklib-enforce_draft_commits.t
author Matt Harbison <matt_harbison@yahoo.com>
Thu, 10 Oct 2024 17:52:26 -0400
changeset 52007 521df44118a8
parent 44413 4cabeea6d214
permissions -rw-r--r--
tests: allow optional output when `test-lfs-server` is sent SIGTERM I guess this has only ever been tested on Windows, but on macOS, the test was failing with changes like: +++ /private/tmp/mercurial-ci/tests/test-lfs-test-server.t#git-server.err @@ -858,6 +858,7 @@ (Restart the server in a different location so it no longer has the content) $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS + $TESTTMP.sh: line 153: 38639 Terminated: 15 lfs-test-server > lfs-server.log 2>&1 #if hg-server $ cat $TESTTMP/access.log $TESTTMP/errors.log

  $ cat <<EOF >> $HGRCPATH
  > [extensions]
  > hooklib =
  > 
  > [phases]
  > publish = False
  > EOF
  $ hg init a
  $ hg --cwd a debugbuilddag .
  $ hg --cwd a phase --public 0
  $ hg init b
  $ cat <<EOF >> b/.hg/hgrc
  > [hooks]
  > pretxnclose-phase.enforce_draft_commits = \
  >   python:hgext.hooklib.enforce_draft_commits.hook
  > EOF
  $ hg --cwd b pull ../a
  pulling from ../a
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  error: pretxnclose-phase.enforce_draft_commits hook failed: New changeset 1ea73414a91b in phase 'public' rejected
  transaction abort!
  rollback completed
  abort: New changeset 1ea73414a91b in phase 'public' rejected
  [255]
  $ hg --cwd a phase --force --draft 0
  $ hg --cwd b pull ../a
  pulling from ../a
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 0 changes to 0 files
  new changesets 1ea73414a91b (1 drafts)
  (run 'hg update' to get a working copy)
  $ hg --cwd a phase --public 0
  $ hg --cwd b pull ../a
  pulling from ../a
  searching for changes
  no changes found
  error: pretxnclose-phase.enforce_draft_commits hook failed: Phase change from 'draft' to 'public' for 1ea73414a91b rejected
  abort: Phase change from 'draft' to 'public' for 1ea73414a91b rejected
  [255]