Show More
@@ -1785,10 +1785,12 class localrepository(object): | |||||
1785 |
|
1785 | |||
1786 | self.ui.debug('fetching remote obsolete markers') |
|
1786 | self.ui.debug('fetching remote obsolete markers') | |
1787 | remoteobs = remote.listkeys('obsolete') |
|
1787 | remoteobs = remote.listkeys('obsolete') | |
1788 | if 'dump' in remoteobs: |
|
1788 | if 'dump0' in remoteobs: | |
1789 | if tr is None: |
|
1789 | if tr is None: | |
1790 | tr = self.transaction(trname) |
|
1790 | tr = self.transaction(trname) | |
1791 | data = base85.b85decode(remoteobs['dump']) |
|
1791 | for key in sorted(remoteobs, reverse=True): | |
|
1792 | if key.startswith('dump'): | |||
|
1793 | data = base85.b85decode(remoteobs[key]) | |||
1792 | self.obsstore.mergemarkers(tr, data) |
|
1794 | self.obsstore.mergemarkers(tr, data) | |
1793 | if tr is not None: |
|
1795 | if tr is not None: | |
1794 | tr.close() |
|
1796 | tr.close() | |
@@ -1955,10 +1957,15 class localrepository(object): | |||||
1955 | self.ui.debug('try to push obsolete markers to remote\n') |
|
1957 | self.ui.debug('try to push obsolete markers to remote\n') | |
1956 | if (self.obsstore and |
|
1958 | if (self.obsstore and | |
1957 | 'obsolete' in remote.listkeys('namespaces')): |
|
1959 | 'obsolete' in remote.listkeys('namespaces')): | |
1958 | data = self.listkeys('obsolete')['dump'] |
|
1960 | rslts = [] | |
1959 |
r = |
|
1961 | remotedata = self.listkeys('obsolete') | |
1960 | if not r: |
|
1962 | for key in sorted(remotedata, reverse=True): | |
1961 | self.ui.warn(_('failed to push obsolete markers!\n')) |
|
1963 | # reverse sort to ensure we end with dump0 | |
|
1964 | data = remotedata[key] | |||
|
1965 | rslts.append(remote.pushkey('obsolete', key, '', data)) | |||
|
1966 | if [r for r in rslts if not r]: | |||
|
1967 | msg = _('failed to push some obsolete markers!\n') | |||
|
1968 | self.ui.warn(msg) | |||
1962 | finally: |
|
1969 | finally: | |
1963 | if lock is not None: |
|
1970 | if lock is not None: | |
1964 | lock.release() |
|
1971 | lock.release() |
@@ -234,24 +234,45 def _encodemarkers(markers, addheader=Fa | |||||
234 | if addheader: |
|
234 | if addheader: | |
235 | yield _pack('>B', _fmversion) |
|
235 | yield _pack('>B', _fmversion) | |
236 | for marker in markers: |
|
236 | for marker in markers: | |
|
237 | yield _encodeonemarker(marker) | |||
|
238 | ||||
|
239 | ||||
|
240 | def _encodeonemarker(marker): | |||
237 |
|
|
241 | pre, sucs, flags, metadata = marker | |
238 |
|
|
242 | nbsuc = len(sucs) | |
239 |
|
|
243 | format = _fmfixed + (_fmnode * nbsuc) | |
240 |
|
|
244 | data = [nbsuc, len(metadata), flags, pre] | |
241 |
|
|
245 | data.extend(sucs) | |
242 |
|
|
246 | return _pack(format, *data) + metadata | |
243 | yield metadata |
|
247 | ||
|
248 | # arbitrary picked to fit into 8K limit from HTTP server | |||
|
249 | # you have to take in account: | |||
|
250 | # - the version header | |||
|
251 | # - the base85 encoding | |||
|
252 | _maxpayload = 5300 | |||
244 |
|
253 | |||
245 | def listmarkers(repo): |
|
254 | def listmarkers(repo): | |
246 | """List markers over pushkey""" |
|
255 | """List markers over pushkey""" | |
247 | if not repo.obsstore: |
|
256 | if not repo.obsstore: | |
248 | return {} |
|
257 | return {} | |
249 | markers = _encodemarkers(repo.obsstore, True) |
|
258 | keys = {} | |
250 | return {'dump': base85.b85encode(''.join(markers))} |
|
259 | parts = [] | |
|
260 | currentlen = _maxpayload * 2 # ensure we create a new part | |||
|
261 | for marker in repo.obsstore: | |||
|
262 | nextdata = _encodeonemarker(marker) | |||
|
263 | if (len(nextdata) + currentlen > _maxpayload): | |||
|
264 | currentpart = [] | |||
|
265 | currentlen = 0 | |||
|
266 | parts.append(currentpart) | |||
|
267 | currentpart.append(nextdata) | |||
|
268 | for idx, part in enumerate(reversed(parts)): | |||
|
269 | data = ''.join([_pack('>B', _fmversion)] + part) | |||
|
270 | keys['dump%i' % idx] = base85.b85encode(data) | |||
|
271 | return keys | |||
251 |
|
272 | |||
252 | def pushmarker(repo, key, old, new): |
|
273 | def pushmarker(repo, key, old, new): | |
253 | """Push markers over pushkey""" |
|
274 | """Push markers over pushkey""" | |
254 |
if key |
|
275 | if not key.startswith('dump'): | |
255 | repo.ui.warn(_('unknown key: %r') % key) |
|
276 | repo.ui.warn(_('unknown key: %r') % key) | |
256 | return 0 |
|
277 | return 0 | |
257 | if old: |
|
278 | if old: |
General Comments 0
You need to be logged in to leave comments.
Login now