# HG changeset patch # User Martin von Zweigbergk # Date 1497896251 25200 # Node ID daceeed34ad28c4edde00b3b9e5d1933371438be # Parent 04c9dd951a414980aff0315a28794786c6c2fead strip: use context manager for locking in strip() diff -r 04c9dd951a41 -r daceeed34ad2 hgext/strip.py --- a/hgext/strip.py Mon Jun 19 11:18:12 2017 -0700 +++ b/hgext/strip.py Mon Jun 19 11:17:31 2017 -0700 @@ -59,10 +59,7 @@ return s def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None): - wlock = lock = None - try: - wlock = repo.wlock() - lock = repo.lock() + with repo.wlock(), repo.lock(): if update: checklocalchanges(repo, force=force) @@ -86,9 +83,6 @@ repomarks.recordchange(tr) for bookmark in sorted(bookmarks): ui.write(_("bookmark '%s' deleted\n") % bookmark) - finally: - release(lock, wlock) - @command("strip", [