Mercurial > hg
comparison mercurial/bundle2.py @ 32515:e70d6dbde713
bundle2: move function building obsmarker-part in the bundle2 module
We move it next to similar part building functions. We will need it for the
"writenewbundle" logic. This will allow us to easily include obsmarkers in
on-disk bundle, a necessary step before having `hg strip` also operate on
markers.
(Yes, the bundle2 module was already too large, but there any many
interdependencies between its components so it is non-trivial to split, this is
a quest for another adventure.)
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 28 May 2017 11:48:18 -0700 |
parents | 655f1e2cfa5a |
children | 37d70ba1d9d1 |
comparison
equal
deleted
inserted
replaced
32514:3f5d675fddf4 | 32515:e70d6dbde713 |
---|---|
1399 chunks.extend([node, fnode]) | 1399 chunks.extend([node, fnode]) |
1400 | 1400 |
1401 if chunks: | 1401 if chunks: |
1402 bundler.newpart('hgtagsfnodes', data=''.join(chunks)) | 1402 bundler.newpart('hgtagsfnodes', data=''.join(chunks)) |
1403 | 1403 |
1404 def buildobsmarkerspart(bundler, markers): | |
1405 """add an obsmarker part to the bundler with <markers> | |
1406 | |
1407 No part is created if markers is empty. | |
1408 Raises ValueError if the bundler doesn't support any known obsmarker format. | |
1409 """ | |
1410 if not markers: | |
1411 return None | |
1412 | |
1413 remoteversions = obsmarkersversion(bundler.capabilities) | |
1414 version = obsolete.commonversion(remoteversions) | |
1415 if version is None: | |
1416 raise ValueError('bundler does not support common obsmarker format') | |
1417 stream = obsolete.encodemarkers(markers, True, version=version) | |
1418 return bundler.newpart('obsmarkers', data=stream) | |
1419 | |
1404 def writebundle(ui, cg, filename, bundletype, vfs=None, compression=None, | 1420 def writebundle(ui, cg, filename, bundletype, vfs=None, compression=None, |
1405 compopts=None): | 1421 compopts=None): |
1406 """Write a bundle file and return its filename. | 1422 """Write a bundle file and return its filename. |
1407 | 1423 |
1408 Existing files will not be overwritten. | 1424 Existing files will not be overwritten. |