##// END OF EJS Templates
push: perform phases discovery before the push...
Pierre-Yves David -
r22019:9fcf772f default
parent child Browse files
Show More
@@ -77,6 +77,10 b' class pushoperation(object):'
77 self.remoteheads = None
77 self.remoteheads = None
78 # testable as a boolean indicating if any nodes are missing locally.
78 # testable as a boolean indicating if any nodes are missing locally.
79 self.incoming = None
79 self.incoming = None
80 # phases changes that must be pushed along side the changesets
81 self.outdatedphases = None
82 # phases changes that must be pushed if changeset push fails
83 self.fallbackoutdatedphases = None
80
84
81 @util.propertycache
85 @util.propertycache
82 def futureheads(self):
86 def futureheads(self):
@@ -237,6 +241,41 b' def _pushdiscoverychangeset(pushop):'
237 pushop.remoteheads = remoteheads
241 pushop.remoteheads = remoteheads
238 pushop.incoming = inc
242 pushop.incoming = inc
239
243
244 @pushdiscovery('phase')
245 def _pushdiscoveryphase(pushop):
246 """discover the phase that needs to be pushed
247
248 (computed for both success and failure case for changesets push)"""
249 outgoing = pushop.outgoing
250 unfi = pushop.repo.unfiltered()
251 remotephases = pushop.remote.listkeys('phases')
252 publishing = remotephases.get('publishing', False)
253 ana = phases.analyzeremotephases(pushop.repo,
254 pushop.fallbackheads,
255 remotephases)
256 pheads, droots = ana
257 extracond = ''
258 if not publishing:
259 extracond = ' and public()'
260 revset = 'heads((%%ln::%%ln) %s)' % extracond
261 # Get the list of all revs draft on remote by public here.
262 # XXX Beware that revset break if droots is not strictly
263 # XXX root we may want to ensure it is but it is costly
264 fallback = list(unfi.set(revset, droots, pushop.fallbackheads))
265 if not outgoing.missing:
266 future = fallback
267 else:
268 # adds changeset we are going to push as draft
269 #
270 # should not be necessary for pushblishing server, but because of an
271 # issue fixed in xxxxx we have to do it anyway.
272 fdroots = list(unfi.set('roots(%ln + %ln::)',
273 outgoing.missing, droots))
274 fdroots = [f.node() for f in fdroots]
275 future = list(unfi.set(revset, fdroots, pushop.futureheads))
276 pushop.outdatedphases = future
277 pushop.fallbackoutdatedphases = fallback
278
240 def _pushcheckoutgoing(pushop):
279 def _pushcheckoutgoing(pushop):
241 outgoing = pushop.outgoing
280 outgoing = pushop.outgoing
242 unfi = pushop.repo.unfiltered()
281 unfi = pushop.repo.unfiltered()
@@ -408,7 +447,6 b' def _pushchangeset(pushop):'
408
447
409 def _pushsyncphase(pushop):
448 def _pushsyncphase(pushop):
410 """synchronise phase information locally and remotely"""
449 """synchronise phase information locally and remotely"""
411 unfi = pushop.repo.unfiltered()
412 cheads = pushop.commonheads
450 cheads = pushop.commonheads
413 # even when we don't push, exchanging phase data is useful
451 # even when we don't push, exchanging phase data is useful
414 remotephases = pushop.remote.listkeys('phases')
452 remotephases = pushop.remote.listkeys('phases')
@@ -441,11 +479,13 b' def _pushsyncphase(pushop):'
441 _localphasemove(pushop, cheads, phases.draft)
479 _localphasemove(pushop, cheads, phases.draft)
442 ### Apply local phase on remote
480 ### Apply local phase on remote
443
481
444 # Get the list of all revs draft on remote by public here.
482 if pushop.ret:
445 # XXX Beware that revset break if droots is not strictly
483 outdated = pushop.outdatedphases
446 # XXX root we may want to ensure it is but it is costly
484 else:
447 outdated = unfi.set('heads((%ln::%ln) and public())',
485 outdated = pushop.fallbackoutdatedphases
448 droots, cheads)
486
487 # filter heads already turned public by the push
488 outdated = [c for c in outdated if c.node() not in pheads]
449
489
450 b2caps = bundle2.bundle2caps(pushop.remote)
490 b2caps = bundle2.bundle2caps(pushop.remote)
451 if 'b2x:pushkey' in b2caps:
491 if 'b2x:pushkey' in b2caps:
@@ -82,6 +82,7 b' Extension disabled for lack of a hook'
82 query 1; heads
82 query 1; heads
83 searching for changes
83 searching for changes
84 all remote heads known locally
84 all remote heads known locally
85 listing keys for "phases"
85 listing keys for "bookmarks"
86 listing keys for "bookmarks"
86 3 changesets found
87 3 changesets found
87 list of changesets:
88 list of changesets:
@@ -140,6 +141,7 b' Extension disabled for lack of acl.sourc'
140 query 1; heads
141 query 1; heads
141 searching for changes
142 searching for changes
142 all remote heads known locally
143 all remote heads known locally
144 listing keys for "phases"
143 invalid branchheads cache (served): tip differs
145 invalid branchheads cache (served): tip differs
144 listing keys for "bookmarks"
146 listing keys for "bookmarks"
145 3 changesets found
147 3 changesets found
@@ -202,6 +204,7 b' No [acl.allow]/[acl.deny]'
202 query 1; heads
204 query 1; heads
203 searching for changes
205 searching for changes
204 all remote heads known locally
206 all remote heads known locally
207 listing keys for "phases"
205 invalid branchheads cache (served): tip differs
208 invalid branchheads cache (served): tip differs
206 listing keys for "bookmarks"
209 listing keys for "bookmarks"
207 3 changesets found
210 3 changesets found
@@ -274,6 +277,7 b' Empty [acl.allow]'
274 query 1; heads
277 query 1; heads
275 searching for changes
278 searching for changes
276 all remote heads known locally
279 all remote heads known locally
280 listing keys for "phases"
277 invalid branchheads cache (served): tip differs
281 invalid branchheads cache (served): tip differs
278 listing keys for "bookmarks"
282 listing keys for "bookmarks"
279 3 changesets found
283 3 changesets found
@@ -341,6 +345,7 b' fred is allowed inside foo/'
341 query 1; heads
345 query 1; heads
342 searching for changes
346 searching for changes
343 all remote heads known locally
347 all remote heads known locally
348 listing keys for "phases"
344 invalid branchheads cache (served): tip differs
349 invalid branchheads cache (served): tip differs
345 listing keys for "bookmarks"
350 listing keys for "bookmarks"
346 3 changesets found
351 3 changesets found
@@ -413,6 +418,7 b' Empty [acl.deny]'
413 query 1; heads
418 query 1; heads
414 searching for changes
419 searching for changes
415 all remote heads known locally
420 all remote heads known locally
421 listing keys for "phases"
416 invalid branchheads cache (served): tip differs
422 invalid branchheads cache (served): tip differs
417 listing keys for "bookmarks"
423 listing keys for "bookmarks"
418 3 changesets found
424 3 changesets found
@@ -482,6 +488,7 b' fred is allowed inside foo/, but not foo'
482 query 1; heads
488 query 1; heads
483 searching for changes
489 searching for changes
484 all remote heads known locally
490 all remote heads known locally
491 listing keys for "phases"
485 invalid branchheads cache (served): tip differs
492 invalid branchheads cache (served): tip differs
486 listing keys for "bookmarks"
493 listing keys for "bookmarks"
487 3 changesets found
494 3 changesets found
@@ -556,6 +563,7 b' fred is allowed inside foo/, but not foo'
556 query 1; heads
563 query 1; heads
557 searching for changes
564 searching for changes
558 all remote heads known locally
565 all remote heads known locally
566 listing keys for "phases"
559 invalid branchheads cache (served): tip differs
567 invalid branchheads cache (served): tip differs
560 listing keys for "bookmarks"
568 listing keys for "bookmarks"
561 3 changesets found
569 3 changesets found
@@ -627,6 +635,7 b' fred is allowed inside foo/, but not foo'
627 query 1; heads
635 query 1; heads
628 searching for changes
636 searching for changes
629 all remote heads known locally
637 all remote heads known locally
638 listing keys for "phases"
630 invalid branchheads cache (served): tip differs
639 invalid branchheads cache (served): tip differs
631 listing keys for "bookmarks"
640 listing keys for "bookmarks"
632 3 changesets found
641 3 changesets found
@@ -700,6 +709,7 b' barney is allowed everywhere'
700 query 1; heads
709 query 1; heads
701 searching for changes
710 searching for changes
702 all remote heads known locally
711 all remote heads known locally
712 listing keys for "phases"
703 invalid branchheads cache (served): tip differs
713 invalid branchheads cache (served): tip differs
704 listing keys for "bookmarks"
714 listing keys for "bookmarks"
705 3 changesets found
715 3 changesets found
@@ -779,6 +789,7 b' wilma can change files with a .txt exten'
779 query 1; heads
789 query 1; heads
780 searching for changes
790 searching for changes
781 all remote heads known locally
791 all remote heads known locally
792 listing keys for "phases"
782 invalid branchheads cache (served): tip differs
793 invalid branchheads cache (served): tip differs
783 listing keys for "bookmarks"
794 listing keys for "bookmarks"
784 3 changesets found
795 3 changesets found
@@ -859,6 +870,7 b' file specified by acl.config does not ex'
859 query 1; heads
870 query 1; heads
860 searching for changes
871 searching for changes
861 all remote heads known locally
872 all remote heads known locally
873 listing keys for "phases"
862 invalid branchheads cache (served): tip differs
874 invalid branchheads cache (served): tip differs
863 listing keys for "bookmarks"
875 listing keys for "bookmarks"
864 3 changesets found
876 3 changesets found
@@ -934,6 +946,7 b' betty is allowed inside foo/ by a acl.co'
934 query 1; heads
946 query 1; heads
935 searching for changes
947 searching for changes
936 all remote heads known locally
948 all remote heads known locally
949 listing keys for "phases"
937 invalid branchheads cache (served): tip differs
950 invalid branchheads cache (served): tip differs
938 listing keys for "bookmarks"
951 listing keys for "bookmarks"
939 3 changesets found
952 3 changesets found
@@ -1020,6 +1033,7 b' acl.config can set only [acl.allow]/[acl'
1020 query 1; heads
1033 query 1; heads
1021 searching for changes
1034 searching for changes
1022 all remote heads known locally
1035 all remote heads known locally
1036 listing keys for "phases"
1023 invalid branchheads cache (served): tip differs
1037 invalid branchheads cache (served): tip differs
1024 listing keys for "bookmarks"
1038 listing keys for "bookmarks"
1025 3 changesets found
1039 3 changesets found
@@ -1100,6 +1114,7 b' fred is always allowed'
1100 query 1; heads
1114 query 1; heads
1101 searching for changes
1115 searching for changes
1102 all remote heads known locally
1116 all remote heads known locally
1117 listing keys for "phases"
1103 invalid branchheads cache (served): tip differs
1118 invalid branchheads cache (served): tip differs
1104 listing keys for "bookmarks"
1119 listing keys for "bookmarks"
1105 3 changesets found
1120 3 changesets found
@@ -1176,6 +1191,7 b' no one is allowed inside foo/Bar/'
1176 query 1; heads
1191 query 1; heads
1177 searching for changes
1192 searching for changes
1178 all remote heads known locally
1193 all remote heads known locally
1194 listing keys for "phases"
1179 invalid branchheads cache (served): tip differs
1195 invalid branchheads cache (served): tip differs
1180 listing keys for "bookmarks"
1196 listing keys for "bookmarks"
1181 3 changesets found
1197 3 changesets found
@@ -1252,6 +1268,7 b' OS-level groups'
1252 query 1; heads
1268 query 1; heads
1253 searching for changes
1269 searching for changes
1254 all remote heads known locally
1270 all remote heads known locally
1271 listing keys for "phases"
1255 invalid branchheads cache (served): tip differs
1272 invalid branchheads cache (served): tip differs
1256 listing keys for "bookmarks"
1273 listing keys for "bookmarks"
1257 3 changesets found
1274 3 changesets found
@@ -1329,6 +1346,7 b' OS-level groups'
1329 query 1; heads
1346 query 1; heads
1330 searching for changes
1347 searching for changes
1331 all remote heads known locally
1348 all remote heads known locally
1349 listing keys for "phases"
1332 invalid branchheads cache (served): tip differs
1350 invalid branchheads cache (served): tip differs
1333 listing keys for "bookmarks"
1351 listing keys for "bookmarks"
1334 3 changesets found
1352 3 changesets found
@@ -1444,6 +1462,7 b' No branch acls specified'
1444 query 1; heads
1462 query 1; heads
1445 searching for changes
1463 searching for changes
1446 all remote heads known locally
1464 all remote heads known locally
1465 listing keys for "phases"
1447 listing keys for "bookmarks"
1466 listing keys for "bookmarks"
1448 4 changesets found
1467 4 changesets found
1449 list of changesets:
1468 list of changesets:
@@ -1527,6 +1546,7 b' Branch acl deny test'
1527 query 1; heads
1546 query 1; heads
1528 searching for changes
1547 searching for changes
1529 all remote heads known locally
1548 all remote heads known locally
1549 listing keys for "phases"
1530 listing keys for "bookmarks"
1550 listing keys for "bookmarks"
1531 4 changesets found
1551 4 changesets found
1532 list of changesets:
1552 list of changesets:
@@ -1606,6 +1626,7 b' Branch acl empty allow test'
1606 query 1; heads
1626 query 1; heads
1607 searching for changes
1627 searching for changes
1608 all remote heads known locally
1628 all remote heads known locally
1629 listing keys for "phases"
1609 listing keys for "bookmarks"
1630 listing keys for "bookmarks"
1610 4 changesets found
1631 4 changesets found
1611 list of changesets:
1632 list of changesets:
@@ -1681,6 +1702,7 b' Branch acl allow other'
1681 query 1; heads
1702 query 1; heads
1682 searching for changes
1703 searching for changes
1683 all remote heads known locally
1704 all remote heads known locally
1705 listing keys for "phases"
1684 listing keys for "bookmarks"
1706 listing keys for "bookmarks"
1685 4 changesets found
1707 4 changesets found
1686 list of changesets:
1708 list of changesets:
@@ -1750,6 +1772,7 b' Branch acl allow other'
1750 query 1; heads
1772 query 1; heads
1751 searching for changes
1773 searching for changes
1752 all remote heads known locally
1774 all remote heads known locally
1775 listing keys for "phases"
1753 listing keys for "bookmarks"
1776 listing keys for "bookmarks"
1754 4 changesets found
1777 4 changesets found
1755 list of changesets:
1778 list of changesets:
@@ -1838,6 +1861,7 b' push foobar into the remote'
1838 query 1; heads
1861 query 1; heads
1839 searching for changes
1862 searching for changes
1840 all remote heads known locally
1863 all remote heads known locally
1864 listing keys for "phases"
1841 listing keys for "bookmarks"
1865 listing keys for "bookmarks"
1842 4 changesets found
1866 4 changesets found
1843 list of changesets:
1867 list of changesets:
@@ -1925,6 +1949,7 b' Branch acl conflicting deny'
1925 query 1; heads
1949 query 1; heads
1926 searching for changes
1950 searching for changes
1927 all remote heads known locally
1951 all remote heads known locally
1952 listing keys for "phases"
1928 listing keys for "bookmarks"
1953 listing keys for "bookmarks"
1929 4 changesets found
1954 4 changesets found
1930 list of changesets:
1955 list of changesets:
@@ -1999,6 +2024,7 b" User 'astro' must not be denied"
1999 query 1; heads
2024 query 1; heads
2000 searching for changes
2025 searching for changes
2001 all remote heads known locally
2026 all remote heads known locally
2027 listing keys for "phases"
2002 listing keys for "bookmarks"
2028 listing keys for "bookmarks"
2003 4 changesets found
2029 4 changesets found
2004 list of changesets:
2030 list of changesets:
@@ -2080,6 +2106,7 b' Non-astro users must be denied'
2080 query 1; heads
2106 query 1; heads
2081 searching for changes
2107 searching for changes
2082 all remote heads known locally
2108 all remote heads known locally
2109 listing keys for "phases"
2083 listing keys for "bookmarks"
2110 listing keys for "bookmarks"
2084 4 changesets found
2111 4 changesets found
2085 list of changesets:
2112 list of changesets:
@@ -210,6 +210,7 b' test that prepushkey can prevent incomin'
210 $ hg push -B baz ../a
210 $ hg push -B baz ../a
211 pushing to ../a
211 pushing to ../a
212 searching for changes
212 searching for changes
213 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
213 no changes found
214 no changes found
214 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
215 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
215 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
216 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
@@ -261,9 +261,10 b' test http authentication'
261 "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces
261 "GET /?cmd=listkeys HTTP/1.1" 403 - x-hgarg-1:namespace=namespaces
262 "GET /?cmd=capabilities HTTP/1.1" 200 -
262 "GET /?cmd=capabilities HTTP/1.1" 200 -
263 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872
263 "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D7f4e523d01f2cc3765ac8934da3d14db775ff872
264 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=phases
265 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
264 "GET /?cmd=branchmap HTTP/1.1" 200 -
266 "GET /?cmd=branchmap HTTP/1.1" 200 -
265 "GET /?cmd=branchmap HTTP/1.1" 200 -
267 "GET /?cmd=branchmap HTTP/1.1" 200 -
266 "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=bookmarks
267 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
268 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
268 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524
269 "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+5eb5abfefeea63c80dd7553bcc3783f37e0c5524
269 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
270 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
@@ -317,6 +317,7 b' Check obsolete keys are exchanged only i'
317 $ hg init empty
317 $ hg init empty
318 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
318 $ hg --config extensions.debugkeys=debugkeys.py -R empty push tmpd
319 pushing to tmpd
319 pushing to tmpd
320 listkeys phases
320 no changes found
321 no changes found
321 listkeys phases
322 listkeys phases
322 listkeys bookmarks
323 listkeys bookmarks
@@ -35,6 +35,7 b''
35 searching: 2 queries
35 searching: 2 queries
36 query 2; still undecided: 1, sample size is: 1
36 query 2; still undecided: 1, sample size is: 1
37 2 total queries
37 2 total queries
38 listing keys for "phases"
38 listing keys for "bookmarks"
39 listing keys for "bookmarks"
39 remote has heads on branch 'default' that are not known locally: 1c9246a22a0a
40 remote has heads on branch 'default' that are not known locally: 1c9246a22a0a
40 new remote heads on branch 'default':
41 new remote heads on branch 'default':
General Comments 0
You need to be logged in to leave comments. Login now