comparison mercurial/ui.py @ 41076:8ecb17b7f432

procutil: correct spelling of uninterruptable -> uninterruptible Differential Revision: https://phab.mercurial-scm.org/D5488
author Kyle Lippincott <spectral@google.com>
date Fri, 28 Dec 2018 12:51:47 -0800
parents 6603de284b0a
children 8cf92ca92bfe
comparison
equal deleted inserted replaced
41075:d0c86a7447a6 41076:8ecb17b7f432
346 finally: 346 finally:
347 self._blockedtimes[key + '_blocked'] += \ 347 self._blockedtimes[key + '_blocked'] += \
348 (util.timer() - starttime) * 1000 348 (util.timer() - starttime) * 1000
349 349
350 @contextlib.contextmanager 350 @contextlib.contextmanager
351 def uninterruptable(self): 351 def uninterruptible(self):
352 """Mark an operation as unsafe. 352 """Mark an operation as unsafe.
353 353
354 Most operations on a repository are safe to interrupt, but a 354 Most operations on a repository are safe to interrupt, but a
355 few are risky (for example repair.strip). This context manager 355 few are risky (for example repair.strip). This context manager
356 lets you advise Mercurial that something risky is happening so 356 lets you advise Mercurial that something risky is happening so
360 if (enabled and 360 if (enabled and
361 self.configbool('experimental', 'nointerrupt-interactiveonly')): 361 self.configbool('experimental', 'nointerrupt-interactiveonly')):
362 enabled = self.interactive() 362 enabled = self.interactive()
363 if self._uninterruptible or not enabled: 363 if self._uninterruptible or not enabled:
364 # if nointerrupt support is turned off, the process isn't 364 # if nointerrupt support is turned off, the process isn't
365 # interactive, or we're already in an uninterruptable 365 # interactive, or we're already in an uninterruptible
366 # block, do nothing. 366 # block, do nothing.
367 yield 367 yield
368 return 368 return
369 def warn(): 369 def warn():
370 self.warn(_("shutting down cleanly\n")) 370 self.warn(_("shutting down cleanly\n"))
371 self.warn( 371 self.warn(
372 _("press ^C again to terminate immediately (dangerous)\n")) 372 _("press ^C again to terminate immediately (dangerous)\n"))
373 return True 373 return True
374 with procutil.uninterruptable(warn): 374 with procutil.uninterruptible(warn):
375 try: 375 try:
376 self._uninterruptible = True 376 self._uninterruptible = True
377 yield 377 yield
378 finally: 378 finally:
379 self._uninterruptible = False 379 self._uninterruptible = False