diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2045,10 +2045,12 @@ class localrepository(repo.repository): url=url, pending=p) added = [cl.node(r) for r in xrange(clstart, clend)] - if self.ui.configbool('phases', 'publish', True): - if srctype != 'strip': - phases.advanceboundary(self, 0, added) - else: + publishing = self.ui.configbool('phases', 'publish', True) + if publishing and srctype == 'push': + # Old server can not push the boundary themself. + # This clause ensure pushed changeset are alway marked as public + phases.advanceboundary(self, 0, added) + elif srctype != 'strip': # strip should not touch boundary at all phases.retractboundary(self, 1, added) # make changelog see real files again diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -1,11 +1,99 @@ -# Mercurial phases support code -# -# Copyright 2011 Pierre-Yves David -# Logilab SA -# Augie Fackler -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2 or any later version. +""" Mercurial phases support code + + --- + + Copyright 2011 Pierre-Yves David + Logilab SA + Augie Fackler + + This software may be used and distributed according to the terms of the + GNU General Public License version 2 or any later version. + + --- + +This module implements most phase logic in mercurial. + + +Basic Concept +============= + +A 'changeset phases' is an indicator that tells us how a changeset is +manipulated and communicated. The details of each phase is described below, +here we describe the properties they have in common. + +Like bookmarks, phases are not stored in history and thus are not permanent and +leave no audit trail. + +First, no changeset can be in two phases at once. Phases are ordered, so they +can be considered from lowest to highest. The default, lowest phase is 'public' +- this is the normal phase of existing changesets. A child changeset can not be +in a lower phase than its parents. + +These phases share a hierarchy of traits: + + immutable shared + public: X X + draft: X + +local commits are draft by default + +Phase movement and exchange +============================ + +Phase data are exchanged by pushkey on pull and push. Some server have a +publish option set, we call them publishing server. Pushing to such server make +draft changeset publish. + +A small list of fact/rules define the exchange of phase: + +* old client never changes server states +* pull never changes server states +* publish and old server csets are seen as public by client + + +Here is the final table summing up the 49 possible usecase of phase exchange: + + server + old publish non-publish + N X N D P N D P + old client + pull + N - X/X - X/D X/P - X/D X/P + X - X/X - X/D X/P - X/D X/P + push + X X/X X/X X/P X/P X/P X/D X/D X/P + new client + pull + N - P/X - P/D P/P - D/D P/P + D - P/X - P/D P/P - D/D P/P + P - P/X - P/D P/P - P/D P/P + push + D P/X P/X P/P P/P P/P D/D D/D P/P + P P/X P/X P/P P/P P/P P/P P/P P/P + +Legend: + + A/B = final state on client / state on server + + * N = new/not present, + * P = public, + * D = draft, + * X = not tracked (ie: the old client or server has no internal way of + recording the phase.) + + passive = only pushes + + + A cell here can be read like this: + + "When a new client pushes a draft changeset (D) to a publishing server + where it's not present (N), it's marked public on both sides (P/P)." + +Note: old client behave as publish server with Draft only content +- other people see it as public +- content is pushed as draft + +""" import errno from node import nullid, bin, hex, short diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks.t @@ -96,6 +96,7 @@ Repo r3 should not be hardlinked: 1 r3/.hg/store/data/d1/f2.i 1 r3/.hg/store/data/f1.i 1 r3/.hg/store/fncache + 1 r3/.hg/store/phaseroots 1 r3/.hg/store/undo 1 r3/.hg/store/undo.phaseroots 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 @@ -245,8 +245,8 @@ pulling into publish=True added 2 changesets with 2 changes to 2 files (run 'hg update' to get a working copy) $ hgph - 6 0 n-B - 145e75495359 - 5 0 n-A - d6bcb4f74035 + 6 1 n-B - 145e75495359 + 5 1 n-A - d6bcb4f74035 4 0 b-A - f54f1bb90ff3 3 0 a-D - b555f63b6063 2 0 a-C - 54acac6f23ab @@ -269,15 +269,38 @@ pulling back into original repo 2 0 a-C - 54acac6f23ab 1 0 a-B - 548a3d25dbf0 0 0 a-A - 054250a37db4 - $ cd .. Push ```` +(inserted) + +Test that phase are pushed even when they are nothing to pus +(this might be tested later bu are very convenient to not alter too much test) + +Push back to alpha + + $ hg push ../alpha # from nu + pushing to ../alpha + searching for changes + no changes found + $ cd .. + $ cd alpha + $ hgph + 6 0 n-B - 145e75495359 + 5 0 n-A - d6bcb4f74035 + 4 0 b-A - f54f1bb90ff3 + 3 0 a-D - b555f63b6063 + 2 0 a-C - 54acac6f23ab + 1 0 a-B - 548a3d25dbf0 + 0 0 a-A - 054250a37db4 + +(end insertion) + + initial setup - $ cd alpha - $ hg glog + $ hg glog # of alpha o changeset: 6:145e75495359 | tag: tip | user: test