rebase: add lock to cover whole dryrun process
Before this patch it is easy for another hg to interrupt
the dryrun. This patch make sure that dryrun will complete
without any interruption.
Differential Revision: https://phab.mercurial-scm.org/D3854
--- a/hgext/rebase.py Tue May 29 00:26:20 2018 +0200
+++ b/hgext/rebase.py Thu Jun 28 23:36:45 2018 +0530
@@ -818,22 +818,21 @@
opts[r'dest'] = '_destautoorphanrebase(SRC)'
if dryrun:
- leaveunfinished = True
- inmemory = True
- rbsrt = rebaseruntime(repo, ui, inmemory, pycompat.byteskwargs(opts))
- try:
- overrides = {('rebase', 'singletransaction'): True}
- with ui.configoverride(overrides, 'rebase'):
- _origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
- leaveunfinished=leaveunfinished, **opts)
- except error.InMemoryMergeConflictsError:
- ui.status(_('hit a merge conflict\n'))
- return 1
- else:
- ui.status(_('there will be no conflict, you can rebase\n'))
- return 0
- finally:
- with repo.wlock(), repo.lock():
+ rbsrt = rebaseruntime(repo, ui, inmemory=True,
+ opts=pycompat.byteskwargs(opts))
+ with repo.wlock(), repo.lock():
+ try:
+ overrides = {('rebase', 'singletransaction'): True}
+ with ui.configoverride(overrides, 'rebase'):
+ _origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+ leaveunfinished=True, **opts)
+ except error.InMemoryMergeConflictsError:
+ ui.status(_('hit a merge conflict\n'))
+ return 1
+ else:
+ ui.status(_('there will be no conflict, you can rebase\n'))
+ return 0
+ finally:
rbsrt._prepareabortorcontinue(isabort=True)
elif inmemory:
try: