##// END OF EJS Templates
keyword: remove spurious locks, improve handling of wlock...
Christian Ebert -
r10604:9a36d159 default
parent child Browse files
Show More
@@ -79,7 +79,6 b" like CVS' $Log$, are not supported. A ke"
79 from mercurial import commands, cmdutil, dispatch, filelog, revlog, extensions
79 from mercurial import commands, cmdutil, dispatch, filelog, revlog, extensions
80 from mercurial import patch, localrepo, templater, templatefilters, util, match
80 from mercurial import patch, localrepo, templater, templatefilters, util, match
81 from mercurial.hgweb import webcommands
81 from mercurial.hgweb import webcommands
82 from mercurial.lock import release
83 from mercurial.node import nullid
82 from mercurial.node import nullid
84 from mercurial.i18n import _
83 from mercurial.i18n import _
85 import re, shutil, tempfile
84 import re, shutil, tempfile
@@ -264,17 +263,15 b' def _kwfwrite(ui, repo, expand, *pats, *'
264 if repo.dirstate.parents()[1] != nullid:
263 if repo.dirstate.parents()[1] != nullid:
265 raise util.Abort(_('outstanding uncommitted merge'))
264 raise util.Abort(_('outstanding uncommitted merge'))
266 kwt = kwtools['templater']
265 kwt = kwtools['templater']
267 status = _status(ui, repo, kwt, *pats, **opts)
266 wlock = repo.wlock()
268 modified, added, removed, deleted, unknown, ignored, clean = status
269 if modified or added or removed or deleted:
270 raise util.Abort(_('outstanding uncommitted changes'))
271 wlock = lock = None
272 try:
267 try:
273 wlock = repo.wlock()
268 status = _status(ui, repo, kwt, *pats, **opts)
274 lock = repo.lock()
269 modified, added, removed, deleted, unknown, ignored, clean = status
270 if modified or added or removed or deleted:
271 raise util.Abort(_('outstanding uncommitted changes'))
275 kwt.overwrite(None, expand, clean)
272 kwt.overwrite(None, expand, clean)
276 finally:
273 finally:
277 release(lock, wlock)
274 wlock.release()
278
275
279 def demo(ui, repo, *args, **opts):
276 def demo(ui, repo, *args, **opts):
280 '''print [keywordmaps] configuration and an expansion example
277 '''print [keywordmaps] configuration and an expansion example
@@ -485,15 +482,10 b' def reposetup(ui, repo):'
485 del self.commitctx
482 del self.commitctx
486
483
487 def kwcommitctx(self, ctx, error=False):
484 def kwcommitctx(self, ctx, error=False):
488 wlock = lock = None
485 n = super(kwrepo, self).commitctx(ctx, error)
489 try:
486 # no lock needed, only called from repo.commit() which already locks
490 wlock = self.wlock()
487 kwt.overwrite(n, True, None)
491 lock = self.lock()
488 return n
492 n = super(kwrepo, self).commitctx(ctx, error)
493 kwt.overwrite(n, True, None)
494 return n
495 finally:
496 release(lock, wlock)
497
489
498 # monkeypatches
490 # monkeypatches
499 def kwpatchfile_init(orig, self, ui, fname, opener,
491 def kwpatchfile_init(orig, self, ui, fname, opener,
General Comments 0
You need to be logged in to leave comments. Login now