sapling/tests/test-nointerrupt.t
Jun Wu 8a3a99ba21 hgext: move single file extensions to hgext3rd
Summary:
Be a better citizen under system python path.

Fix all tests issues and change setup.py to use glob pattern to include
all extensions.

Test Plan:
Run tests and `make local`.
Also build and install the package and run `hg sl` in major repos.

Reviewers: #mercurial, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3534311

Signature: t1:3534311:1468275426:fe122646c8bd6c541e1889e73e9df28f86747ff2
2016-07-08 13:15:42 +01:00

68 lines
1.5 KiB
Perl

Dummy extension simulating long running command
$ cat > sleepext.py <<EOF
> import time
> import itertools
>
> from mercurial import cmdutil
> from mercurial.i18n import _
>
> cmdtable = {}
> command = cmdutil.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
Test ctrl-c
$ timeout -s 2 1 hg sleep 2
interrupted!
[124]
$ cat >> $HGRCPATH << EOF
> nointerrupt = $TESTDIR/../hgext3rd/nointerrupt.py
> [alias]
> slumber = 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]