rebase: cover restorestatus() by lock to prevent it from being updated
To prevent it from being updated by another process
`restorestatus()` is moved under lock.
Differential Revision: https://phab.mercurial-scm.org/D4282
--- a/hgext/rebase.py Mon Aug 13 21:22:14 2018 +0100
+++ b/hgext/rebase.py Wed Aug 15 11:27:57 2018 +0530
@@ -837,18 +837,17 @@
return _dryrunrebase(ui, repo, action, opts)
elif action == 'stop':
rbsrt = rebaseruntime(repo, ui)
- rbsrt.restorestatus()
-
- if rbsrt.collapsef:
- raise error.Abort(_("cannot stop in --collapse session"))
- allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
- if not (rbsrt.keepf or allowunstable):
- raise error.Abort(_("cannot remove original changesets with"
- " unrebased descendants"),
- hint=_('either enable obsmarkers to allow unstable '
- 'revisions or use --keep to keep original '
- 'changesets'))
with repo.wlock(), repo.lock():
+ rbsrt.restorestatus()
+ if rbsrt.collapsef:
+ raise error.Abort(_("cannot stop in --collapse session"))
+ allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
+ if not (rbsrt.keepf or allowunstable):
+ raise error.Abort(_("cannot remove original changesets with"
+ " unrebased descendants"),
+ hint=_('either enable obsmarkers to allow unstable '
+ 'revisions or use --keep to keep original '
+ 'changesets'))
if needupdate(repo, rbsrt.state):
# update to the current working revision
# to clear interrupted merge