[PATCH 4 of 5 phases] phases: move phase according what was pushed not only what was added added

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Jan 12 19:42:06 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1326415367 -3600
# Node ID 2587aef5528091d94fdf2cde093458f43dcb0729
# Parent  209445e13389063ea1de9b9001ab9f9d7e562046
phases: move phase according what was pushed not only what was added added

This fix the lack phase movement when a locally secret changeset without added
children was pushed to the repository. In such case, this changeset would be
present in the bundle source, but not in the ``added`` variable.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2113,11 +2113,22 @@
 
             added = [cl.node(r) for r in xrange(clstart, clend)]
             publishing = self.ui.configbool('phases', 'publish', True)
-            if publishing and srctype == 'push':
+            if srctype == 'push':
                 # Old server can not push the boundary themself.
-                # This clause ensure pushed changeset are alway marked as public
-                phases.advanceboundary(self, phases.public, added)
-            elif srctype != 'strip': # strip should not touch boundary at all
+                # New server won't push the boundary if changeset already
+                # existed locally as secrete
+                #
+                # We should not use added here but the list of all change in
+                # the bundle
+                if publishing:
+                    phases.advanceboundary(self, phases.public, srccontent)
+                else:
+                    phases.advanceboundary(self, phases.draft, srccontent)
+                    phases.retractboundary(self, phases.draft, added)
+            elif srctype != 'strip':
+                # publishing only alter behavior during push
+                #
+                # strip should not touch boundary at all
                 phases.retractboundary(self, phases.draft, added)
 
             # make changelog see real files again
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -795,6 +795,40 @@
   o  0 public a-A - 054250a37db4
   
 
+pushing a locally public and draft changesets remotly secret should make them appear on the remote side
+
+  $ hg -R ../mu phase --secret --force 967b449fbc94
+  $ hg push -r 435b5d83910c ../mu
+  pushing to ../mu
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 0 changes to 2 files
+  $ hgph -R ../mu
+  o  10 draft A-secret - 435b5d83910c
+  |
+  o  9 public a-H - 967b449fbc94
+  |
+  | o  8 public a-F - b740e3e5c05d
+  | |
+  | o  7 public a-E - e9f537e46dea
+  | |
+  +---o  6 public n-B - 145e75495359
+  | |
+  o |  5 public n-A - d6bcb4f74035
+  | |
+  | o  4 public a-D - b555f63b6063
+  | |
+  | o  3 public a-C - 54acac6f23ab
+  | |
+  o |  2 public b-A - f54f1bb90ff3
+  |/
+  o  1 public a-B - 548a3d25dbf0
+  |
+  o  0 public a-A - 054250a37db4
+  
+
 pull new changeset with common draft locally
 
   $ hg up -q 967b449fbc94 # create a new root for draft


More information about the Mercurial-devel mailing list