--- a/mercurial/util.py Wed Jan 13 21:52:26 2016 -0800
+++ b/mercurial/util.py Thu Jan 14 09:31:01 2016 -0800
@@ -2655,7 +2655,7 @@
def __enter__(self):
return self
- def __call__(self):
+ def enter(self):
'''Create and enter context managers in the order in which they were
passed to the constructor.'''
values = []
--- a/tests/test-ctxmanager.py Wed Jan 13 21:52:26 2016 -0800
+++ b/tests/test-ctxmanager.py Thu Jan 14 09:31:01 2016 -0800
@@ -45,7 +45,7 @@
trace = []
addtrace = trace.append
with ctxmanager(ctxmgr('a', addtrace), ctxmgr('b', addtrace)) as c:
- a, b = c()
+ a, b = c.enter()
c.atexit(addtrace, ('atexit', 'x'))
c.atexit(addtrace, ('atexit', 'y'))
self.assertEqual(trace, [('enter', 'a'), ('enter', 'b'),
@@ -58,7 +58,7 @@
with self.assertRaises(ctxerror):
with ctxmanager(ctxmgr('a', addtrace),
lambda: raise_on_enter('b', addtrace)) as c:
- c()
+ c.enter()
addtrace('unreachable')
self.assertEqual(trace, [('enter', 'a'), ('raise', 'b'), ('exit', 'a')])
@@ -68,7 +68,7 @@
with self.assertRaises(ctxerror):
with ctxmanager(ctxmgr('a', addtrace),
lambda: raise_on_exit('b', addtrace)) as c:
- c()
+ c.enter()
addtrace('running')
self.assertEqual(trace, [('enter', 'a'), ('enter', 'b'), 'running',
('raise', 'b'), ('exit', 'a')])