Mercurial > hg
comparison mercurial/localrepo.py @ 8398:a45eb410e0f2
commitctx: simplify locking
(spotted by Simon Heimberg)
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 14 May 2009 13:20:40 -0500 |
parents | 613ac2856535 |
children | 1c3d5c54cf1c |
comparison
equal
deleted
inserted
replaced
8397:613ac2856535 | 8398:a45eb410e0f2 |
---|---|
828 """Add a new revision to current repository. | 828 """Add a new revision to current repository. |
829 | 829 |
830 Revision information is passed in the context.memctx argument. | 830 Revision information is passed in the context.memctx argument. |
831 commitctx() does not touch the working directory. | 831 commitctx() does not touch the working directory. |
832 """ | 832 """ |
833 wlock = lock = None | 833 lock = self.lock() |
834 try: | 834 try: |
835 wlock = self.wlock() | |
836 lock = self.lock() | |
837 return self._commitctx(ctx, force=True, force_editor=False, | 835 return self._commitctx(ctx, force=True, force_editor=False, |
838 empty_ok=True, use_dirstate=False, | 836 empty_ok=True, use_dirstate=False, |
839 update_dirstate=False) | 837 update_dirstate=False) |
840 finally: | 838 finally: |
841 release(lock, wlock) | 839 lock.release() |
842 | 840 |
843 def _commitctx(self, wctx, force=False, force_editor=False, empty_ok=False, | 841 def _commitctx(self, wctx, force=False, force_editor=False, empty_ok=False, |
844 use_dirstate=True, update_dirstate=True): | 842 use_dirstate=True, update_dirstate=True): |
845 tr = None | 843 tr = None |
846 valid = 0 # don't save the dirstate if this isn't set | 844 valid = 0 # don't save the dirstate if this isn't set |