LGTM by a non-googler. > + @contextlib.contextmanager > + def unsafeoperation(self): > + """Mark an operation as unsafe.
Nit: the word "unsafe" seems too obscure. Maybe it could be "uninterruptible" or "noninterruptible"? > + try: > + self._oldsiginthandler = signal.getsignal(signal.SIGINT) > + signal.signal(signal.SIGINT, disabledsiginthandler) `signal.signal()` may raise ValueError if it's called from sub thread. > --- a/mercurial/configitems.py > +++ b/mercurial/configitems.py > @@ -560,6 +560,17 @@ > coreconfigitem('experimental', 'mergedriver', > default=None, > ) > +coreconfigitem('experimental', 'nointerrupt', default=False) > +_nointmsg = """ > +========================== > +Interrupting Mercurial may leave your repo in a bad state. > +If you really want to interrupt your current command, press > +CTRL-C again. > +========================== > +""".strip() > +coreconfigitem('experimental', 'nointerrupt-message', default=_nointmsg) Nit: perhaps we'll need to move the default message to ui.py to make it translatable. FWIW, I've added a similar function to lock.py at d77c3b023393. My version would be too strict to block user interrupt casually, but maybe we can factor out a utility function for both of these use cases? _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel