Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 27801:7be6371c732e
with: use context manager for wlock in recordinwlock
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:45 -0800 |
parents | dad6404ccddb |
children | ed44a66fd7ae |
comparison
equal
deleted
inserted
replaced
27800:1c5f2c2c046b | 27801:7be6371c732e |
---|---|
228 os.rmdir(backupdir) | 228 os.rmdir(backupdir) |
229 except OSError: | 229 except OSError: |
230 pass | 230 pass |
231 | 231 |
232 def recordinwlock(ui, repo, message, match, opts): | 232 def recordinwlock(ui, repo, message, match, opts): |
233 wlock = repo.wlock() | 233 with repo.wlock(): |
234 try: | |
235 return recordfunc(ui, repo, message, match, opts) | 234 return recordfunc(ui, repo, message, match, opts) |
236 finally: | |
237 wlock.release() | |
238 | 235 |
239 return commit(ui, repo, recordinwlock, pats, opts) | 236 return commit(ui, repo, recordinwlock, pats, opts) |
240 | 237 |
241 def findpossible(cmd, table, strict=False): | 238 def findpossible(cmd, table, strict=False): |
242 """ | 239 """ |