##// END OF EJS Templates
censor: use context manager for lock management
Matt Harbison -
r38460:e219e355 default
parent child Browse files
Show More
@@ -32,7 +32,6 b' from mercurial.node import short'
32 32
33 33 from mercurial import (
34 34 error,
35 lock as lockmod,
36 35 registrar,
37 36 revlog,
38 37 scmutil,
@@ -52,13 +51,8 b" testedwith = 'ships-with-hg-core'"
52 51 ('t', 'tombstone', '', _('replacement tombstone data'), _('TEXT'))],
53 52 _('-r REV [-t TEXT] [FILE]'))
54 53 def censor(ui, repo, path, rev='', tombstone='', **opts):
55 wlock = lock = None
56 try:
57 wlock = repo.wlock()
58 lock = repo.lock()
54 with repo.wlock(), repo.lock():
59 55 return _docensor(ui, repo, path, rev, tombstone, **opts)
60 finally:
61 lockmod.release(lock, wlock)
62 56
63 57 def _docensor(ui, repo, path, rev='', tombstone='', **opts):
64 58 if not path:
General Comments 0
You need to be logged in to leave comments. Login now