##// 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 from mercurial import (
33 from mercurial import (
34 error,
34 error,
35 lock as lockmod,
36 registrar,
35 registrar,
37 revlog,
36 revlog,
38 scmutil,
37 scmutil,
@@ -52,13 +51,8 b" testedwith = 'ships-with-hg-core'"
52 ('t', 'tombstone', '', _('replacement tombstone data'), _('TEXT'))],
51 ('t', 'tombstone', '', _('replacement tombstone data'), _('TEXT'))],
53 _('-r REV [-t TEXT] [FILE]'))
52 _('-r REV [-t TEXT] [FILE]'))
54 def censor(ui, repo, path, rev='', tombstone='', **opts):
53 def censor(ui, repo, path, rev='', tombstone='', **opts):
55 wlock = lock = None
54 with repo.wlock(), repo.lock():
56 try:
57 wlock = repo.wlock()
58 lock = repo.lock()
59 return _docensor(ui, repo, path, rev, tombstone, **opts)
55 return _docensor(ui, repo, path, rev, tombstone, **opts)
60 finally:
61 lockmod.release(lock, wlock)
62
56
63 def _docensor(ui, repo, path, rev='', tombstone='', **opts):
57 def _docensor(ui, repo, path, rev='', tombstone='', **opts):
64 if not path:
58 if not path:
General Comments 0
You need to be logged in to leave comments. Login now