##// END OF EJS Templates
phases: add basic pushkey support
Pierre-Yves David -
r15648:79cc89de default
parent child Browse files
Show More
@@ -100,3 +100,43 b' def retractboundary(repo, targetphase, n'
100 del repo._phaserev
100 del repo._phaserev
101 repo._dirtyphases = True
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 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import bookmarks
8 import bookmarks, phases
9
9
10 def _nslist(repo):
10 def _nslist(repo):
11 n = {}
11 n = {}
@@ -14,7 +14,9 b' def _nslist(repo):'
14 return n
14 return n
15
15
16 _namespaces = {"namespaces": (lambda *x: False, _nslist),
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 def register(namespace, pushkey, listkeys):
21 def register(namespace, pushkey, listkeys):
20 _namespaces[namespace] = (pushkey, listkeys)
22 _namespaces[namespace] = (pushkey, listkeys)
@@ -34,6 +34,7 b' import bookmark by name'
34 Y 0:4e3505fd9583
34 Y 0:4e3505fd9583
35 $ hg debugpushkey ../a namespaces
35 $ hg debugpushkey ../a namespaces
36 bookmarks
36 bookmarks
37 phases
37 namespaces
38 namespaces
38 $ hg debugpushkey ../a bookmarks
39 $ hg debugpushkey ../a bookmarks
39 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
40 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
@@ -151,6 +152,7 b' hgweb'
151
152
152 $ hg debugpushkey http://localhost:$HGPORT/ namespaces
153 $ hg debugpushkey http://localhost:$HGPORT/ namespaces
153 bookmarks
154 bookmarks
155 phases
154 namespaces
156 namespaces
155 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
157 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
156 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
158 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
@@ -165,6 +165,7 b' test pushkeys and bookmarks'
165 $ cd ../local
165 $ cd ../local
166 $ hg debugpushkey --config ui.ssh="python $TESTDIR/dummyssh" ssh://user@dummy/remote namespaces
166 $ hg debugpushkey --config ui.ssh="python $TESTDIR/dummyssh" ssh://user@dummy/remote namespaces
167 bookmarks
167 bookmarks
168 phases
168 namespaces
169 namespaces
169 $ hg book foo -r 0
170 $ hg book foo -r 0
170 $ hg out -B
171 $ hg out -B
General Comments 0
You need to be logged in to leave comments. Login now