##// END OF EJS Templates
censor: make censor acquire locks before processing...
FUJIWARA Katsunori -
r27290:525d9b3f default
parent child Browse files
Show More
@@ -28,6 +28,7 b' revisions if they are allowed by the "ce'
28 from mercurial.node import short
28 from mercurial.node import short
29 from mercurial import cmdutil, error, filelog, revlog, scmutil, util
29 from mercurial import cmdutil, error, filelog, revlog, scmutil, util
30 from mercurial.i18n import _
30 from mercurial.i18n import _
31 from mercurial import lock as lockmod
31
32
32 cmdtable = {}
33 cmdtable = {}
33 command = cmdutil.command(cmdtable)
34 command = cmdutil.command(cmdtable)
@@ -42,6 +43,15 b" testedwith = 'internal'"
42 ('t', 'tombstone', '', _('replacement tombstone data'), _('TEXT'))],
43 ('t', 'tombstone', '', _('replacement tombstone data'), _('TEXT'))],
43 _('-r REV [-t TEXT] [FILE]'))
44 _('-r REV [-t TEXT] [FILE]'))
44 def censor(ui, repo, path, rev='', tombstone='', **opts):
45 def censor(ui, repo, path, rev='', tombstone='', **opts):
46 wlock = lock = None
47 try:
48 wlock = repo.wlock()
49 lock = repo.lock()
50 return _docensor(ui, repo, path, rev, tombstone, **opts)
51 finally:
52 lockmod.release(lock, wlock)
53
54 def _docensor(ui, repo, path, rev='', tombstone='', **opts):
45 if not path:
55 if not path:
46 raise error.Abort(_('must specify file path to censor'))
56 raise error.Abort(_('must specify file path to censor'))
47 if not rev:
57 if not rev:
General Comments 0
You need to be logged in to leave comments. Login now