rebase: cover restorestatus() by lock to prevent it from being updated
authorSushil khanchi <sushilkhanchi97@gmail.com>
Wed, 15 Aug 2018 11:27:57 +0530
changeset 39116 ffb34ee6de9e
parent 39115 2a4bfbb52111
child 39117 4899c6d22dff
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
hgext/rebase.py
--- 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