Mercurial > public > mercurial-scm > hg
comparison mercurial/wireproto.py @ 35782:9d249f3de730
wireproto: don't compress errors from getbundle()
Errors should be small. There's no real need to compress them.
Truth be told, there's no good reason to not compress them either.
But leaving them uncompressed makes it easier to test failures
by looking at the raw HTTP response. This makes it easier for us
to write tests. It may make it easier for people writing their
own clients.
Differential Revision: https://phab.mercurial-scm.org/D1922
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 20 Jan 2018 15:43:02 -0800 |
parents | 133a678673cb |
children | c97639ad6874 |
comparison
equal
deleted
inserted
replaced
35781:c6ef8e841873 | 35782:9d249f3de730 |
---|---|
860 if proto.name == 'http': | 860 if proto.name == 'http': |
861 return ooberror(bundle2required) | 861 return ooberror(bundle2required) |
862 raise error.Abort(bundle2requiredmain, | 862 raise error.Abort(bundle2requiredmain, |
863 hint=bundle2requiredhint) | 863 hint=bundle2requiredhint) |
864 | 864 |
865 preferuncompressed = False | |
866 | |
865 try: | 867 try: |
866 if repo.ui.configbool('server', 'disablefullbundle'): | 868 if repo.ui.configbool('server', 'disablefullbundle'): |
867 # Check to see if this is a full clone. | 869 # Check to see if this is a full clone. |
868 clheads = set(repo.changelog.heads()) | 870 clheads = set(repo.changelog.heads()) |
869 changegroup = opts.get('cg', True) | 871 changegroup = opts.get('cg', True) |
889 advargs = [] | 891 advargs = [] |
890 if exc.hint is not None: | 892 if exc.hint is not None: |
891 advargs.append(('hint', exc.hint)) | 893 advargs.append(('hint', exc.hint)) |
892 bundler.addpart(bundle2.bundlepart('error:abort', | 894 bundler.addpart(bundle2.bundlepart('error:abort', |
893 manargs, advargs)) | 895 manargs, advargs)) |
894 return streamres(gen=bundler.getchunks()) | 896 chunks = bundler.getchunks() |
895 return streamres(gen=chunks) | 897 preferuncompressed = True |
898 | |
899 return streamres(gen=chunks, prefer_uncompressed=preferuncompressed) | |
896 | 900 |
897 @wireprotocommand('heads') | 901 @wireprotocommand('heads') |
898 def heads(repo, proto): | 902 def heads(repo, proto): |
899 h = repo.heads() | 903 h = repo.heads() |
900 return encodelist(h) + "\n" | 904 return encodelist(h) + "\n" |