##// END OF EJS Templates
bundle2: rename UnknownPartError to BundleValueError...
Pierre-Yves David -
r21617:0cfda08a default
parent child Browse files
Show More
@@ -172,8 +172,10 b' def _makefpartparamsizes(nbparams):'
172 172 """
173 173 return '>'+('BB'*nbparams)
174 174
175 class UnknownPartError(KeyError):
176 """error raised when no handler is found for a Mandatory part"""
175 class BundleValueError(ValueError):
176 """error raised when bundle2 cannot be processed
177
178 Current main usecase is unsupported part types."""
177 179 pass
178 180
179 181 class ReadOnlyPartError(RuntimeError):
@@ -307,7 +309,7 b' def processbundle(repo, unbundler, trans'
307 309 if key != parttype: # mandatory parts
308 310 # todo:
309 311 # - use a more precise exception
310 raise UnknownPartError(key)
312 raise BundleValueError(key)
311 313 op.ui.debug('ignoring unknown advisory part %r\n' % key)
312 314 # consuming the part
313 315 part.read()
@@ -839,7 +841,7 b' def handlereplycaps(op, inpart):'
839 841 @parthandler('b2x:error:unknownpart')
840 842 def handlereplycaps(op, inpart):
841 843 """Used to transmit unknown part error over the wire"""
842 raise UnknownPartError(inpart.params['parttype'])
844 raise BundleValueError(inpart.params['parttype'])
843 845
844 846 @parthandler('b2x:error:pushraced')
845 847 def handlereplycaps(op, inpart):
@@ -224,11 +224,11 b' def _pushbundle2(pushop):'
224 224 stream = util.chunkbuffer(bundler.getchunks())
225 225 try:
226 226 reply = pushop.remote.unbundle(stream, ['force'], 'push')
227 except bundle2.UnknownPartError, exc:
227 except bundle2.BundleValueError, exc:
228 228 raise util.Abort('missing support for %s' % exc)
229 229 try:
230 230 op = bundle2.processbundle(pushop.repo, reply)
231 except bundle2.UnknownPartError, exc:
231 except bundle2.BundleValueError, exc:
232 232 raise util.Abort('missing support for %s' % exc)
233 233 cgreplies = op.records.getreplies(cgpart.id)
234 234 assert len(cgreplies['changegroup']) == 1
@@ -554,7 +554,7 b' def _pullbundle2(pullop):'
554 554 bundle = pullop.remote.getbundle('pull', **kwargs)
555 555 try:
556 556 op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
557 except bundle2.UnknownPartError, exc:
557 except bundle2.BundleValueError, exc:
558 558 raise util.Abort('missing support for %s' % exc)
559 559
560 560 if pullop.fetch:
@@ -803,7 +803,7 b' def unbundle(repo, proto, heads):'
803 803 finally:
804 804 fp.close()
805 805 os.unlink(tempname)
806 except bundle2.UnknownPartError, exc:
806 except bundle2.BundleValueError, exc:
807 807 bundler = bundle2.bundle20(repo.ui)
808 808 bundler.newpart('B2X:ERROR:UNKNOWNPART', [('parttype', str(exc))])
809 809 return streamres(bundler.getchunks())
@@ -135,7 +135,7 b' Create an extension to test bundle2 API'
135 135 > unbundler = bundle2.unbundle20(ui, sys.stdin)
136 136 > op = bundle2.processbundle(repo, unbundler, lambda: tr)
137 137 > tr.close()
138 > except KeyError, exc:
138 > except bundle2.BundleValueError, exc:
139 139 > raise util.Abort('missing support for %s' % exc)
140 140 > except error.PushRaced, exc:
141 141 > raise util.Abort('push race: %s' % exc)
@@ -537,7 +537,7 b' Unbundle with an unknown mandatory part'
537 537 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
538 538 debugreply: no reply
539 539 0 unread bytes
540 abort: missing support for 'test:unknown'
540 abort: missing support for test:unknown
541 541 [255]
542 542
543 543 unbundle with a reply
@@ -1004,19 +1004,19 b' Doing the actual push: unknown mandatory'
1004 1004 $ hg -R main push other -r e7ec4e813ba6
1005 1005 pushing to other
1006 1006 searching for changes
1007 abort: missing support for 'test:unknown'
1007 abort: missing support for test:unknown
1008 1008 [255]
1009 1009
1010 1010 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
1011 1011 pushing to ssh://user@dummy/other
1012 1012 searching for changes
1013 abort: missing support for "'test:unknown'"
1013 abort: missing support for test:unknown
1014 1014 [255]
1015 1015
1016 1016 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
1017 1017 pushing to http://localhost:$HGPORT2/
1018 1018 searching for changes
1019 abort: missing support for "'test:unknown'"
1019 abort: missing support for test:unknown
1020 1020 [255]
1021 1021
1022 1022 Doing the actual push: race
General Comments 0
You need to be logged in to leave comments. Login now