Skip to content
Snippets Groups Projects
Commit 4778f398 authored by Siddharth Agarwal's avatar Siddharth Agarwal
Browse files

histedit: hold wlock and lock while in progress

Currently, histedit acquires and releases lock and wlock several times during
its run. This isn't great because it allows other hg processes to come in and
change state. With this fix, lock and wlock are acquired and released exactly
once.

The change to test-histedit-drop.t is a minor implementation one -- the cache
is still correctly invalidated, but it just happens a little later and only
gets printed out because of the unrelated --debug flag.
parent 509717d0
No related branches found
No related tags found
No related merge requests found
......@@ -159,6 +159,7 @@
from mercurial import util
from mercurial import obsolete
from mercurial import merge as mergemod
from mercurial.lock import release
from mercurial.i18n import _
cmdtable = {}
......@@ -476,6 +477,15 @@
for intentional "edit" command, but also for resolving unexpected
conflicts).
"""
lock = wlock = None
try:
wlock = repo.wlock()
lock = repo.lock()
_histedit(ui, repo, *freeargs, **opts)
finally:
release(lock, wlock)
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)
......
......@@ -97,6 +97,7 @@
Check histedit_source
$ hg log --debug --rev f518305ce889
invalid branchheads cache (visible): tip differs
changeset: 4:f518305ce889c07cb5bd05522176d75590ef3324
tag: tip
phase: draft
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment