[PATCH] bundle2: rename format, parts and config to final names
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu Apr 9 20:35:51 UTC 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1428611148 14400
# Thu Apr 09 16:25:48 2015 -0400
# Node ID 71e0b8889f82b620c2ba42f51fe088c00877caba
# Parent 19c5b091396036e2ee63555b39a5852652b49d18
bundle2: rename format, parts and config to final names
It is finally time to freeze the bundle2 format! To do so we:
- rename HG2Y to HG20,
- drop "b2x:" prefix from all part names,
- rename capability to "bundle2-exp" to "bundle2"
- rename the hook flag from 'bundle2-exp' to 'bundle2'
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -356,11 +356,11 @@ def _processpart(op, part):
handler(op, part)
finally:
if output is not None:
output = op.ui.popbuffer()
if output:
- outpart = op.reply.newpart('b2x:output', data=output,
+ outpart = op.reply.newpart('output', data=output,
mandatory=False)
outpart.addparam('in-reply-to', str(part.id), mandatory=False)
finally:
# consume the part content to not corrupt the stream.
part.seek(0, 2)
@@ -406,11 +406,11 @@ class bundle20(object):
Use the `addparam` method to add stream level parameter. and `newpart` to
populate it. Then call `getchunks` to retrieve all the binary chunks of
data that compose the bundle2 container."""
- _magicstring = 'HG2Y'
+ _magicstring = 'HG20'
def __init__(self, ui, capabilities=()):
self.ui = ui
self._params = []
self._parts = []
@@ -614,11 +614,11 @@ class unbundle20(unpackermixin):
return None
def compressed(self):
return False
-formatmap = {'2Y': unbundle20}
+formatmap = {'20': unbundle20}
class bundlepart(object):
"""A bundle2 part contains application level payload
The part `type` is used to route the part to the application level
@@ -732,11 +732,11 @@ class bundlepart(object):
yield chunk
except Exception, exc:
# backup exception data for later
exc_info = sys.exc_info()
msg = 'unexpected error: %s' % exc
- interpart = bundlepart('b2x:error:abort', [('message', msg)],
+ interpart = bundlepart('error:abort', [('message', msg)],
mandatory=False)
interpart.id = 0
yield _pack(_fpayloadsize, -1)
for chunk in interpart.getchunks():
yield chunk
@@ -980,46 +980,46 @@ class unbundlepart(unpackermixin):
adjust = self.read(internaloffset)
if len(adjust) != internaloffset:
raise util.Abort(_('Seek failed\n'))
self._pos = newpos
-capabilities = {'HG2Y': (),
- 'b2x:listkeys': (),
- 'b2x:pushkey': (),
+capabilities = {'HG20': (),
+ 'listkeys': (),
+ 'pushkey': (),
'digests': tuple(sorted(util.DIGESTS.keys())),
- 'b2x:remote-changegroup': ('http', 'https'),
+ 'remote-changegroup': ('http', 'https'),
}
def getrepocaps(repo, allowpushback=False):
"""return the bundle2 capabilities for a given repo
Exists to allow extensions (like evolution) to mutate the capabilities.
"""
caps = capabilities.copy()
- caps['b2x:changegroup'] = tuple(sorted(changegroup.packermap.keys()))
+ caps['changegroup'] = tuple(sorted(changegroup.packermap.keys()))
if obsolete.isenabled(repo, obsolete.exchangeopt):
supportedformat = tuple('V%i' % v for v in obsolete.formats)
- caps['b2x:obsmarkers'] = supportedformat
+ caps['obsmarkers'] = supportedformat
if allowpushback:
- caps['b2x:pushback'] = ()
+ caps['pushback'] = ()
return caps
def bundle2caps(remote):
"""return the bundle capabilities of a peer as dict"""
- raw = remote.capable('bundle2-exp')
+ raw = remote.capable('bundle2')
if not raw and raw != '':
return {}
- capsblob = urllib.unquote(remote.capable('bundle2-exp'))
+ capsblob = urllib.unquote(remote.capable('bundle2'))
return decodecaps(capsblob)
def obsmarkersversion(caps):
"""extract the list of supported obsmarkers versions from a bundle2caps dict
"""
- obscaps = caps.get('b2x:obsmarkers', ())
+ obscaps = caps.get('obsmarkers', ())
return [int(c[1:]) for c in obscaps if c.startswith('V')]
- at parthandler('b2x:changegroup', ('version',))
+ at parthandler('changegroup', ('version',))
def handlechangegroup(op, inpart):
"""apply a changegroup part on the repo
This is a very early implementation that will massive rework before being
inflicted to any end-user.
@@ -1039,18 +1039,18 @@ def handlechangegroup(op, inpart):
ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
op.records.add('changegroup', {'return': ret})
if op.reply is not None:
# This is definitely not the final form of this
# return. But one need to start somewhere.
- part = op.reply.newpart('b2x:reply:changegroup', mandatory=False)
+ part = op.reply.newpart('reply:changegroup', mandatory=False)
part.addparam('in-reply-to', str(inpart.id), mandatory=False)
part.addparam('return', '%i' % ret, mandatory=False)
assert not inpart.read()
_remotechangegroupparams = tuple(['url', 'size', 'digests'] +
['digest:%s' % k for k in util.DIGESTS.keys()])
- at parthandler('b2x:remote-changegroup', _remotechangegroupparams)
+ at parthandler('remote-changegroup', _remotechangegroupparams)
def handleremotechangegroup(op, inpart):
"""apply a bundle10 on the repo, given an url and validation information
All the information about the remote bundle to import are given as
parameters. The parameters include:
@@ -1068,11 +1068,11 @@ def handleremotechangegroup(op, inpart):
try:
raw_url = inpart.params['url']
except KeyError:
raise util.Abort(_('remote-changegroup: missing "%s" param') % 'url')
parsed_url = util.url(raw_url)
- if parsed_url.scheme not in capabilities['b2x:remote-changegroup']:
+ if parsed_url.scheme not in capabilities['remote-changegroup']:
raise util.Abort(_('remote-changegroup does not support %s urls') %
parsed_url.scheme)
try:
size = int(inpart.params['size'])
@@ -1108,27 +1108,27 @@ def handleremotechangegroup(op, inpart):
ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
op.records.add('changegroup', {'return': ret})
if op.reply is not None:
# This is definitely not the final form of this
# return. But one need to start somewhere.
- part = op.reply.newpart('b2x:reply:changegroup')
+ part = op.reply.newpart('reply:changegroup')
part.addparam('in-reply-to', str(inpart.id), mandatory=False)
part.addparam('return', '%i' % ret, mandatory=False)
try:
real_part.validate()
except util.Abort, e:
raise util.Abort(_('bundle at %s is corrupted:\n%s') %
(util.hidepassword(raw_url), str(e)))
assert not inpart.read()
- at parthandler('b2x:reply:changegroup', ('return', 'in-reply-to'))
+ at parthandler('reply:changegroup', ('return', 'in-reply-to'))
def handlereplychangegroup(op, inpart):
ret = int(inpart.params['return'])
replyto = int(inpart.params['in-reply-to'])
op.records.add('changegroup', {'return': ret}, replyto)
- at parthandler('b2x:check:heads')
+ at parthandler('check:heads')
def handlecheckheads(op, inpart):
"""check that head of the repo did not change
This is used to detect a push race when using unbundle.
This replaces the "heads" argument of unbundle."""
@@ -1140,31 +1140,31 @@ def handlecheckheads(op, inpart):
assert not h
if heads != op.repo.heads():
raise error.PushRaced('repository changed while pushing - '
'please try again')
- at parthandler('b2x:output')
+ at parthandler('output')
def handleoutput(op, inpart):
"""forward output captured on the server to the client"""
for line in inpart.read().splitlines():
op.ui.write(('remote: %s\n' % line))
- at parthandler('b2x:replycaps')
+ at parthandler('replycaps')
def handlereplycaps(op, inpart):
"""Notify that a reply bundle should be created
The payload contains the capabilities information for the reply"""
caps = decodecaps(inpart.read())
if op.reply is None:
op.reply = bundle20(op.ui, caps)
- at parthandler('b2x:error:abort', ('message', 'hint'))
+ at parthandler('error:abort', ('message', 'hint'))
def handlereplycaps(op, inpart):
"""Used to transmit abort error over the wire"""
raise util.Abort(inpart.params['message'], hint=inpart.params.get('hint'))
- at parthandler('b2x:error:unsupportedcontent', ('parttype', 'params'))
+ at parthandler('error:unsupportedcontent', ('parttype', 'params'))
def handlereplycaps(op, inpart):
"""Used to transmit unknown content error over the wire"""
kwargs = {}
parttype = inpart.params.get('parttype')
if parttype is not None:
@@ -1173,23 +1173,23 @@ def handlereplycaps(op, inpart):
if params is not None:
kwargs['params'] = params.split('\0')
raise error.UnsupportedPartError(**kwargs)
- at parthandler('b2x:error:pushraced', ('message',))
+ at parthandler('error:pushraced', ('message',))
def handlereplycaps(op, inpart):
"""Used to transmit push race error over the wire"""
raise error.ResponseError(_('push failed:'), inpart.params['message'])
- at parthandler('b2x:listkeys', ('namespace',))
+ at parthandler('listkeys', ('namespace',))
def handlelistkeys(op, inpart):
"""retrieve pushkey namespace content stored in a bundle2"""
namespace = inpart.params['namespace']
r = pushkey.decodekeys(inpart.read())
op.records.add('listkeys', (namespace, r))
- at parthandler('b2x:pushkey', ('namespace', 'key', 'old', 'new'))
+ at parthandler('pushkey', ('namespace', 'key', 'old', 'new'))
def handlepushkey(op, inpart):
"""process a pushkey request"""
dec = pushkey.decode
namespace = dec(inpart.params['namespace'])
key = dec(inpart.params['key'])
@@ -1200,36 +1200,36 @@ def handlepushkey(op, inpart):
'key': key,
'old': old,
'new': new}
op.records.add('pushkey', record)
if op.reply is not None:
- rpart = op.reply.newpart('b2x:reply:pushkey')
+ rpart = op.reply.newpart('reply:pushkey')
rpart.addparam('in-reply-to', str(inpart.id), mandatory=False)
rpart.addparam('return', '%i' % ret, mandatory=False)
- at parthandler('b2x:reply:pushkey', ('return', 'in-reply-to'))
+ at parthandler('reply:pushkey', ('return', 'in-reply-to'))
def handlepushkeyreply(op, inpart):
"""retrieve the result of a pushkey request"""
ret = int(inpart.params['return'])
partid = int(inpart.params['in-reply-to'])
op.records.add('pushkey', {'return': ret}, partid)
- at parthandler('b2x:obsmarkers')
+ at parthandler('obsmarkers')
def handleobsmarker(op, inpart):
"""add a stream of obsmarkers to the repo"""
tr = op.gettransaction()
new = op.repo.obsstore.mergemarkers(tr, inpart.read())
if new:
op.repo.ui.status(_('%i new obsolescence markers\n') % new)
op.records.add('obsmarkers', {'new': new})
if op.reply is not None:
- rpart = op.reply.newpart('b2x:reply:obsmarkers')
+ rpart = op.reply.newpart('reply:obsmarkers')
rpart.addparam('in-reply-to', str(inpart.id), mandatory=False)
rpart.addparam('new', '%i' % new, mandatory=False)
- at parthandler('b2x:reply:obsmarkers', ('new', 'in-reply-to'))
+ at parthandler('reply:obsmarkers', ('new', 'in-reply-to'))
def handlepushkeyreply(op, inpart):
"""retrieve the result of a pushkey request"""
ret = int(inpart.params['new'])
partid = int(inpart.params['in-reply-to'])
op.records.add('obsmarkers', {'new': ret}, partid)
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -238,11 +238,11 @@ class bundlerepository(localrepo.localre
bundlename,
self.vfs)
if isinstance(self.bundle, bundle2.unbundle20):
cgparts = [part for part in self.bundle.iterparts()
- if (part.type == 'b2x:changegroup')
+ if (part.type == 'changegroup')
and (part.params.get('version', '01')
in changegroup.packermap)]
if not cgparts:
raise util.Abort('No changegroups found')
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -69,11 +69,11 @@ class nocompress(object):
bundletypes = {
"": ("", nocompress), # only when using unbundle on ssh and old http servers
# since the unification ssh accepts a header but there
# is no capability signaling it.
- "HG2Y": (), # special-cased below
+ "HG20": (), # special-cased below
"HG10UN": ("HG10UN", nocompress),
"HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()),
"HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
}
@@ -100,14 +100,14 @@ def writebundle(ui, cg, filename, bundle
else:
fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
fh = os.fdopen(fd, "wb")
cleanup = filename
- if bundletype == "HG2Y":
+ if bundletype == "HG20":
import bundle2
bundle = bundle2.bundle20(ui)
- part = bundle.newpart('b2x:changegroup', data=cg.getchunks())
+ part = bundle.newpart('changegroup', data=cg.getchunks())
part.addparam('version', cg.version)
z = nocompress()
chunkiter = bundle.getchunks()
else:
if cg.version != '01':
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1219,11 +1219,11 @@ def bundle(ui, repo, fname, dest=None, *
bundletype = opts.get('type', 'bzip2').lower()
btypes = {'none': 'HG10UN',
'bzip2': 'HG10BZ',
'gzip': 'HG10GZ',
- 'bundle2': 'HG2Y'}
+ 'bundle2': 'HG20'}
bundletype = btypes.get(bundletype)
if bundletype not in changegroup.bundletypes:
raise util.Abort(_('unknown bundle type specified with --type'))
if opts.get('all'):
@@ -1916,11 +1916,11 @@ def _debugbundle2(ui, gen, **opts):
if not isinstance(gen, bundle2.unbundle20):
raise util.Abort(_('not a bundle2 file'))
ui.write(('Stream params: %s\n' % repr(gen.params)))
for part in gen.iterparts():
ui.write('%s -- %r\n' % (part.type, repr(part.params)))
- if part.type == 'b2x:changegroup':
+ if part.type == 'changegroup':
version = part.params.get('version', '01')
cg = changegroup.packermap[version][1](part, 'UN')
chunkdata = cg.changelogheader()
chain = None
while True:
@@ -2209,11 +2209,11 @@ def debuggetbundle(ui, repopath, bundlep
bundletype = opts.get('type', 'bzip2').lower()
btypes = {'none': 'HG10UN',
'bzip2': 'HG10BZ',
'gzip': 'HG10GZ',
- 'bundle2': 'HG2Y'}
+ 'bundle2': 'HG20'}
bundletype = btypes.get(bundletype)
if bundletype not in changegroup.bundletypes:
raise util.Abort(_('unknown bundle type specified with --type'))
changegroup.writebundle(ui, bundle, bundlepath, bundletype)
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -47,19 +47,19 @@ def buildobsmarkerspart(bundler, markers
remoteversions = bundle2.obsmarkersversion(bundler.capabilities)
version = obsolete.commonversion(remoteversions)
if version is None:
raise ValueError('bundler do not support common obsmarker format')
stream = obsolete.encodemarkers(markers, True, version=version)
- return bundler.newpart('b2x:obsmarkers', data=stream)
+ return bundler.newpart('obsmarkers', data=stream)
return None
def _canusebundle2(op):
"""return true if a pull/push can use bundle2
Feel free to nuke this function when we drop the experimental option"""
return (op.repo.ui.configbool('experimental', 'bundle2-exp', False)
- and op.remote.capable('bundle2-exp'))
+ and op.remote.capable('bundle2'))
class pushoperation(object):
"""A object that represent a single push operation
@@ -457,14 +457,14 @@ def _pushb2ctx(pushop, bundler):
return
pushop.repo.prepushoutgoinghooks(pushop.repo,
pushop.remote,
pushop.outgoing)
if not pushop.force:
- bundler.newpart('b2x:check:heads', data=iter(pushop.remoteheads))
+ bundler.newpart('check:heads', data=iter(pushop.remoteheads))
b2caps = bundle2.bundle2caps(pushop.remote)
version = None
- cgversions = b2caps.get('b2x:changegroup')
+ cgversions = b2caps.get('changegroup')
if not cgversions: # 3.1 and 3.2 ship with an empty value
cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
pushop.outgoing)
else:
cgversions = [v for v in cgversions if v in changegroup.packermap]
@@ -472,11 +472,11 @@ def _pushb2ctx(pushop, bundler):
raise ValueError(_('no common changegroup version'))
version = max(cgversions)
cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
pushop.outgoing,
version=version)
- cgpart = bundler.newpart('b2x:changegroup', data=cg)
+ cgpart = bundler.newpart('changegroup', data=cg)
if version is not None:
cgpart.addparam('version', version)
def handlereply(op):
"""extract addchangegroup returns from server reply"""
cgreplies = op.records.getreplies(cgpart.id)
@@ -488,17 +488,17 @@ def _pushb2ctx(pushop, bundler):
def _pushb2phases(pushop, bundler):
"""handle phase push through bundle2"""
if 'phases' in pushop.stepsdone:
return
b2caps = bundle2.bundle2caps(pushop.remote)
- if not 'b2x:pushkey' in b2caps:
+ if not 'pushkey' in b2caps:
return
pushop.stepsdone.add('phases')
part2node = []
enc = pushkey.encode
for newremotehead in pushop.outdatedphases:
- part = bundler.newpart('b2x:pushkey')
+ part = bundler.newpart('pushkey')
part.addparam('namespace', enc('phases'))
part.addparam('key', enc(newremotehead.hex()))
part.addparam('old', enc(str(phases.draft)))
part.addparam('new', enc(str(phases.public)))
part2node.append((part.id, newremotehead))
@@ -531,17 +531,17 @@ def _pushb2obsmarkers(pushop, bundler):
def _pushb2bookmarks(pushop, bundler):
"""handle phase push through bundle2"""
if 'bookmarks' in pushop.stepsdone:
return
b2caps = bundle2.bundle2caps(pushop.remote)
- if 'b2x:pushkey' not in b2caps:
+ if 'pushkey' not in b2caps:
return
pushop.stepsdone.add('bookmarks')
part2book = []
enc = pushkey.encode
for book, old, new in pushop.outbookmarks:
- part = bundler.newpart('b2x:pushkey')
+ part = bundler.newpart('pushkey')
part.addparam('namespace', enc('bookmarks'))
part.addparam('key', enc(book))
part.addparam('old', enc(old))
part.addparam('new', enc(new))
action = 'update'
@@ -581,11 +581,11 @@ def _pushbundle2(pushop):
and pushop.ui.configbool('experimental', 'bundle2.pushback'))
# create reply capability
capsblob = bundle2.encodecaps(bundle2.getrepocaps(pushop.repo,
allowpushback=pushback))
- bundler.newpart('b2x:replycaps', data=capsblob)
+ bundler.newpart('replycaps', data=capsblob)
replyhandlers = []
for partgenname in b2partsgenorder:
partgen = b2partsgenmapping[partgenname]
ret = partgen(pushop, bundler)
if callable(ret):
@@ -973,11 +973,11 @@ def _pullbundle2(pullop):
pullop.stepsdone.add('changegroup')
kwargs['common'] = pullop.common
kwargs['heads'] = pullop.heads or pullop.rheads
kwargs['cg'] = pullop.fetch
- if 'b2x:listkeys' in remotecaps:
+ if 'listkeys' in remotecaps:
kwargs['listkeys'] = ['phase', 'bookmarks']
if not pullop.fetch:
pullop.repo.ui.status(_("no changes found\n"))
pullop.cgresult = 0
else:
@@ -1126,11 +1126,11 @@ def _pullobsolete(pullop):
pullop.repo.invalidatevolatilesets()
return tr
def caps20to10(repo):
"""return a set with appropriate options to use bundle20 during getbundle"""
- caps = set(['HG2Y'])
+ caps = set(['HG20'])
capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
caps.add('bundle2=' + urllib.quote(capsblob))
return caps
# List of names of steps to perform for a bundle2 for getbundle, order matters.
@@ -1159,11 +1159,11 @@ def getbundle2partsgenerator(stepname):
def getbundle(repo, source, heads=None, common=None, bundlecaps=None,
**kwargs):
"""return a full bundle (with potentially multiple kind of parts)
- Could be a bundle HG10 or a bundle HG2Y depending on bundlecaps
+ Could be a bundle HG10 or a bundle HG20 depending on bundlecaps
passed. For now, the bundle can contain only changegroup, but this will
changes when more part type will be available for bundle2.
This is different from changegroup.getchangegroup that only returns an HG10
changegroup bundle. They may eventually get reunited in the future when we
@@ -1210,11 +1210,11 @@ def _getbundlechangegrouppart(bundler, r
"""add a changegroup part to the requested bundle"""
cg = None
if kwargs.get('cg', True):
# build changegroup bundle here.
version = None
- cgversions = b2caps.get('b2x:changegroup')
+ cgversions = b2caps.get('changegroup')
if not cgversions: # 3.1 and 3.2 ship with an empty value
cg = changegroup.getchangegroupraw(repo, source, heads=heads,
common=common,
bundlecaps=bundlecaps)
else:
@@ -1226,21 +1226,21 @@ def _getbundlechangegrouppart(bundler, r
common=common,
bundlecaps=bundlecaps,
version=version)
if cg:
- part = bundler.newpart('b2x:changegroup', data=cg)
+ part = bundler.newpart('changegroup', data=cg)
if version is not None:
part.addparam('version', version)
@getbundle2partsgenerator('listkeys')
def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
b2caps=None, **kwargs):
"""add parts containing listkeys namespaces to the requested bundle"""
listkeys = kwargs.get('listkeys', ())
for namespace in listkeys:
- part = bundler.newpart('b2x:listkeys')
+ part = bundler.newpart('listkeys')
part.addparam('namespace', namespace)
keys = repo.listkeys(namespace).items()
part.data = pushkey.encodekeys(keys)
@getbundle2partsgenerator('obsmarkers')
@@ -1286,11 +1286,11 @@ def unbundle(repo, cg, heads, source, ur
if util.safehasattr(cg, 'params'):
try:
tr = repo.transaction('unbundle')
tr.hookargs['source'] = source
tr.hookargs['url'] = url
- tr.hookargs['bundle2-exp'] = '1'
+ tr.hookargs['bundle2'] = '1'
r = bundle2.processbundle(repo, cg, lambda: tr).reply
p = lambda: tr.writepending() and repo.root or ""
repo.hook('b2x-pretransactionclose', throw=True, pending=p,
**tr.hookargs)
hookargs = dict(tr.hookargs)
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -108,11 +108,11 @@ class localpeer(peer.peerrepository):
def getbundle(self, source, heads=None, common=None, bundlecaps=None,
**kwargs):
cg = exchange.getbundle(self._repo, source, heads=heads,
common=common, bundlecaps=bundlecaps, **kwargs)
- if bundlecaps is not None and 'HG2Y' in bundlecaps:
+ if bundlecaps is not None and 'HG20' in bundlecaps:
# When requesting a bundle2, getbundle returns a stream to make the
# wire level function happier. We need to build a proper object
# from it in local peer.
cg = bundle2.getunbundler(self.ui, cg)
return cg
@@ -315,11 +315,11 @@ class localrepository(object):
# bundle2 is not ready for prime time, drop it unless explicitly
# required by the tests (or some brave tester)
if self.ui.configbool('experimental', 'bundle2-exp', False):
caps = set(caps)
capsblob = bundle2.encodecaps(bundle2.getrepocaps(self))
- caps.add('bundle2-exp=' + urllib.quote(capsblob))
+ caps.add('bundle2=' + urllib.quote(capsblob))
return caps
def _applyrequirements(self, requirements):
self.requirements = requirements
self.svfs.options = dict((r, 1) for r in requirements
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -40,11 +40,11 @@ def _bundle(repo, bases, heads, node, su
allhashes = sorted(c.hex() for c in allcommits)
totalhash = util.sha1(''.join(allhashes)).hexdigest()
name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
if usebundle2:
- bundletype = "HG2Y"
+ bundletype = "HG20"
elif compress:
bundletype = "HG10BZ"
else:
bundletype = "HG10UN"
return changegroup.writebundle(repo.ui, cg, name, bundletype, vfs)
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -615,11 +615,11 @@ def _capabilities(repo, proto):
# otherwise, add 'streamreqs' detailing our local revlog format
else:
caps.append('streamreqs=%s' % ','.join(requiredformats))
if repo.ui.configbool('experimental', 'bundle2-exp', False):
capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
- caps.append('bundle2-exp=' + urllib.quote(capsblob))
+ caps.append('bundle2=' + urllib.quote(capsblob))
caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
caps.append('httpheader=1024')
return caps
# If you are writing an extension and consider wrapping this function. Wrap
@@ -841,11 +841,11 @@ def unbundle(repo, proto, heads):
finally:
fp.close()
os.unlink(tempname)
except error.BundleValueError, exc:
bundler = bundle2.bundle20(repo.ui)
- errpart = bundler.newpart('b2x:error:unsupportedcontent')
+ errpart = bundler.newpart('error:unsupportedcontent')
if exc.parttype is not None:
errpart.addparam('parttype', exc.parttype)
if exc.params:
errpart.addparam('params', '\0'.join(exc.params))
return streamres(bundler.getchunks())
@@ -858,18 +858,18 @@ def unbundle(repo, proto, heads):
bundler = bundle2.bundle20(repo.ui)
manargs = [('message', str(inst))]
advargs = []
if inst.hint is not None:
advargs.append(('hint', inst.hint))
- bundler.addpart(bundle2.bundlepart('b2x:error:abort',
+ bundler.addpart(bundle2.bundlepart('error:abort',
manargs, advargs))
return streamres(bundler.getchunks())
else:
sys.stderr.write("abort: %s\n" % inst)
return pushres(0)
except error.PushRaced, exc:
if getattr(exc, 'duringunbundle2', False):
bundler = bundle2.bundle20(repo.ui)
- bundler.newpart('b2x:error:pushraced', [('message', str(exc))])
+ bundler.newpart('error:pushraced', [('message', str(exc))])
return streamres(bundler.getchunks())
else:
return pusherr(str(exc))
diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t
--- a/tests/test-bundle2-exchange.t
+++ b/tests/test-bundle2-exchange.t
@@ -218,11 +218,11 @@ push
wlock: free
pushkey: lock state after "bookmarks"
lock: free
wlock: free
postclose-tip:eea13746799a public book_eea1
- txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNNAME=unbundle HG_URL=push
+ txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNNAME=unbundle HG_URL=push
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 0 changes to 0 files (-1 heads)
remote: 1 new obsolescence markers
@@ -308,11 +308,11 @@ push over ssh
remote: pre-close-tip:5fddd98957c8 draft book_5fdd
remote: pushkey: lock state after "bookmarks"
remote: lock: free
remote: wlock: free
remote: postclose-tip:5fddd98957c8 draft book_5fdd
- remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNNAME=unbundle HG_URL=remote:ssh:127.0.0.1
+ remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNNAME=unbundle HG_URL=remote:ssh:127.0.0.1
pre-close-tip:02de42196ebe draft book_02de
postclose-tip:02de42196ebe draft book_02de
txnclose hook: HG_SOURCE=push-response HG_TXNNAME=push-response
ssh://user@dummy/other HG_URL=ssh://user@dummy/other
$ hg -R other log -G
@@ -424,11 +424,11 @@ Setting up
> bundler.newpart('test:abort')
> if reason == 'unknown':
> bundler.newpart('test:unknown')
> if reason == 'race':
> # 20 Bytes of crap
- > bundler.newpart('b2x:check:heads', data='01234567890123456789')
+ > bundler.newpart('check:heads', data='01234567890123456789')
>
> @bundle2.parthandler("test:abort")
> def handleabort(op, part):
> raise util.Abort('Abandon ship!', hint="don't panic")
>
diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t
--- a/tests/test-bundle2-format.t
+++ b/tests/test-bundle2-format.t
@@ -90,15 +90,15 @@ Create an extension to test bundle2 API
> except ValueError, exc:
> raise util.Abort('%s' % exc)
>
> if opts['reply']:
> capsstring = 'ping-pong\nelephants=babar,celeste\ncity%3D%21=celeste%2Cville'
- > bundler.newpart('b2x:replycaps', data=capsstring)
+ > bundler.newpart('replycaps', data=capsstring)
>
> if opts['pushrace']:
> # also serve to test the assignement of data outside of init
- > part = bundler.newpart('b2x:check:heads')
+ > part = bundler.newpart('check:heads')
> part.data = '01234567890123456789'
>
> revs = opts['rev']
> if 'rev' in opts:
> revs = scmutil.revrange(repo, opts['rev'])
@@ -107,11 +107,11 @@ Create an extension to test bundle2 API
> bundled = repo.revs('%ld::%ld', revs, revs)
> headmissing = [c.node() for c in repo.set('heads(%ld)', revs)]
> headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
> outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing)
> cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None)
- > bundler.newpart('b2x:changegroup', data=cg.getchunks(),
+ > bundler.newpart('changegroup', data=cg.getchunks(),
> mandatory=False)
>
> if opts['parts']:
> bundler.newpart('test:empty', mandatory=False)
> # add a second one to make sure we handle multiple parts
@@ -134,11 +134,11 @@ Create an extension to test bundle2 API
> bundler.newpart('test:ping', mandatory=False)
> if opts['genraise']:
> def genraise():
> yield 'first line\n'
> raise RuntimeError('Someone set up us the bomb!')
- > bundler.newpart('b2x:output', data=genraise(), mandatory=False)
+ > bundler.newpart('output', data=genraise(), mandatory=False)
>
> if path is None:
> file = sys.stdout
> else:
> file = open(path, 'wb')
@@ -235,11 +235,11 @@ Empty bundle
- no parts
Test bundling
$ hg bundle2
- HG2Y\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
+ HG20\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
Test unbundling
$ hg bundle2 | hg statbundle2
options count: 0
@@ -265,11 +265,11 @@ advisory parameters, no value
Simplest possible parameters form
Test generation simple option
$ hg bundle2 --param 'caution'
- HG2Y\x00\x00\x00\x07caution\x00\x00\x00\x00 (no-eol) (esc)
+ HG20\x00\x00\x00\x07caution\x00\x00\x00\x00 (no-eol) (esc)
Test unbundling
$ hg bundle2 --param 'caution' | hg statbundle2
options count: 1
@@ -277,11 +277,11 @@ Test unbundling
parts count: 0
Test generation multiple option
$ hg bundle2 --param 'caution' --param 'meal'
- HG2Y\x00\x00\x00\x0ccaution meal\x00\x00\x00\x00 (no-eol) (esc)
+ HG20\x00\x00\x00\x0ccaution meal\x00\x00\x00\x00 (no-eol) (esc)
Test unbundling
$ hg bundle2 --param 'caution' --param 'meal' | hg statbundle2
options count: 2
@@ -293,11 +293,11 @@ advisory parameters, with value
-------------------------------
Test generation
$ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants'
- HG2Y\x00\x00\x00\x1ccaution meal=vegan elephants\x00\x00\x00\x00 (no-eol) (esc)
+ HG20\x00\x00\x00\x1ccaution meal=vegan elephants\x00\x00\x00\x00 (no-eol) (esc)
Test unbundling
$ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants' | hg statbundle2
options count: 3
@@ -311,11 +311,11 @@ parameter with special char in value
---------------------------------------------------
Test generation
$ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple
- HG2Y\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc)
+ HG20\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc)
Test unbundling
$ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple | hg statbundle2
options count: 2
@@ -335,24 +335,24 @@ Test debug output
---------------------------------------------------
bundling debug
$ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2
- start emission of HG2Y stream
+ start emission of HG20 stream
bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple
start of parts
end of bundle
file content is ok
$ cat ../out.hg2
- HG2Y\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc)
+ HG20\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc)
unbundling debug
$ hg statbundle2 --debug < ../out.hg2
- start processing of HG2Y stream
+ start processing of HG20 stream
reading bundle2 stream parameters
ignoring unknown parameter 'e|! 7/'
ignoring unknown parameter 'simple'
options count: 2
- e|! 7/
@@ -382,11 +382,11 @@ bad parameter name
Test part
=================
$ hg bundle2 --parts ../parts.hg2 --debug
- start emission of HG2Y stream
+ start emission of HG20 stream
bundle parameter:
start of parts
bundle part: "test:empty"
bundle part: "test:empty"
bundle part: "test:song"
@@ -395,11 +395,11 @@ Test part
bundle part: "test:song"
bundle part: "test:ping"
end of bundle
$ cat ../parts.hg2
- HG2Y\x00\x00\x00\x00\x00\x00\x00\x11 (esc)
+ HG20\x00\x00\x00\x00\x00\x00\x00\x11 (esc)
test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc)
test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc)
Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00\x00\x00\x16\x0ftest:debugreply\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x04\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x00\x00\x1d test:song\x00\x00\x00\x05\x01\x00\x0b\x00randomparam\x00\x00\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
@@ -435,11 +435,11 @@ Test part
advisory: 0
payload: 0 bytes
parts count: 7
$ hg statbundle2 --debug < ../parts.hg2
- start processing of HG2Y stream
+ start processing of HG20 stream
reading bundle2 stream parameters
options count: 0
start extraction of bundle2 parts
part header size: 17
part type: "test:empty"
@@ -514,11 +514,11 @@ Test actual unbundling of test part
=======================================
Process the bundle
$ hg unbundle2 --debug < ../parts.hg2
- start processing of HG2Y stream
+ start processing of HG20 stream
reading bundle2 stream parameters
start extraction of bundle2 parts
part header size: 17
part type: "test:empty"
part id: "0"
@@ -608,45 +608,42 @@ unbundle with a reply
3 total verses sung
The reply is a bundle
$ cat ../reply.hg2
- HG2Y\x00\x00\x00\x00\x00\x00\x00\x1f (esc)
- b2x:output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc)
+ HG20\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc)
Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
- \x00\x00\x00\x00\x00\x00\x00\x1f (esc)
- b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc)
+ \x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc)
debugreply: 'city=!'
debugreply: 'celeste,ville'
debugreply: 'elephants'
debugreply: 'babar'
debugreply: 'celeste'
debugreply: 'ping-pong'
- \x00\x00\x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to7\x00\x00\x00\x00\x00\x00\x00\x1f (esc)
- b2x:output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to7\x00\x00\x00=received ping request (id 7) (esc)
+ \x00\x00\x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to7\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to7\x00\x00\x00=received ping request (id 7) (esc)
replying to ping request (id 7)
\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
The reply is valid
$ hg statbundle2 < ../reply.hg2
options count: 0
- :b2x:output:
+ :output:
mandatory: 0
advisory: 1
payload: 217 bytes
- :b2x:output:
+ :output:
mandatory: 0
advisory: 1
payload: 201 bytes
:test:pong:
mandatory: 1
advisory: 0
payload: 0 bytes
- :b2x:output:
+ :output:
mandatory: 0
advisory: 1
payload: 61 bytes
parts count: 4
@@ -712,14 +709,14 @@ Support for changegroup
list of changesets:
32af7686d403cf45b5d95f2d70cebea587ac806a
9520eea781bcca16c1e15acc0ba14335a0e8e5ba
eea13746799a9e0bfd88f29d3c2e9dc9389f524f
02de42196ebee42ef284b6780a87cdc96e8eaab6
- start emission of HG2Y stream
+ start emission of HG20 stream
bundle parameter:
start of parts
- bundle part: "b2x:changegroup"
+ bundle part: "changegroup"
bundling: 1/4 changesets (25.00%)
bundling: 2/4 changesets (50.00%)
bundling: 3/4 changesets (75.00%)
bundling: 4/4 changesets (100.00%)
bundling: 1/4 manifests (25.00%)
@@ -730,11 +727,11 @@ Support for changegroup
bundling: E 2/3 files (66.67%)
bundling: H 3/3 files (100.00%)
end of bundle
$ cat ../rev.hg2
- HG2Y\x00\x00\x00\x00\x00\x00\x00\x16\x0fb2x:changegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x13\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc)
+ HG20\x00\x00\x00\x00\x00\x00\x00\x12\x0bchangegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x13\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc)
\x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc)
\x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01D\x00\x00\x00\xa4\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xcd\x01\x0b\x8c\xd9\x98\xf3\x98\x1aZ\x81\x15\xf9O\x8d\xa4\xabP`\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)4dece9c826f69490507b98c6383a3009b295837d (esc)
\x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc)
\x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01E\x00\x00\x00\xa2\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO$\xb68|\x8c\x8c\xae7\x17\x88\x80\xf3\xfa\x95\xde\xd3\xcb\x1c\xf7\x85\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xee\xa17Fy\x9a\x9e\x0b\xfd\x88\xf2\x9d<.\x9d\xc98\x9fRO\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)365b93d57fdf4814e2b5911d6bacff2b12014441 (esc)
\x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x00\x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01G\x00\x00\x00\xa4\x02\xdeB\x19n\xbe\xe4.\xf2\x84\xb6x (esc)
@@ -755,11 +752,11 @@ Support for changegroup
\x87\xcd\xc9n\x8e\xaa\xb6\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02H (esc)
\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
$ hg debugbundle ../rev.hg2
Stream params: {}
- b2x:changegroup -- '{}'
+ changegroup -- '{}'
32af7686d403cf45b5d95f2d70cebea587ac806a
9520eea781bcca16c1e15acc0ba14335a0e8e5ba
eea13746799a9e0bfd88f29d3c2e9dc9389f524f
02de42196ebee42ef284b6780a87cdc96e8eaab6
$ hg unbundle ../rev.hg2
@@ -774,12 +771,11 @@ with reply
$ hg unbundle2 ../rev-reply.hg2 < ../rev-rr.hg2
0 unread bytes
addchangegroup return: 1
$ cat ../rev-reply.hg2
- HG2Y\x00\x00\x00\x00\x00\x00\x003\x15b2x:reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x00\x00\x1f (esc)
- b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc)
+ HG20\x00\x00\x00\x00\x00\x00\x00/\x11reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc)
adding manifests
adding file changes
added 0 changesets with 0 changes to 3 files
\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
@@ -791,12 +787,12 @@ Check handling of exception during gener
[255]
Should still be a valid bundle
$ cat ../genfailed.hg2
- HG2Y\x00\x00\x00\x00\x00\x00\x00\x11 (esc)
- b2x:output\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00L\x0fb2x:error:abort\x00\x00\x00\x00\x01\x00\x07-messageunexpected error: Someone set up us the bomb!\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
+ HG20\x00\x00\x00\x00\x00\x00\x00\r (no-eol) (esc)
+ \x06output\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00H\x0berror:abort\x00\x00\x00\x00\x01\x00\x07-messageunexpected error: Someone set up us the bomb!\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
And its handling on the other size raise a clean exception
$ cat ../genfailed.hg2 | hg unbundle2
0 unread bytes
diff --git a/tests/test-bundle2-multiple-changegroups.t b/tests/test-bundle2-multiple-changegroups.t
--- a/tests/test-bundle2-multiple-changegroups.t
+++ b/tests/test-bundle2-multiple-changegroups.t
@@ -12,17 +12,17 @@ Create an extension to test bundle2 with
> # changegroup part we are being requested. Use the parent of each head
> # in 'heads' as intermediate heads for the first changegroup.
> intermediates = [repo[r].p1().node() for r in heads]
> cg = changegroup.getchangegroup(repo, source, heads=intermediates,
> common=common, bundlecaps=bundlecaps)
- > bundler.newpart('b2x:output', data='changegroup1')
- > bundler.newpart('b2x:changegroup', data=cg.getchunks())
+ > bundler.newpart('output', data='changegroup1')
+ > bundler.newpart('changegroup', data=cg.getchunks())
> cg = changegroup.getchangegroup(repo, source, heads=heads,
> common=common + intermediates,
> bundlecaps=bundlecaps)
- > bundler.newpart('b2x:output', data='changegroup2')
- > bundler.newpart('b2x:changegroup', data=cg.getchunks())
+ > bundler.newpart('output', data='changegroup2')
+ > bundler.newpart('changegroup', data=cg.getchunks())
>
> def _pull(repo, *args, **kwargs):
> pullop = _orig_pull(repo, *args, **kwargs)
> repo.ui.write('pullop.cgresult is %d\n' % pullop.cgresult)
> return pullop
diff --git a/tests/test-bundle2-pushback.t b/tests/test-bundle2-pushback.t
--- a/tests/test-bundle2-pushback.t
+++ b/tests/test-bundle2-pushback.t
@@ -4,25 +4,25 @@
> parts, so they must be created by extensions.
> """
> from mercurial import bundle2, pushkey, exchange, util
> def _newhandlechangegroup(op, inpart):
> """This function wraps the changegroup part handler for getbundle.
- > It issues an additional b2x:pushkey part to send a new
+ > It issues an additional pushkey part to send a new
> bookmark back to the client"""
> result = bundle2.handlechangegroup(op, inpart)
- > if 'b2x:pushback' in op.reply.capabilities:
+ > if 'pushback' in op.reply.capabilities:
> params = {'namespace': 'bookmarks',
> 'key': 'new-server-mark',
> 'old': '',
> 'new': 'tip'}
> encodedparams = [(k, pushkey.encode(v)) for (k,v) in params.items()]
- > op.reply.newpart('b2x:pushkey', mandatoryparams=encodedparams)
+ > op.reply.newpart('pushkey', mandatoryparams=encodedparams)
> else:
- > op.reply.newpart('b2x:output', data='pushback not enabled')
+ > op.reply.newpart('output', data='pushback not enabled')
> return result
> _newhandlechangegroup.params = bundle2.handlechangegroup.params
- > bundle2.parthandlermapping['b2x:changegroup'] = _newhandlechangegroup
+ > bundle2.parthandlermapping['changegroup'] = _newhandlechangegroup
> EOF
$ cat >> $HGRCPATH <<EOF
> [ui]
> ssh = python "$TESTDIR/dummyssh"
diff --git a/tests/test-bundle2-remote-changegroup.t b/tests/test-bundle2-remote-changegroup.t
--- a/tests/test-bundle2-remote-changegroup.t
+++ b/tests/test-bundle2-remote-changegroup.t
@@ -33,11 +33,11 @@ Create an extension to test bundle2 remo
> evaluated with eval, and is expected to be a dict.
> """
> def newpart(name, data=''):
> """wrapper around bundler.newpart adding an extra part making the
> client output information about each processed part"""
- > bundler.newpart('b2x:output', data=name)
+ > bundler.newpart('output', data=name)
> part = bundler.newpart(name, data=data)
> return part
>
> for line in open(repo.join('bundle2maker'), 'r'):
> line = line.strip()
@@ -48,26 +48,26 @@ Create an extension to test bundle2 remo
> if verb == 'remote-changegroup':
> url, file = args.split()
> bundledata = open(file, 'rb').read()
> digest = util.digester.preferred(b2caps['digests'])
> d = util.digester([digest], bundledata)
- > part = newpart('b2x:remote-changegroup')
+ > part = newpart('remote-changegroup')
> part.addparam('url', url)
> part.addparam('size', str(len(bundledata)))
> part.addparam('digests', digest)
> part.addparam('digest:%s' % digest, d[digest])
> elif verb == 'raw-remote-changegroup':
- > part = newpart('b2x:remote-changegroup')
+ > part = newpart('remote-changegroup')
> for k, v in eval(args).items():
> part.addparam(k, str(v))
> elif verb == 'changegroup':
> _common, heads = args.split()
> common.extend(repo.lookup(r) for r in repo.revs(_common))
> heads = [repo.lookup(r) for r in repo.revs(heads)]
> cg = changegroup.getchangegroup(repo, 'changegroup',
> heads=heads, common=common)
- > newpart('b2x:changegroup', cg.getchunks())
+ > newpart('changegroup', cg.getchunks())
> else:
> raise Exception('unknown verb')
>
> exchange.getbundle2partsmapping['changegroup'] = _getbundlechangegrouppart
> EOF
@@ -135,11 +135,11 @@ Test a pull with an remote-changegroup
updating to branch default
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 3 changesets with 2 changes to 2 files (+1 heads)
(run 'hg heads .' to see heads, 'hg merge' to merge)
@@ -178,16 +178,16 @@ Test a pull with an remote-changegroup a
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files (+1 heads)
- remote: b2x:changegroup
+ remote: changegroup
adding changesets
adding manifests
adding file changes
added 3 changesets with 2 changes to 2 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
@@ -226,16 +226,16 @@ Test a pull with a changegroup followed
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:changegroup
+ remote: changegroup
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files (+1 heads)
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 3 changesets with 2 changes to 2 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
@@ -277,21 +277,21 @@ Test a pull with two remote-changegroups
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files (+1 heads)
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 2 changesets with 1 changes to 1 files
- remote: b2x:changegroup
+ remote: changegroup
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
(run 'hg heads' to see heads, 'hg merge' to merge)
@@ -322,11 +322,11 @@ Hash digest tests
$ cat > repo/.hg/bundle2maker << EOF
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
> EOF
$ hg clone ssh://user@dummy/repo clone
requesting all changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 8 changesets with 7 changes to 7 files (+2 heads)
updating to branch default
@@ -336,11 +336,11 @@ Hash digest tests
$ cat > repo/.hg/bundle2maker << EOF
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394'}
> EOF
$ hg clone ssh://user@dummy/repo clone
requesting all changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 8 changesets with 7 changes to 7 files (+2 heads)
updating to branch default
@@ -352,11 +352,11 @@ Hash digest mismatch throws an error
$ cat > repo/.hg/bundle2maker << EOF
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '0' * 40}
> EOF
$ hg clone ssh://user@dummy/repo clone
requesting all changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 8 changesets with 7 changes to 7 files (+2 heads)
transaction abort!
@@ -370,11 +370,11 @@ Multiple hash digests can be given
$ cat > repo/.hg/bundle2maker << EOF
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
> EOF
$ hg clone ssh://user@dummy/repo clone
requesting all changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 8 changesets with 7 changes to 7 files (+2 heads)
updating to branch default
@@ -386,11 +386,11 @@ If either of the multiple hash digests m
$ cat > repo/.hg/bundle2maker << EOF
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': '0' * 32, 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'}
> EOF
$ hg clone ssh://user@dummy/repo clone
requesting all changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 8 changesets with 7 changes to 7 files (+2 heads)
transaction abort!
@@ -402,11 +402,11 @@ If either of the multiple hash digests m
$ cat > repo/.hg/bundle2maker << EOF
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '0' * 40}
> EOF
$ hg clone ssh://user@dummy/repo clone
requesting all changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 8 changesets with 7 changes to 7 files (+2 heads)
transaction abort!
@@ -431,16 +431,16 @@ Corruption tests
> changegroup 0:6 7
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files (+1 heads)
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 2 changesets with 1 changes to 1 files
transaction abort!
@@ -465,11 +465,11 @@ No params
> raw-remote-changegroup {}
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
abort: remote-changegroup: missing "url" param
[255]
Missing size
@@ -477,11 +477,11 @@ Missing size
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg'}
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
abort: remote-changegroup: missing "size" param
[255]
Invalid size
@@ -489,11 +489,11 @@ Invalid size
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 'foo'}
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
abort: remote-changegroup: invalid value for param "size"
[255]
Size mismatch
@@ -501,11 +501,11 @@ Size mismatch
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 42}
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files (+1 heads)
transaction abort!
@@ -520,23 +520,23 @@ Unknown digest
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'foo', 'digest:foo': 'bar'}
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
- abort: missing support for b2x:remote-changegroup - digest:foo
+ remote: remote-changegroup
+ abort: missing support for remote-changegroup - digest:foo
[255]
Missing digest
$ cat > repo/.hg/bundle2maker << EOF
> raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'sha1'}
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
abort: remote-changegroup: missing "digest:sha1" param
[255]
Not an HTTP url
@@ -544,11 +544,11 @@ Not an HTTP url
> raw-remote-changegroup {'url': 'ssh://localhost:$HGPORT/bundle4.hg', 'size': 581}
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
abort: remote-changegroup does not support ssh urls
[255]
Not a bundle
@@ -559,26 +559,26 @@ Not a bundle
> remote-changegroup http://localhost:$HGPORT/notbundle.hg notbundle.hg
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
abort: http://localhost:$HGPORT/notbundle.hg: not a Mercurial bundle
[255]
Not a bundle 1.0
$ cat > notbundle10.hg << EOF
- > HG2Y
+ > HG20
> EOF
$ cat > repo/.hg/bundle2maker << EOF
> remote-changegroup http://localhost:$HGPORT/notbundle10.hg notbundle10.hg
> EOF
$ hg pull -R clone ssh://user@dummy/repo
pulling from ssh://user@dummy/repo
searching for changes
- remote: b2x:remote-changegroup
+ remote: remote-changegroup
abort: http://localhost:$HGPORT/notbundle10.hg: not a bundle version 1.0
[255]
$ hg -R clone log -G
@ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits at gmail.com> C
diff --git a/tests/test-getbundle.t b/tests/test-getbundle.t
--- a/tests/test-getbundle.t
+++ b/tests/test-getbundle.t
@@ -168,11 +168,11 @@ Get branch and merge:
= Test bundle2 =
$ hg debuggetbundle repo bundle -t bundle2
$ hg debugbundle bundle
Stream params: {}
- b2x:changegroup -- "{'version': '01'}"
+ changegroup -- "{'version': '01'}"
7704483d56b2a7b5db54dcee7c62378ac629b348
29a4d1f17bd3f0779ca0525bebb1cfb51067c738
713346a995c363120712aed1aee7e04afd867638
d5f6e1ea452285324836a49d7d3c2a63cfed1d31
ff42371d57168345fdf1a3aac66a51f6a45d41d2
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -216,11 +216,11 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: b
$ hg debugbundle .hg/strip-backup/*
Stream params: {}
- b2x:changegroup -- "{'version': '02'}"
+ changegroup -- "{'version': '02'}"
264128213d290d868c54642d13aeaa3675551a78
$ hg incoming .hg/strip-backup/*
comparing with .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
searching for changes
changeset: 4:264128213d29
@@ -242,11 +242,11 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: b
$ hg debugbundle .hg/strip-backup/*
Stream params: {}
- b2x:changegroup -- "{'version': '02'}"
+ changegroup -- "{'version': '02'}"
264128213d290d868c54642d13aeaa3675551a78
$ hg pull .hg/strip-backup/*
pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg
searching for changes
adding changesets
More information about the Mercurial-devel
mailing list