Show More
@@ -100,3 +100,43 b' def retractboundary(repo, targetphase, n' | |||
|
100 | 100 | del repo._phaserev |
|
101 | 101 | repo._dirtyphases = True |
|
102 | 102 | |
|
103 | ||
|
104 | def listphases(repo): | |
|
105 | """List phases root for serialisation over pushkey""" | |
|
106 | keys = {} | |
|
107 | for phase in trackedphases: | |
|
108 | for root in repo._phaseroots[phase]: | |
|
109 | keys[hex(root)] = '%i' % phase | |
|
110 | if repo.ui.configbool('phases', 'publish', True): | |
|
111 | # Add an extra data to let remote know we are a publishing repo. | |
|
112 | # Publishing repo can't just pretend they are old repo. When pushing to | |
|
113 | # a publishing repo, the client still need to push phase boundary | |
|
114 | # | |
|
115 | # Push do not only push changeset. It also push phase data. New | |
|
116 | # phase data may apply to common changeset which won't be push (as they | |
|
117 | # are common). Here is a very simple example: | |
|
118 | # | |
|
119 | # 1) repo A push changeset X as draft to repo B | |
|
120 | # 2) repo B make changeset X public | |
|
121 | # 3) repo B push to repo A. X is not pushed but the data that X as now | |
|
122 | # public should | |
|
123 | # | |
|
124 | # The server can't handle it on it's own as it has no idea of client | |
|
125 | # phase data. | |
|
126 | keys['publishing'] = 'True' | |
|
127 | return keys | |
|
128 | ||
|
129 | def pushphase(repo, nhex, oldphasestr, newphasestr): | |
|
130 | """List phases root for serialisation over pushkey""" | |
|
131 | lock = repo.lock() | |
|
132 | try: | |
|
133 | currentphase = repo[nhex].phase() | |
|
134 | newphase = abs(int(newphasestr)) # let's avoid negative index surprise | |
|
135 | oldphase = abs(int(oldphasestr)) # let's avoid negative index surprise | |
|
136 | if currentphase == oldphase and newphase < oldphase: | |
|
137 | advanceboundary(repo, newphase, [bin(nhex)]) | |
|
138 | return 1 | |
|
139 | else: | |
|
140 | return 0 | |
|
141 | finally: | |
|
142 | lock.release() |
@@ -5,7 +5,7 b'' | |||
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | import bookmarks | |
|
8 | import bookmarks, phases | |
|
9 | 9 | |
|
10 | 10 | def _nslist(repo): |
|
11 | 11 | n = {} |
@@ -14,7 +14,9 b' def _nslist(repo):' | |||
|
14 | 14 | return n |
|
15 | 15 | |
|
16 | 16 | _namespaces = {"namespaces": (lambda *x: False, _nslist), |
|
17 |
"bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks) |
|
|
17 | "bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks), | |
|
18 | "phases": (phases.pushphase, phases.listphases), | |
|
19 | } | |
|
18 | 20 | |
|
19 | 21 | def register(namespace, pushkey, listkeys): |
|
20 | 22 | _namespaces[namespace] = (pushkey, listkeys) |
@@ -34,6 +34,7 b' import bookmark by name' | |||
|
34 | 34 | Y 0:4e3505fd9583 |
|
35 | 35 | $ hg debugpushkey ../a namespaces |
|
36 | 36 | bookmarks |
|
37 | phases | |
|
37 | 38 | namespaces |
|
38 | 39 | $ hg debugpushkey ../a bookmarks |
|
39 | 40 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
@@ -151,6 +152,7 b' hgweb' | |||
|
151 | 152 | |
|
152 | 153 | $ hg debugpushkey http://localhost:$HGPORT/ namespaces |
|
153 | 154 | bookmarks |
|
155 | phases | |
|
154 | 156 | namespaces |
|
155 | 157 | $ hg debugpushkey http://localhost:$HGPORT/ bookmarks |
|
156 | 158 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
General Comments 0
You need to be logged in to leave comments.
Login now