--- a/hgext/histedit.py Tue Jul 31 18:18:26 2012 +0200
+++ b/hgext/histedit.py Wed Aug 01 09:41:57 2012 -0500
@@ -150,6 +150,7 @@
from mercurial import discovery
from mercurial import error
from mercurial import hg
+from mercurial import lock as lockmod
from mercurial import node
from mercurial import patch
from mercurial import repair
@@ -492,11 +493,16 @@
ui.debug('should strip temp nodes %s\n' %
', '.join([node.hex(n)[:12] for n in tmpnodes]))
for nodes in (created, tmpnodes):
- for n in reversed(nodes):
- try:
- repair.strip(ui, repo, n)
- except error.LookupError:
- pass
+ lock = None
+ try:
+ lock = repo.lock()
+ for n in reversed(nodes):
+ try:
+ repair.strip(ui, repo, n)
+ except error.LookupError:
+ pass
+ finally:
+ lockmod.release(lock)
os.unlink(os.path.join(repo.path, 'histedit-state'))
return
else:
@@ -636,19 +642,29 @@
ui.debug('should strip replaced nodes %s\n' %
', '.join([node.hex(n)[:12] for n in replaced]))
- for n in sorted(replaced, key=lambda x: repo[x].rev()):
+ lock = None
+ try:
+ lock = repo.lock()
+ for n in sorted(replaced, key=lambda x: repo[x].rev()):
+ try:
+ repair.strip(ui, repo, n)
+ except error.LookupError:
+ pass
+ finally:
+ lockmod.release(lock)
+
+ ui.debug('should strip temp nodes %s\n' %
+ ', '.join([node.hex(n)[:12] for n in tmpnodes]))
+ lock = None
+ try:
+ lock = repo.lock()
+ for n in reversed(tmpnodes):
try:
repair.strip(ui, repo, n)
except error.LookupError:
pass
-
- ui.debug('should strip temp nodes %s\n' %
- ', '.join([node.hex(n)[:12] for n in tmpnodes]))
- for n in reversed(tmpnodes):
- try:
- repair.strip(ui, repo, n)
- except error.LookupError:
- pass
+ finally:
+ lockmod.release(lock)
os.unlink(os.path.join(repo.path, 'histedit-state'))
if os.path.exists(repo.sjoin('undo')):
os.unlink(repo.sjoin('undo'))