comparison mercurial/wireproto.py @ 24686:e0e28e910fa3

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'
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 09 Apr 2015 16:25:48 -0400
parents 2d15c59a001b
children 553dc2b094d9
comparison
equal deleted inserted replaced
24685:b3d78d82d84c 24686:e0e28e910fa3
615 # otherwise, add 'streamreqs' detailing our local revlog format 615 # otherwise, add 'streamreqs' detailing our local revlog format
616 else: 616 else:
617 caps.append('streamreqs=%s' % ','.join(requiredformats)) 617 caps.append('streamreqs=%s' % ','.join(requiredformats))
618 if repo.ui.configbool('experimental', 'bundle2-exp', False): 618 if repo.ui.configbool('experimental', 'bundle2-exp', False):
619 capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo)) 619 capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
620 caps.append('bundle2-exp=' + urllib.quote(capsblob)) 620 caps.append('bundle2=' + urllib.quote(capsblob))
621 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) 621 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
622 caps.append('httpheader=1024') 622 caps.append('httpheader=1024')
623 return caps 623 return caps
624 624
625 # If you are writing an extension and consider wrapping this function. Wrap 625 # If you are writing an extension and consider wrapping this function. Wrap
841 finally: 841 finally:
842 fp.close() 842 fp.close()
843 os.unlink(tempname) 843 os.unlink(tempname)
844 except error.BundleValueError, exc: 844 except error.BundleValueError, exc:
845 bundler = bundle2.bundle20(repo.ui) 845 bundler = bundle2.bundle20(repo.ui)
846 errpart = bundler.newpart('b2x:error:unsupportedcontent') 846 errpart = bundler.newpart('error:unsupportedcontent')
847 if exc.parttype is not None: 847 if exc.parttype is not None:
848 errpart.addparam('parttype', exc.parttype) 848 errpart.addparam('parttype', exc.parttype)
849 if exc.params: 849 if exc.params:
850 errpart.addparam('params', '\0'.join(exc.params)) 850 errpart.addparam('params', '\0'.join(exc.params))
851 return streamres(bundler.getchunks()) 851 return streamres(bundler.getchunks())
858 bundler = bundle2.bundle20(repo.ui) 858 bundler = bundle2.bundle20(repo.ui)
859 manargs = [('message', str(inst))] 859 manargs = [('message', str(inst))]
860 advargs = [] 860 advargs = []
861 if inst.hint is not None: 861 if inst.hint is not None:
862 advargs.append(('hint', inst.hint)) 862 advargs.append(('hint', inst.hint))
863 bundler.addpart(bundle2.bundlepart('b2x:error:abort', 863 bundler.addpart(bundle2.bundlepart('error:abort',
864 manargs, advargs)) 864 manargs, advargs))
865 return streamres(bundler.getchunks()) 865 return streamres(bundler.getchunks())
866 else: 866 else:
867 sys.stderr.write("abort: %s\n" % inst) 867 sys.stderr.write("abort: %s\n" % inst)
868 return pushres(0) 868 return pushres(0)
869 except error.PushRaced, exc: 869 except error.PushRaced, exc:
870 if getattr(exc, 'duringunbundle2', False): 870 if getattr(exc, 'duringunbundle2', False):
871 bundler = bundle2.bundle20(repo.ui) 871 bundler = bundle2.bundle20(repo.ui)
872 bundler.newpart('b2x:error:pushraced', [('message', str(exc))]) 872 bundler.newpart('error:pushraced', [('message', str(exc))])
873 return streamres(bundler.getchunks()) 873 return streamres(bundler.getchunks())
874 else: 874 else:
875 return pusherr(str(exc)) 875 return pusherr(str(exc))