Mercurial > hg
changeset 33172:0830c841fc7f
drawdag: inline transaction() function
I suspect Jun wrote the method before he learnt that Python 2.7 allows
multiple context managers in a single with-clause.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 30 Jun 2017 23:15:09 -0700 |
parents | 6d678ab1b10d |
children | 4b0da963586d |
files | tests/drawdag.py |
diffstat | 1 files changed, 1 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/drawdag.py Sun Jun 25 12:41:34 2017 -0700 +++ b/tests/drawdag.py Fri Jun 30 23:15:09 2017 -0700 @@ -83,7 +83,6 @@ from __future__ import absolute_import, print_function import collections -import contextlib import itertools from mercurial.i18n import _ @@ -277,13 +276,6 @@ if leaf in v: v.remove(leaf) -@contextlib.contextmanager -def transaction(repo): - with repo.wlock(): - with repo.lock(): - with repo.transaction('drawdag'): - yield - @command('debugdrawdag', []) def debugdrawdag(ui, repo, **opts): """read an ASCII graph from stdin and create changesets @@ -332,7 +324,7 @@ local=True) # handle special comments - with transaction(repo): + with repo.wlock(), repo.lock(), repo.transaction('drawdag'): getctx = lambda x: repo.unfiltered()[committed[x.strip()]] for line in text.splitlines(): if ' # ' not in line: