phases: move phase according what was pushed not only what was added added
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 13 Jan 2012 01:42:47 +0100
changeset 15891 249d3420ec9c
parent 15890 e234eda20984
child 15892 592b3d1742a1
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.
mercurial/localrepo.py
tests/test-phases-exchange.t
--- a/mercurial/localrepo.py	Fri Jan 13 01:29:03 2012 +0100
+++ b/mercurial/localrepo.py	Fri Jan 13 01:42:47 2012 +0100
@@ -2111,11 +2111,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
--- a/tests/test-phases-exchange.t	Fri Jan 13 01:29:03 2012 +0100
+++ b/tests/test-phases-exchange.t	Fri Jan 13 01:42:47 2012 +0100
@@ -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