mirror of
https://github.com/facebook/sapling.git
synced 2025-01-07 14:10:42 +03:00
progress: drop config to specify condtype
Summary: The Rust condition implemenation seems working okay. Therefore drop the support to switch to buggy `threading.Condition`. Reviewed By: phillco Differential Revision: D12875128 fbshipit-source-id: 15f41bdc3fceeaa7de7d8cdbd76ee6d70951c107
This commit is contained in:
parent
4027f3a7e9
commit
ef5f621baa
@ -387,7 +387,6 @@ coreconfigitem("profiling", "showmin", default=dynamicdefault)
|
||||
coreconfigitem("profiling", "sort", default="inlinetime")
|
||||
coreconfigitem("profiling", "statformat", default="hotpath")
|
||||
coreconfigitem("profiling", "type", default="stat")
|
||||
coreconfigitem("progress", "_rustthreading", default=True)
|
||||
coreconfigitem("progress", "assume-tty", default=False)
|
||||
coreconfigitem("progress", "changedelay", default=1)
|
||||
coreconfigitem("progress", "clear-complete", default=True)
|
||||
|
@ -1174,10 +1174,6 @@ def _dispatch(req):
|
||||
ui_.setconfig("profiling", "enabled", "true", "--profile")
|
||||
|
||||
with profiling.profile(lui) as profiler:
|
||||
from . import progress
|
||||
|
||||
progress.setup(lui)
|
||||
|
||||
# Configure extensions in phases: uisetup, extsetup, cmdtable, and
|
||||
# reposetup
|
||||
extensions.loadall(lui)
|
||||
|
@ -404,24 +404,16 @@ def getrenderer(bar):
|
||||
|
||||
|
||||
class engine(object):
|
||||
def __init__(self, condtype):
|
||||
self._cond = condtype()
|
||||
def __init__(self):
|
||||
self._cond = rustthreading.Condition()
|
||||
self._active = False
|
||||
self._refresh = None
|
||||
self._delay = None
|
||||
self._bars = []
|
||||
self._currentbarindex = None
|
||||
if condtype is rustthreading.Condition:
|
||||
self.lock = self._lockworkedaround
|
||||
else:
|
||||
self.lock = self._lockbuggy
|
||||
|
||||
def _lockbuggy(self):
|
||||
# Subject to https://bugs.python.org/issue29988. Could deadlock.
|
||||
return self._cond
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _lockworkedaround(self):
|
||||
def lock(self):
|
||||
# Ugly hack for buggy Python (https://bugs.python.org/issue29988)
|
||||
#
|
||||
# Python can skip executing "__exit__" if a signal arrives at the
|
||||
@ -576,7 +568,7 @@ class engine(object):
|
||||
bar._updateestimation(now)
|
||||
|
||||
|
||||
_engine = None
|
||||
_engine = engine()
|
||||
|
||||
|
||||
suspend = util.nullcontextmanager
|
||||
@ -734,14 +726,4 @@ def spinner(ui, topic):
|
||||
|
||||
|
||||
def resetstate():
|
||||
if _engine:
|
||||
_engine.resetstate()
|
||||
|
||||
|
||||
def setup(ui):
|
||||
global _engine
|
||||
if ui.configbool("progress", "_rustthreading"):
|
||||
condtype = rustthreading.Condition
|
||||
else:
|
||||
condtype = threading.Condition
|
||||
_engine = engine(condtype)
|
||||
_engine.resetstate()
|
||||
|
Loading…
Reference in New Issue
Block a user