sapling/eden/scm/tests/test-fb-hgext-nointerrupt.t
Jun Wu 75a8173a10 tests: enable chg for 572 tests
Summary:
Add `#chg-compatible` to 572 tests that seem to pass with chg enabled.
This should make them run faster.

Reviewed By: xavierd

Differential Revision: D18870507

fbshipit-source-id: fe895e733efffc9286cd3d17c7a156c803124395
2019-12-09 15:26:29 -08:00

83 lines
1.7 KiB
Perl

#chg-compatible
Dummy extension simulating long running command
$ cat > sleepext.py <<EOF
> import time
> import itertools
>
> from edenscm.mercurial import registrar
> from edenscm.mercurial.i18n import _
>
> cmdtable = {}
> command = registrar.command(cmdtable)
>
> @command('sleep', [], _('TIME'), norepo=True)
> def sleep(ui, sleeptime="1", **opts):
>
> for _i in itertools.repeat(None, int(sleeptime)):
> time.sleep(1)
>
> ui.warn("%s second(s) passed\n" % sleeptime)
> EOF
Set up repository
$ hg init repo
$ cd repo
$ cat >> $HGRCPATH << EOF
> [extensions]
> sleepext = ../sleepext.py
> EOF
#if osx
$ TIMEOUT=gtimeout
#else
$ TIMEOUT=timeout
#endif
$ hash $TIMEOUT 2>/dev/null
> HASHSTATUS=$?
> if [ $HASHSTATUS -ne 0 ] ; then
> echo "skipped: missing feature: $TIMEOUT"
> exit 80
> fi
Test ctrl-c
$ $TIMEOUT -s 2 1 hg sleep 2
interrupted!
[124]
$ cat >> $HGRCPATH << EOF
> nointerrupt=
> [alias]
> slum = sleep
> [nointerrupt]
> attend-sleep = True
> attend-update = True
> EOF
$ $TIMEOUT -s 2 1 hg sleep 2
interrupted!
[124]
$ cat >> $HGRCPATH << EOF
> interactiveonly = False
> EOF
$ $TIMEOUT -s 2 1 hg sleep 2
==========================
Interrupting Mercurial may leave your repo in a bad state.
If you really want to interrupt your current command, press
CTRL-C again.
==========================
2 second(s) passed
[124]
$ $TIMEOUT -s 2 1 hg slum 2
==========================
Interrupting Mercurial may leave your repo in a bad state.
If you really want to interrupt your current command, press
CTRL-C again.
==========================
2 second(s) passed
[124]