[PATCH 9 of 9 phases] phases: fix a phase synchronisation on pull

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Jan 8 09:31:02 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1325960513 -3600
# Node ID e2943fc093513d893e4a87c018086f4d7b33fec1
# Parent  17da5afd7d08fd0f85b1fdc98e7200e34c0354c8
phases: fix a phase synchronisation on pull

When localy draft changeset was made public when pulling from a server where
they are secret.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1551,6 +1551,7 @@
                 rheads, rroots = phases.analyzeremotephases(self, subset,
                                                             remotephases)
                 for phase, boundary in enumerate(rheads):
+
                     phases.advanceboundary(self, phase, boundary)
             else:
                 # Remote is old or publishing all common changesets
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -275,7 +275,9 @@
     # compute heads
     phaseheads = [[] for p in allphases]
     for phase in allphases[:-1]:
-        toproof = phaseroots[phase + 1]
+        toproof=[]
+        for above in allphases[phase + 1:]:
+            toproof += phaseroots[above]
         revset = repo.set('heads((%ln + parents(%ln)) - (%ln::%ln))',
                           subset, toproof, toproof, subset)
         phaseheads[phase].extend(c.node() for c in revset)
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
@@ -794,7 +794,63 @@
   |
   o  0 public a-A - 054250a37db4
   
+
+pull new changeset with common draft locally
+
+  $ hg up -q 967b449fbc94 # create a new root for draft
+  $ mkcommit 'alpha-more'
+  created new head
+  $ hg push -fr . ../mu
+  pushing to ../mu
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  $ cd ../mu
+  $ hg phase --secret --force 1c5cfd894796
+  $ hg up -q 435b5d83910c
+  $ mkcommit 'mu-more'
+  $ cd ../alpha
+  $ hg pull ../mu
+  pulling from ../mu
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ hgph
+  o  13 draft mu-more - 5237fb433fc8
+  |
+  | @  12 draft alpha-more - 1c5cfd894796
+  | |
+  o |  11 draft A-secret - 435b5d83910c
+  |/
+  o  10 public a-H - 967b449fbc94
+  |
+  | o  9 draft a-G - 3e27b6f1eee1
+  | |
+  | 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 b-A - f54f1bb90ff3
+  | |
+  | o  3 public a-D - b555f63b6063
+  | |
+  | o  2 public a-C - 54acac6f23ab
+  |/
+  o  1 public a-B - 548a3d25dbf0
+  |
+  o  0 public a-A - 054250a37db4
+  
   $ cd ..
+
 Test Clone behavior
 
 A. Clone without secret changeset
@@ -805,8 +861,12 @@
 
   $ hg clone -U mu Tau
   $ hgph -R Tau
-  o  10 draft A-secret - 435b5d83910c
+  o  12 draft mu-more - 5237fb433fc8
   |
+  | o  11 secret alpha-more - 1c5cfd894796
+  | |
+  o |  10 draft A-secret - 435b5d83910c
+  |/
   o  9 public a-H - 967b449fbc94
   |
   | o  8 public a-F - b740e3e5c05d
@@ -834,8 +894,12 @@
 
   $ hg clone -U alpha Upsilon
   $ hgph -R Upsilon
-  o  11 public A-secret - 435b5d83910c
+  o  13 public mu-more - 5237fb433fc8
   |
+  | o  12 public alpha-more - 1c5cfd894796
+  | |
+  o |  11 public A-secret - 435b5d83910c
+  |/
   o  10 public a-H - 967b449fbc94
   |
   | o  9 public a-G - 3e27b6f1eee1
@@ -858,3 +922,4 @@
   |
   o  0 public a-A - 054250a37db4
   
+


More information about the Mercurial-devel mailing list