D3716: ui: add an unsafeoperation context manager that can block SIGINT

2018-06-18 Thread spectral (Kyle Lippincott)
spectral added a comment. In https://phab.mercurial-scm.org/D3716#58934, @indygreg wrote: > I agree with @yuja that we should move this to `util.py` or one of its siblings and rename it to `uninterruptable` or some such. > > That being said, signal handlers are process global. And we

D3716: ui: add an unsafeoperation context manager that can block SIGINT

2018-06-16 Thread yuja (Yuya Nishihara)
yuja added a comment. > I agree with @yuja that we should move this to `util.py` or one of its > > siblings and rename it to `uninterruptable` or some such. procutil.py would be a better place. > That being said, signal handlers are process global. And we do need to > mainta

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

2018-06-16 Thread Yuya Nishihara
> I agree with @yuja that we should move this to `util.py` or one of its > siblings and rename it to `uninterruptable` or some such. procutil.py would be a better place. > That being said, signal handlers are process global. And we do need to > maintain persistent state so things don't get out

D3716: ui: add an unsafeoperation context manager that can block SIGINT

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision. indygreg added a comment. This revision now requires changes to proceed. I agree with @yuja that we should move this to `util.py` or one of its siblings and rename it to `uninterruptable` or some such. That being said, signal handlers are proce

D3716: ui: add an unsafeoperation context manager that can block SIGINT

2018-06-14 Thread yuja (Yuya Nishihara)
yuja added a comment. 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:

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

2018-06-14 Thread Yuya Nishihara
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 = signa

D3716: ui: add an unsafeoperation context manager that can block SIGINT

2018-06-12 Thread durin42 (Augie Fackler)
durin42 added a comment. Good suggestions, integrated them. :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3716 To: durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-d

D3716: ui: add an unsafeoperation context manager that can block SIGINT

2018-06-12 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 9033. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3716?vs=9023&id=9033 REVISION DETAIL https://phab.mercurial-scm.org/D3716 AFFECTED FILES mercurial/configitems.py mercurial/ui.py CHANGE DETAILS diff --git

D3716: ui: add an unsafeoperation context manager that can block SIGINT

2018-06-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments. INLINE COMMENTS > ui.py:347-350 > +enabled = self.configbool('experimental', 'nointerrupt') > +inter = self.interactive() or not self.configbool( > +'experimental', 'nointerrupt-interactiveonly') > +if not (enabled and inter an

D3716: ui: add an unsafeoperation context manager that can block SIGINT

2018-06-12 Thread durin42 (Augie Fackler)
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The blocking of SIGINT is not done by default, but my hope is that we will one day. This was inspired by Facebook's "nointerrupt" extension, which is a bit more