[PATCH 1 of 5 STABLE] rebase: backed out changeset 2519994d25ca

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jun 27 12:29:32 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1498577995 -7200
#      Tue Jun 27 17:39:55 2017 +0200
# Branch stable
# Node ID a702fdff7f7374d54bbf2411a500e31826c53119
# Parent  231690dba9b4d31b5ad2c93284e454135f2763ca
# EXP-Topic hooks-regression
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r a702fdff7f73
rebase: backed out changeset 2519994d25ca

In the process of fixing issue5610 in 4.2.2, we are trying to backout
cf8ad0e6c0e4. This changesets is making changes that depends on cf8ad0e6c0e4,
so we need to back it out first.

Since issue5610 is pretty serious regression and the next stable release is a
couple of days away, we are taking the backout route until we can figure out
something better to do.

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -475,24 +475,12 @@ class rebaseruntime(object):
                 editopt = True
             editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
             revtoreuse = max(self.state)
-            dsguard = dirstateguard.dirstateguard(repo, 'rebase')
-            try:
-                newnode = concludenode(repo, revtoreuse, p1, self.external,
-                                       commitmsg=commitmsg,
-                                       extrafn=_makeextrafn(self.extrafns),
-                                       editor=editor,
-                                       keepbranches=self.keepbranchesf,
-                                       date=self.date)
-                dsguard.close()
-                release(dsguard)
-            except error.InterventionRequired:
-                dsguard.close()
-                release(dsguard)
-                raise
-            except Exception:
-                release(dsguard)
-                raise
-
+            newnode = concludenode(repo, revtoreuse, p1, self.external,
+                                   commitmsg=commitmsg,
+                                   extrafn=_makeextrafn(self.extrafns),
+                                   editor=editor,
+                                   keepbranches=self.keepbranchesf,
+                                   date=self.date)
             if newnode is None:
                 newrev = self.target
             else:
@@ -734,19 +722,11 @@ def rebase(ui, repo, **opts):
                 return retcode
 
         with repo.transaction('rebase') as tr:
-            dsguard = dirstateguard.dirstateguard(repo, 'rebase')
             try:
                 rbsrt._performrebase(tr)
-                dsguard.close()
-                release(dsguard)
             except error.InterventionRequired:
-                dsguard.close()
-                release(dsguard)
                 tr.close()
                 raise
-            except Exception:
-                release(dsguard)
-                raise
         rbsrt._finishrebase()
     finally:
         release(lock, wlock)
@@ -874,28 +854,33 @@ def concludenode(repo, rev, p1, p2, comm
     '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev
     but also store useful information in extra.
     Return node of committed revision.'''
-    repo.setparents(repo[p1].node(), repo[p2].node())
-    ctx = repo[rev]
-    if commitmsg is None:
-        commitmsg = ctx.description()
-    keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
-    extra = {'rebase_source': ctx.hex()}
-    if extrafn:
-        extrafn(ctx, extra)
+    dsguard = dirstateguard.dirstateguard(repo, 'rebase')
+    try:
+        repo.setparents(repo[p1].node(), repo[p2].node())
+        ctx = repo[rev]
+        if commitmsg is None:
+            commitmsg = ctx.description()
+        keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
+        extra = {'rebase_source': ctx.hex()}
+        if extrafn:
+            extrafn(ctx, extra)
 
-    targetphase = max(ctx.phase(), phases.draft)
-    overrides = {('phases', 'new-commit'): targetphase}
-    with repo.ui.configoverride(overrides, 'rebase'):
-        if keepbranch:
-            repo.ui.setconfig('ui', 'allowemptycommit', True)
-        # Commit might fail if unresolved files exist
-        if date is None:
-            date = ctx.date()
-        newnode = repo.commit(text=commitmsg, user=ctx.user(),
-                              date=date, extra=extra, editor=editor)
+        targetphase = max(ctx.phase(), phases.draft)
+        overrides = {('phases', 'new-commit'): targetphase}
+        with repo.ui.configoverride(overrides, 'rebase'):
+            if keepbranch:
+                repo.ui.setconfig('ui', 'allowemptycommit', True)
+            # Commit might fail if unresolved files exist
+            if date is None:
+                date = ctx.date()
+            newnode = repo.commit(text=commitmsg, user=ctx.user(),
+                                  date=date, extra=extra, editor=editor)
 
-    repo.dirstate.setbranch(repo[newnode].branch())
-    return newnode
+        repo.dirstate.setbranch(repo[newnode].branch())
+        dsguard.close()
+        return newnode
+    finally:
+        release(dsguard)
 
 def rebasenode(repo, rev, p1, base, state, collapse, target):
     'Rebase a single revision rev on top of p1 using base as merge ancestor'
diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -572,8 +572,6 @@ Interactions between collapse and keepbr
   o  0: 'A'
   
   $ hg rebase --keepbranches --collapse -s 1 -d 3
-  transaction abort!
-  rollback completed
   abort: cannot collapse multiple named branches
   [255]
 
diff --git a/tests/test-rebase-scenario-global.t b/tests/test-rebase-scenario-global.t
--- a/tests/test-rebase-scenario-global.t
+++ b/tests/test-rebase-scenario-global.t
@@ -270,8 +270,6 @@ G onto B - merge revision with both pare
 
   $ hg rebase -s 6 -d 1
   rebasing 6:eea13746799a "G"
-  transaction abort!
-  rollback completed
   abort: cannot use revision 6 as base, result would have 3 parents
   [255]
   $ hg rebase --abort


More information about the Mercurial-devel mailing list