changeset 39153:ffb34ee6de9e

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
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 15 Aug 2018 11:27:57 +0530
parents 2a4bfbb52111
children 4899c6d22dff
files hgext/rebase.py
diffstat 1 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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