Patchwork [3,of,3] phase: add a transaction argument to retractboundary

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 7, 2014, 2:19 a.m.
Message ID <04b05825ab48dc87410a.1407377943@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5309/
State Accepted
Commit c1ca472045907dfa9477cbe64fd0d626d04fa484
Headers show

Comments

Pierre-Yves David - Aug. 7, 2014, 2:19 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1407307941 25200
#      Tue Aug 05 23:52:21 2014 -0700
# Node ID 04b05825ab48dc87410a0ccd91ea3921d8f602c3
# Parent  bea88c30e77bd66a181580a1a9738620d5eb14ab
phase: add a transaction argument to retractboundary

We now pass a transaction option to this phase movement function. The object
currently not used by the function, but it will be in the future.

All call sites have been updated. Most call sites were already enclosed into a
transaction for a long time. The handful of others have been recently
updated in previous commit.
Pierre-Yves David - Aug. 7, 2014, 2:24 a.m.
On 08/06/2014 07:19 PM, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1407307941 25200
> #      Tue Aug 05 23:52:21 2014 -0700
> # Node ID 04b05825ab48dc87410a0ccd91ea3921d8f602c3
> # Parent  bea88c30e77bd66a181580a1a9738620d5eb14ab
> phase: add a transaction argument to retractboundary

Matt will want to update its evolve to latest public head (9d538ebf3985) 
before applying this change to avoid visit from the traceback deity.

(Thoses evolve changes are backward compatible with core's stable branch)
Matt Mackall - Aug. 7, 2014, 9:37 p.m.
On Wed, 2014-08-06 at 19:19 -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1407307941 25200
> #      Tue Aug 05 23:52:21 2014 -0700
> # Node ID 04b05825ab48dc87410a0ccd91ea3921d8f602c3
> # Parent  bea88c30e77bd66a181580a1a9738620d5eb14ab
> phase: add a transaction argument to retractboundary

These are queued for default, thanks.

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2009,11 +2009,11 @@  class queue(object):
                     self.added.append(patchname)
                     imported.append(patchname)
                     patchname = None
                     if rev and repo.ui.configbool('mq', 'secret', False):
                         # if we added anything with --rev, move the secret root
-                        phases.retractboundary(repo, phases.secret, [n])
+                        phases.retractboundary(repo, tr, phases.secret, [n])
                     self.parseseries()
                     self.applieddirty = True
                     self.seriesdirty = True
                 tr.close()
             finally:
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -704,16 +704,16 @@  def addchangegroup(repo, source, srctype
             else:
                 # Those changesets have been pushed from the outside, their
                 # phases are going to be pushed alongside. Therefor
                 # `targetphase` is ignored.
                 phases.advanceboundary(repo, tr, phases.draft, srccontent)
-                phases.retractboundary(repo, phases.draft, added)
+                phases.retractboundary(repo, tr, phases.draft, added)
         elif srctype != 'strip':
             # publishing only alter behavior during push
             #
             # strip should not touch boundary at all
-            phases.retractboundary(repo, targetphase, added)
+            phases.retractboundary(repo, tr, targetphase, added)
 
         # make changelog see real files again
         cl.finalize(trp)
 
         tr.close()
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4583,11 +4583,11 @@  def phase(ui, repo, *revs, **opts):
                 raise util.Abort(_('empty revision set'))
             nodes = [repo[r].node() for r in revs]
             olddata = repo._phasecache.getphaserevs(repo)[:]
             phases.advanceboundary(repo, tr, targetphase, nodes)
             if opts['force']:
-                phases.retractboundary(repo, targetphase, nodes)
+                phases.retractboundary(repo, tr, targetphase, nodes)
             tr.close()
         finally:
             if tr is not None:
                 tr.release()
             lock.release()
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1440,11 +1440,11 @@  class localrepository(object):
                 # retract boundary do not alter parent changeset.
                 # if a parent have higher the resulting phase will
                 # be compliant anyway
                 #
                 # if minimal phase was 0 we don't need to retract anything
-                phases.retractboundary(self, targetphase, [n])
+                phases.retractboundary(self, tr, targetphase, [n])
             tr.close()
             branchmap.updatecache(self.filtered('served'))
             return n
         finally:
             if tr:
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -227,14 +227,14 @@  class phasecache(object):
                 self._updateroots(phase, roots)
                 # some roots may need to be declared for lower phases
                 delroots.extend(olds - roots)
             # declare deleted root in the target phase
             if targetphase != 0:
-                self.retractboundary(repo, targetphase, delroots)
+                self.retractboundary(repo, tr, targetphase, delroots)
         repo.invalidatevolatilesets()
 
-    def retractboundary(self, repo, targetphase, nodes):
+    def retractboundary(self, repo, tr, targetphase, nodes):
         # Be careful to preserve shallow-copied values: do not update
         # phaseroots values, replace them.
 
         repo = repo.unfiltered()
         currentroots = self.phaseroots[targetphase]
@@ -287,20 +287,20 @@  def advanceboundary(repo, tr, targetphas
     Simplify boundary to contains phase roots only."""
     phcache = repo._phasecache.copy()
     phcache.advanceboundary(repo, tr, targetphase, nodes)
     repo._phasecache.replace(phcache)
 
-def retractboundary(repo, targetphase, nodes):
+def retractboundary(repo, tr, targetphase, nodes):
     """Set nodes back to a phase changing other nodes phases if
     necessary.
 
     This function move boundary *backward* this means that all nodes
     are set in the target phase or kept in a *higher* phase.
 
     Simplify boundary to contains phase roots only."""
     phcache = repo._phasecache.copy()
-    phcache.retractboundary(repo, targetphase, nodes)
+    phcache.retractboundary(repo, tr, targetphase, nodes)
     repo._phasecache.replace(phcache)
 
 def listphases(repo):
     """List phases root for serialization over pushkey"""
     keys = {}