Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 38322:e218ed5ba484
commit: use context manager for locks
Differential Revision: https://phab.mercurial-scm.org/D3745
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 14 Jun 2018 15:05:14 -0700 |
parents | 9b1536b02221 |
children | 48c52385e062 |
comparison
equal
deleted
inserted
replaced
38321:9b1536b02221 | 38322:e218ed5ba484 |
---|---|
1521 | 1521 |
1522 - amend the current commit and set the date to now:: | 1522 - amend the current commit and set the date to now:: |
1523 | 1523 |
1524 hg commit --amend --date now | 1524 hg commit --amend --date now |
1525 """ | 1525 """ |
1526 wlock = lock = None | 1526 with repo.wlock(), repo.lock(): |
1527 try: | |
1528 wlock = repo.wlock() | |
1529 lock = repo.lock() | |
1530 return _docommit(ui, repo, *pats, **opts) | 1527 return _docommit(ui, repo, *pats, **opts) |
1531 finally: | |
1532 release(lock, wlock) | |
1533 | 1528 |
1534 def _docommit(ui, repo, *pats, **opts): | 1529 def _docommit(ui, repo, *pats, **opts): |
1535 if opts.get(r'interactive'): | 1530 if opts.get(r'interactive'): |
1536 opts.pop(r'interactive') | 1531 opts.pop(r'interactive') |
1537 ret = cmdutil.dorecord(ui, repo, commit, None, False, | 1532 ret = cmdutil.dorecord(ui, repo, commit, None, False, |