comparison tests/test-bundle2-exchange.t @ 26587:56b2bcea2529

error: get Abort from 'error' instead of 'util' The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be confused about that and gives all the credit to 'util' instead of the hardworking 'error'. In a spirit of equity, we break the cycle of injustice and give back to 'error' the respect it deserves. And screw that 'util' poser. For great justice.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 08 Oct 2015 12:55:45 -0700
parents 58880acd2369
children 58f1645f72c3
comparison
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
451 > """A small extension that makes push fails when using bundle2 451 > """A small extension that makes push fails when using bundle2
452 > 452 >
453 > used to test error handling in bundle2 453 > used to test error handling in bundle2
454 > """ 454 > """
455 > 455 >
456 > from mercurial import util 456 > from mercurial import error
457 > from mercurial import bundle2 457 > from mercurial import bundle2
458 > from mercurial import exchange 458 > from mercurial import exchange
459 > from mercurial import extensions 459 > from mercurial import extensions
460 > 460 >
461 > def _pushbundle2failpart(pushop, bundler): 461 > def _pushbundle2failpart(pushop, bundler):
469 > # 20 Bytes of crap 469 > # 20 Bytes of crap
470 > bundler.newpart('check:heads', data='01234567890123456789') 470 > bundler.newpart('check:heads', data='01234567890123456789')
471 > 471 >
472 > @bundle2.parthandler("test:abort") 472 > @bundle2.parthandler("test:abort")
473 > def handleabort(op, part): 473 > def handleabort(op, part):
474 > raise util.Abort('Abandon ship!', hint="don't panic") 474 > raise error.Abort('Abandon ship!', hint="don't panic")
475 > 475 >
476 > def uisetup(ui): 476 > def uisetup(ui):
477 > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart 477 > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart
478 > exchange.b2partsgenorder.insert(0, 'failpart') 478 > exchange.b2partsgenorder.insert(0, 'failpart')
479 > 479 >