equal
deleted
inserted
replaced
1022 return |
1022 return |
1023 b2caps = bundle2.bundle2caps(pushop.remote) |
1023 b2caps = bundle2.bundle2caps(pushop.remote) |
1024 hasphaseheads = b'heads' in b2caps.get(b'phases', ()) |
1024 hasphaseheads = b'heads' in b2caps.get(b'phases', ()) |
1025 if pushop.remotephases is not None and hasphaseheads: |
1025 if pushop.remotephases is not None and hasphaseheads: |
1026 # check that the remote phase has not changed |
1026 # check that the remote phase has not changed |
1027 checks = [[] for p in phases.allphases] |
1027 checks = {p: [] for p in phases.allphases} |
1028 checks[phases.public].extend(pushop.remotephases.publicheads) |
1028 checks[phases.public].extend(pushop.remotephases.publicheads) |
1029 checks[phases.draft].extend(pushop.remotephases.draftroots) |
1029 checks[phases.draft].extend(pushop.remotephases.draftroots) |
1030 if any(checks): |
1030 if any(pycompat.itervalues(checks)): |
1031 for nodes in checks: |
1031 for phase in checks: |
1032 nodes.sort() |
1032 checks[phase].sort() |
1033 checkdata = phases.binaryencode(checks) |
1033 checkdata = phases.binaryencode(checks) |
1034 bundler.newpart(b'check:phases', data=checkdata) |
1034 bundler.newpart(b'check:phases', data=checkdata) |
1035 |
1035 |
1036 |
1036 |
1037 @b2partsgenerator(b'changeset') |
1037 @b2partsgenerator(b'changeset') |
1102 |
1102 |
1103 def _pushb2phaseheads(pushop, bundler): |
1103 def _pushb2phaseheads(pushop, bundler): |
1104 """push phase information through a bundle2 - binary part""" |
1104 """push phase information through a bundle2 - binary part""" |
1105 pushop.stepsdone.add(b'phases') |
1105 pushop.stepsdone.add(b'phases') |
1106 if pushop.outdatedphases: |
1106 if pushop.outdatedphases: |
1107 updates = [[] for p in phases.allphases] |
1107 updates = {p: [] for p in phases.allphases} |
1108 updates[0].extend(h.node() for h in pushop.outdatedphases) |
1108 updates[0].extend(h.node() for h in pushop.outdatedphases) |
1109 phasedata = phases.binaryencode(updates) |
1109 phasedata = phases.binaryencode(updates) |
1110 bundler.newpart(b'phase-heads', data=phasedata) |
1110 bundler.newpart(b'phase-heads', data=phasedata) |
1111 |
1111 |
1112 |
1112 |
2656 extraheads = repo.revs(revset, draftheads, publicheads) |
2656 extraheads = repo.revs(revset, draftheads, publicheads) |
2657 for r in extraheads: |
2657 for r in extraheads: |
2658 headsbyphase[phases.public].add(node(r)) |
2658 headsbyphase[phases.public].add(node(r)) |
2659 |
2659 |
2660 # transform data in a format used by the encoding function |
2660 # transform data in a format used by the encoding function |
2661 phasemapping = [] |
2661 phasemapping = { |
2662 for phase in phases.allphases: |
2662 phase: sorted(headsbyphase[phase]) for phase in phases.allphases |
2663 phasemapping.append(sorted(headsbyphase[phase])) |
2663 } |
2664 |
2664 |
2665 # generate the actual part |
2665 # generate the actual part |
2666 phasedata = phases.binaryencode(phasemapping) |
2666 phasedata = phases.binaryencode(phasemapping) |
2667 bundler.newpart(b'phase-heads', data=phasedata) |
2667 bundler.newpart(b'phase-heads', data=phasedata) |
2668 |
2668 |