Show More
@@ -179,8 +179,6 b' urlreq = util.urlreq' | |||||
179 | _fpayloadsize = '>i' |
|
179 | _fpayloadsize = '>i' | |
180 | _fpartparamcount = '>BB' |
|
180 | _fpartparamcount = '>BB' | |
181 |
|
181 | |||
182 | _fphasesentry = struct.Struct('>i20s') |
|
|||
183 |
|
||||
184 | preferedchunksize = 4096 |
|
182 | preferedchunksize = 4096 | |
185 |
|
183 | |||
186 | _parttypeforbidden = re.compile('[^a-zA-Z0-9_:-]') |
|
184 | _parttypeforbidden = re.compile('[^a-zA-Z0-9_:-]') | |
@@ -1480,11 +1478,8 b' def _addpartsfromopts(ui, repo, bundler,' | |||||
1480 |
|
1478 | |||
1481 | if opts.get('phases', False): |
|
1479 | if opts.get('phases', False): | |
1482 | headsbyphase = phases.subsetphaseheads(repo, outgoing.missing) |
|
1480 | headsbyphase = phases.subsetphaseheads(repo, outgoing.missing) | |
1483 | phasedata = [] |
|
1481 | phasedata = phases.binaryencode(headsbyphase) | |
1484 | for phase in phases.allphases: |
|
1482 | bundler.newpart('phase-heads', data=phasedata) | |
1485 | for head in headsbyphase[phase]: |
|
|||
1486 | phasedata.append(_fphasesentry.pack(phase, head)) |
|
|||
1487 | bundler.newpart('phase-heads', data=''.join(phasedata)) |
|
|||
1488 |
|
1483 | |||
1489 | def addparttagsfnodescache(repo, bundler, outgoing): |
|
1484 | def addparttagsfnodescache(repo, bundler, outgoing): | |
1490 | # we include the tags fnode cache for the bundle changeset |
|
1485 | # we include the tags fnode cache for the bundle changeset | |
@@ -1843,14 +1838,14 b' def handlepushkey(op, inpart):' | |||||
1843 |
|
1838 | |||
1844 | def _readphaseheads(inpart): |
|
1839 | def _readphaseheads(inpart): | |
1845 | headsbyphase = [[] for i in phases.allphases] |
|
1840 | headsbyphase = [[] for i in phases.allphases] | |
1846 | entrysize = _fphasesentry.size |
|
1841 | entrysize = phases._fphasesentry.size | |
1847 | while True: |
|
1842 | while True: | |
1848 | entry = inpart.read(entrysize) |
|
1843 | entry = inpart.read(entrysize) | |
1849 | if len(entry) < entrysize: |
|
1844 | if len(entry) < entrysize: | |
1850 | if entry: |
|
1845 | if entry: | |
1851 | raise error.Abort(_('bad phase-heads bundle part')) |
|
1846 | raise error.Abort(_('bad phase-heads bundle part')) | |
1852 | break |
|
1847 | break | |
1853 | phase, node = _fphasesentry.unpack(entry) |
|
1848 | phase, node = phases._fphasesentry.unpack(entry) | |
1854 | headsbyphase[phase].append(node) |
|
1849 | headsbyphase[phase].append(node) | |
1855 | return headsbyphase |
|
1850 | return headsbyphase | |
1856 |
|
1851 |
@@ -103,6 +103,7 b' Note: old client behave as a publishing ' | |||||
103 | from __future__ import absolute_import |
|
103 | from __future__ import absolute_import | |
104 |
|
104 | |||
105 | import errno |
|
105 | import errno | |
|
106 | import struct | |||
106 |
|
107 | |||
107 | from .i18n import _ |
|
108 | from .i18n import _ | |
108 | from .node import ( |
|
109 | from .node import ( | |
@@ -119,6 +120,8 b' from . import (' | |||||
119 | util, |
|
120 | util, | |
120 | ) |
|
121 | ) | |
121 |
|
122 | |||
|
123 | _fphasesentry = struct.Struct('>i20s') | |||
|
124 | ||||
122 | allphases = public, draft, secret = range(3) |
|
125 | allphases = public, draft, secret = range(3) | |
123 | trackedphases = allphases[1:] |
|
126 | trackedphases = allphases[1:] | |
124 | phasenames = ['public', 'draft', 'secret'] |
|
127 | phasenames = ['public', 'draft', 'secret'] | |
@@ -154,6 +157,18 b' def _readroots(repo, phasedefaults=None)' | |||||
154 | dirty = True |
|
157 | dirty = True | |
155 | return roots, dirty |
|
158 | return roots, dirty | |
156 |
|
159 | |||
|
160 | def binaryencode(phasemapping): | |||
|
161 | """encode a 'phase -> nodes' mapping into a binary stream | |||
|
162 | ||||
|
163 | Since phases are integer the mapping is actually a python list: | |||
|
164 | [[PUBLIC_HEADS], [DRAFTS_HEADS], [SECRET_HEADS]] | |||
|
165 | """ | |||
|
166 | binarydata = [] | |||
|
167 | for phase, nodes in enumerate(phasemapping): | |||
|
168 | for head in nodes: | |||
|
169 | binarydata.append(_fphasesentry.pack(phase, head)) | |||
|
170 | return ''.join(binarydata) | |||
|
171 | ||||
157 | def _trackphasechange(data, rev, old, new): |
|
172 | def _trackphasechange(data, rev, old, new): | |
158 | """add a phase move the <data> dictionnary |
|
173 | """add a phase move the <data> dictionnary | |
159 |
|
174 |
General Comments 0
You need to be logged in to leave comments.
Login now