##// END OF EJS Templates
phases: change publish behavior to only alter behavior when server....
Pierre-Yves David -
r15659:7fba5a24 default
parent child Browse files
Show More
@@ -2045,10 +2045,12 b' class localrepository(repo.repository):'
2045 url=url, pending=p)
2045 url=url, pending=p)
2046
2046
2047 added = [cl.node(r) for r in xrange(clstart, clend)]
2047 added = [cl.node(r) for r in xrange(clstart, clend)]
2048 if self.ui.configbool('phases', 'publish', True):
2048 publishing = self.ui.configbool('phases', 'publish', True)
2049 if srctype != 'strip':
2049 if publishing and srctype == 'push':
2050 phases.advanceboundary(self, 0, added)
2050 # Old server can not push the boundary themself.
2051 else:
2051 # This clause ensure pushed changeset are alway marked as public
2052 phases.advanceboundary(self, 0, added)
2053 elif srctype != 'strip': # strip should not touch boundary at all
2052 phases.retractboundary(self, 1, added)
2054 phases.retractboundary(self, 1, added)
2053
2055
2054 # make changelog see real files again
2056 # make changelog see real files again
@@ -1,11 +1,99 b''
1 # Mercurial phases support code
1 """ Mercurial phases support code
2 #
2
3 # Copyright 2011 Pierre-Yves David <pierre-yves.david@ens-lyon.org>
3 ---
4 # Logilab SA <contact@logilab.fr>
4
5 # Augie Fackler <durin42@gmail.com>
5 Copyright 2011 Pierre-Yves David <pierre-yves.david@ens-lyon.org>
6 #
6 Logilab SA <contact@logilab.fr>
7 # This software may be used and distributed according to the terms of the
7 Augie Fackler <durin42@gmail.com>
8 # GNU General Public License version 2 or any later version.
8
9 This software may be used and distributed according to the terms of the
10 GNU General Public License version 2 or any later version.
11
12 ---
13
14 This module implements most phase logic in mercurial.
15
16
17 Basic Concept
18 =============
19
20 A 'changeset phases' is an indicator that tells us how a changeset is
21 manipulated and communicated. The details of each phase is described below,
22 here we describe the properties they have in common.
23
24 Like bookmarks, phases are not stored in history and thus are not permanent and
25 leave no audit trail.
26
27 First, no changeset can be in two phases at once. Phases are ordered, so they
28 can be considered from lowest to highest. The default, lowest phase is 'public'
29 - this is the normal phase of existing changesets. A child changeset can not be
30 in a lower phase than its parents.
31
32 These phases share a hierarchy of traits:
33
34 immutable shared
35 public: X X
36 draft: X
37
38 local commits are draft by default
39
40 Phase movement and exchange
41 ============================
42
43 Phase data are exchanged by pushkey on pull and push. Some server have a
44 publish option set, we call them publishing server. Pushing to such server make
45 draft changeset publish.
46
47 A small list of fact/rules define the exchange of phase:
48
49 * old client never changes server states
50 * pull never changes server states
51 * publish and old server csets are seen as public by client
52
53
54 Here is the final table summing up the 49 possible usecase of phase exchange:
55
56 server
57 old publish non-publish
58 N X N D P N D P
59 old client
60 pull
61 N - X/X - X/D X/P - X/D X/P
62 X - X/X - X/D X/P - X/D X/P
63 push
64 X X/X X/X X/P X/P X/P X/D X/D X/P
65 new client
66 pull
67 N - P/X - P/D P/P - D/D P/P
68 D - P/X - P/D P/P - D/D P/P
69 P - P/X - P/D P/P - P/D P/P
70 push
71 D P/X P/X P/P P/P P/P D/D D/D P/P
72 P P/X P/X P/P P/P P/P P/P P/P P/P
73
74 Legend:
75
76 A/B = final state on client / state on server
77
78 * N = new/not present,
79 * P = public,
80 * D = draft,
81 * X = not tracked (ie: the old client or server has no internal way of
82 recording the phase.)
83
84 passive = only pushes
85
86
87 A cell here can be read like this:
88
89 "When a new client pushes a draft changeset (D) to a publishing server
90 where it's not present (N), it's marked public on both sides (P/P)."
91
92 Note: old client behave as publish server with Draft only content
93 - other people see it as public
94 - content is pushed as draft
95
96 """
9
97
10 import errno
98 import errno
11 from node import nullid, bin, hex, short
99 from node import nullid, bin, hex, short
@@ -96,6 +96,7 b' Repo r3 should not be hardlinked:'
96 1 r3/.hg/store/data/d1/f2.i
96 1 r3/.hg/store/data/d1/f2.i
97 1 r3/.hg/store/data/f1.i
97 1 r3/.hg/store/data/f1.i
98 1 r3/.hg/store/fncache
98 1 r3/.hg/store/fncache
99 1 r3/.hg/store/phaseroots
99 1 r3/.hg/store/undo
100 1 r3/.hg/store/undo
100 1 r3/.hg/store/undo.phaseroots
101 1 r3/.hg/store/undo.phaseroots
101
102
@@ -245,8 +245,8 b' pulling into publish=True'
245 added 2 changesets with 2 changes to 2 files
245 added 2 changesets with 2 changes to 2 files
246 (run 'hg update' to get a working copy)
246 (run 'hg update' to get a working copy)
247 $ hgph
247 $ hgph
248 6 0 n-B - 145e75495359
248 6 1 n-B - 145e75495359
249 5 0 n-A - d6bcb4f74035
249 5 1 n-A - d6bcb4f74035
250 4 0 b-A - f54f1bb90ff3
250 4 0 b-A - f54f1bb90ff3
251 3 0 a-D - b555f63b6063
251 3 0 a-D - b555f63b6063
252 2 0 a-C - 54acac6f23ab
252 2 0 a-C - 54acac6f23ab
@@ -269,15 +269,38 b' pulling back into original repo'
269 2 0 a-C - 54acac6f23ab
269 2 0 a-C - 54acac6f23ab
270 1 0 a-B - 548a3d25dbf0
270 1 0 a-B - 548a3d25dbf0
271 0 0 a-A - 054250a37db4
271 0 0 a-A - 054250a37db4
272 $ cd ..
273
272
274 Push
273 Push
275 ````
274 ````
276
275
276 (inserted)
277
278 Test that phase are pushed even when they are nothing to pus
279 (this might be tested later bu are very convenient to not alter too much test)
280
281 Push back to alpha
282
283 $ hg push ../alpha # from nu
284 pushing to ../alpha
285 searching for changes
286 no changes found
287 $ cd ..
288 $ cd alpha
289 $ hgph
290 6 0 n-B - 145e75495359
291 5 0 n-A - d6bcb4f74035
292 4 0 b-A - f54f1bb90ff3
293 3 0 a-D - b555f63b6063
294 2 0 a-C - 54acac6f23ab
295 1 0 a-B - 548a3d25dbf0
296 0 0 a-A - 054250a37db4
297
298 (end insertion)
299
300
277 initial setup
301 initial setup
278
302
279 $ cd alpha
303 $ hg glog # of alpha
280 $ hg glog
281 o changeset: 6:145e75495359
304 o changeset: 6:145e75495359
282 | tag: tip
305 | tag: tip
283 | user: test
306 | user: test
General Comments 0
You need to be logged in to leave comments. Login now