Comments
Patch
@@ -433,10 +433,28 @@
msg = _('there are ambiguous outgoing revisions')
hint = _('see "hg help histedit" for more detail')
raise util.Abort(msg, hint=hint)
return repo.lookup(roots[0])
+class _lockmgr(object):
+ def __init__(self, repo):
+ self.__repo = repo
+ self.__lock = self.__wlock = None
+
+ def takelocks(self):
+ if self.__wlock is None:
+ self.__wlock = self.__repo.wlock()
+ if self.__lock is None:
+ self.__lock = self.__repo.lock()
+
+ def releaselocks(self):
+ release(self.__lock, self.__wlock)
+ self.__lock = self.__wlock = None
+
+
+_toprepolock = None
+
actiontable = {'p': pick,
'pick': pick,
'e': edit,
'edit': edit,
'f': fold,
@@ -480,17 +498,17 @@
Returns 0 on success, 1 if user intervention is required (not only
for intentional "edit" command, but also for resolving unexpected
conflicts).
"""
- lock = wlock = None
try:
- wlock = repo.wlock()
- lock = repo.lock()
+ global _toprepolock
+ _toprepolock = _lockmgr(repo)
+ _toprepolock.takelocks()
_histedit(ui, repo, *freeargs, **opts)
finally:
- release(lock, wlock)
+ _toprepolock.releaselocks()
def _histedit(ui, repo, *freeargs, **opts):
# TODO only abort if we try and histedit mq patches, not just
# blanket if mq patches are applied somewhere
mq = getattr(repo, 'mq', None)