--- a/hgext/keyword.py Sat Jun 03 17:13:35 2017 -0700
+++ b/hgext/keyword.py Tue Jun 20 12:51:36 2017 +0100
@@ -639,22 +639,21 @@
return n
def rollback(self, dryrun=False, force=False):
- wlock = self.wlock()
- origrestrict = kwt.restrict
- try:
- if not dryrun:
- changed = self['.'].files()
- ret = super(kwrepo, self).rollback(dryrun, force)
- if not dryrun:
- ctx = self['.']
- modified, added = _preselect(ctx.status(), changed)
- kwt.restrict = False
- kwt.overwrite(ctx, modified, True, True)
- kwt.overwrite(ctx, added, True, False)
- return ret
- finally:
- kwt.restrict = origrestrict
- wlock.release()
+ with self.wlock():
+ origrestrict = kwt.restrict
+ try:
+ if not dryrun:
+ changed = self['.'].files()
+ ret = super(kwrepo, self).rollback(dryrun, force)
+ if not dryrun:
+ ctx = self['.']
+ modified, added = _preselect(ctx.status(), changed)
+ kwt.restrict = False
+ kwt.overwrite(ctx, modified, True, True)
+ kwt.overwrite(ctx, added, True, False)
+ return ret
+ finally:
+ kwt.restrict = origrestrict
# monkeypatches
def kwpatchfile_init(orig, self, ui, gp, backend, store, eolmode=None):