Mercurial > evolve
changeset 4639:c4cab1dd31b7
touch: use context manager for locks
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Mon, 13 May 2019 18:45:00 +0530 |
parents | 7978db1dda3e |
children | c720d09c2366 |
files | hgext3rd/evolve/cmdrewrite.py |
diffstat | 1 files changed, 1 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Mon May 13 18:39:43 2019 +0530 +++ b/hgext3rd/evolve/cmdrewrite.py Mon May 13 18:45:00 2019 +0530 @@ -1362,15 +1362,8 @@ rewriteutil.precheck(repo, revs, 'touch') tmpl = utility.shorttemplate displayer = compat.changesetdisplayer(ui, repo, {'template': tmpl}) - wlock = lock = tr = None - try: - wlock = repo.wlock() - lock = repo.lock() - tr = repo.transaction('touch') + with repo.wlock(), repo.lock(), repo.transaction('touch'): touchnodes(ui, repo, revs, displayer, **opts) - tr.close() - finally: - lockmod.release(tr, lock, wlock) def touchnodes(ui, repo, revs, displayer, **opts): duplicate = opts['duplicate']