Re: D3716: ui: add an uninterruptable context manager that can block SIGINT

2018-07-28 Thread Yuya Nishihara
> >  I’m ok with disabling the test as long as it doesn’t explode on Windows 
> > without turning the experimental knobs.  It sounded like future would would 
> > depend on this, and I wasn’t sure if that landed yet.
> 
> We’ve already made some use of it in core - anything that calls strip will 
> hit this context manager, as will the (experimental) narrow extension.

AFAIK, it's test-only failure, which uses subprocess.send_signal(). There's
no sane way to generate Ctrl+C signal programatically on Windows, but SIGINT
handler should work at least as bad as it was before.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3716: ui: add an uninterruptable context manager that can block SIGINT

2018-07-28 Thread Augie Fackler

>>>  Do we need a different strategy for Windows, or just eat the error?  (See 
>>> the unsupported signal message)
>>> 
>>>  
>>> https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/808/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio
>> 
>> I'm not sure. We could probably just not support this on windows for now, or 
>> at least disable the test on Windows?
> 
> 
>  I’m ok with disabling the test as long as it doesn’t explode on Windows 
> without turning the experimental knobs.  It sounded like future would would 
> depend on this, and I wasn’t sure if that landed yet.

We’ve already made some use of it in core - anything that calls strip will hit 
this context manager, as will the (experimental) narrow extension.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3716: ui: add an uninterruptable context manager that can block SIGINT

2018-06-28 Thread Yuya Nishihara
> +@contextlib.contextmanager
> +def uninterruptable(self):
> +"""Mark an operation as unsafe.
> +
> +Most operations on a repository are safe to interrupt, but a
> +few are risky (for example repair.strip). This context manager
> +lets you advise Mercurial that something risky is happening so
> +that control-C etc can be blocked if desired.
> +"""
> +enabled = self.configbool('experimental', 'nointerrupt')
> +if (enabled and
> +self.configbool('experimental', 'nointerrupt-interactiveonly')):
> +enabled = self.interactive()
> +if self._uninterruptible or not enabled:
> +# if nointerrupt support is turned off, the process isn't
> +# interactive, or we're already in an uninterruptable
> +# block, do nothing.
> +yield
> +return
> +def warn():
> +self.warn(_("shutting down cleanly\n"))
> +self.warn(
> +_("press ^C again to terminate immediately (dangerous)\n"))

Missed `return True` ?

Other that that, the patch looks good to me.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel