Show More
@@ -27,7 +27,7 b' from mercurial import (' | |||
|
27 | 27 | narrowspec, |
|
28 | 28 | repair, |
|
29 | 29 | util, |
|
30 | wireproto, | |
|
30 | wireprototypes, | |
|
31 | 31 | ) |
|
32 | 32 | from mercurial.utils import ( |
|
33 | 33 | stringutil, |
@@ -461,13 +461,15 b' def setup():' | |||
|
461 | 461 | """Enable narrow repo support in bundle2-related extension points.""" |
|
462 | 462 | extensions.wrapfunction(bundle2, 'getrepocaps', getrepocaps_narrow) |
|
463 | 463 | |
|
464 | wireproto.gboptsmap['narrow'] = 'boolean' | |
|
465 | wireproto.gboptsmap['depth'] = 'plain' | |
|
466 | wireproto.gboptsmap['oldincludepats'] = 'csv' | |
|
467 | wireproto.gboptsmap['oldexcludepats'] = 'csv' | |
|
468 |
|
|
|
469 |
|
|
|
470 | wireproto.gboptsmap['known'] = 'csv' | |
|
464 | getbundleargs = wireprototypes.GETBUNDLE_ARGUMENTS | |
|
465 | ||
|
466 | getbundleargs['narrow'] = 'boolean' | |
|
467 | getbundleargs['depth'] = 'plain' | |
|
468 | getbundleargs['oldincludepats'] = 'csv' | |
|
469 | getbundleargs['oldexcludepats'] = 'csv' | |
|
470 | getbundleargs['includepats'] = 'csv' | |
|
471 | getbundleargs['excludepats'] = 'csv' | |
|
472 | getbundleargs['known'] = 'csv' | |
|
471 | 473 | |
|
472 | 474 | # Extend changegroup serving to handle requests from narrow clients. |
|
473 | 475 | origcgfn = exchange.getbundle2partsmapping['changegroup'] |
@@ -145,29 +145,6 b' def clientcompressionsupport(proto):' | |||
|
145 | 145 | return cap[5:].split(',') |
|
146 | 146 | return ['zlib', 'none'] |
|
147 | 147 | |
|
148 | # mapping of options accepted by getbundle and their types | |
|
149 | # | |
|
150 | # Meant to be extended by extensions. It is extensions responsibility to ensure | |
|
151 | # such options are properly processed in exchange.getbundle. | |
|
152 | # | |
|
153 | # supported types are: | |
|
154 | # | |
|
155 | # :nodes: list of binary nodes | |
|
156 | # :csv: list of comma-separated values | |
|
157 | # :scsv: list of comma-separated values return as set | |
|
158 | # :plain: string with no transformation needed. | |
|
159 | gboptsmap = {'heads': 'nodes', | |
|
160 | 'bookmarks': 'boolean', | |
|
161 | 'common': 'nodes', | |
|
162 | 'obsmarkers': 'boolean', | |
|
163 | 'phases': 'boolean', | |
|
164 | 'bundlecaps': 'scsv', | |
|
165 | 'listkeys': 'csv', | |
|
166 | 'cg': 'boolean', | |
|
167 | 'cbattempted': 'boolean', | |
|
168 | 'stream': 'boolean', | |
|
169 | } | |
|
170 | ||
|
171 | 148 | # client side |
|
172 | 149 | |
|
173 | 150 | class wirepeer(repository.legacypeer): |
@@ -275,7 +252,7 b' class wirepeer(repository.legacypeer):' | |||
|
275 | 252 | for key, value in kwargs.iteritems(): |
|
276 | 253 | if value is None: |
|
277 | 254 | continue |
|
278 |
keytype = |
|
|
255 | keytype = wireprototypes.GETBUNDLE_ARGUMENTS.get(key) | |
|
279 | 256 | if keytype is None: |
|
280 | 257 | raise error.ProgrammingError( |
|
281 | 258 | 'Unexpectedly None keytype for key %s' % key) |
@@ -1004,9 +981,10 b' def find_pullbundle(repo, proto, opts, c' | |||
|
1004 | 981 | @wireprotocommand('getbundle', '*', permission='pull', |
|
1005 | 982 | transportpolicy=POLICY_V1_ONLY) |
|
1006 | 983 | def getbundle(repo, proto, others): |
|
1007 |
opts = options('getbundle', |
|
|
984 | opts = options('getbundle', wireprototypes.GETBUNDLE_ARGUMENTS.keys(), | |
|
985 | others) | |
|
1008 | 986 | for k, v in opts.iteritems(): |
|
1009 | keytype = gboptsmap[k] | |
|
987 | keytype = wireprototypes.GETBUNDLE_ARGUMENTS[k] | |
|
1010 | 988 | if keytype == 'nodes': |
|
1011 | 989 | opts[k] = wireprototypes.decodelist(v) |
|
1012 | 990 | elif keytype == 'csv': |
@@ -134,6 +134,30 b' def unescapebatcharg(escaped):' | |||
|
134 | 134 | .replace(':o', ',') |
|
135 | 135 | .replace(':c', ':')) |
|
136 | 136 | |
|
137 | # mapping of options accepted by getbundle and their types | |
|
138 | # | |
|
139 | # Meant to be extended by extensions. It is extensions responsibility to ensure | |
|
140 | # such options are properly processed in exchange.getbundle. | |
|
141 | # | |
|
142 | # supported types are: | |
|
143 | # | |
|
144 | # :nodes: list of binary nodes | |
|
145 | # :csv: list of comma-separated values | |
|
146 | # :scsv: list of comma-separated values return as set | |
|
147 | # :plain: string with no transformation needed. | |
|
148 | GETBUNDLE_ARGUMENTS = { | |
|
149 | 'heads': 'nodes', | |
|
150 | 'bookmarks': 'boolean', | |
|
151 | 'common': 'nodes', | |
|
152 | 'obsmarkers': 'boolean', | |
|
153 | 'phases': 'boolean', | |
|
154 | 'bundlecaps': 'scsv', | |
|
155 | 'listkeys': 'csv', | |
|
156 | 'cg': 'boolean', | |
|
157 | 'cbattempted': 'boolean', | |
|
158 | 'stream': 'boolean', | |
|
159 | } | |
|
160 | ||
|
137 | 161 | class baseprotocolhandler(zi.Interface): |
|
138 | 162 | """Abstract base class for wire protocol handlers. |
|
139 | 163 |
General Comments 0
You need to be logged in to leave comments.
Login now