Patchwork [8,of,9] bundle2-test: use the new way to extend push content

login
register
mail settings
Submitter Pierre-Yves David
Date July 7, 2014, 11:02 a.m.
Message ID <7c50830429c7c6f19fdc.1404730926@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5127/
State Accepted
Commit 7923648ad915ab06c0dba852ffcdfc62c2364362
Headers show

Comments

Pierre-Yves David - July 7, 2014, 11:02 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1404310214 -7200
#      Wed Jul 02 16:10:14 2014 +0200
# Node ID 7c50830429c7c6f19fdc87d91e156cccdb81a9c8
# Parent  c633162a96e155faf17a49d5c334a3fdf536027f
bundle2-test: use the new way to extend push content

The only core user of the old way were tests. We update them.

Patch

diff --git a/tests/test-bundle2.t b/tests/test-bundle2.t
--- a/tests/test-bundle2.t
+++ b/tests/test-bundle2.t
@@ -945,29 +945,28 @@  Setting up
   > from mercurial import util
   > from mercurial import bundle2
   > from mercurial import exchange
   > from mercurial import extensions
   > 
-  > def _pushbundle2failpart(orig, pushop, bundler):
-  >     extradata = orig(pushop, bundler)
+  > def _pushbundle2failpart(pushop, bundler):
   >     reason = pushop.ui.config('failpush', 'reason', None)
   >     part = None
   >     if reason == 'abort':
   >         bundler.newpart('test:abort')
   >     if reason == 'unknown':
   >         bundler.newpart('TEST:UNKNOWN')
   >     if reason == 'race':
   >         # 20 Bytes of crap
   >         bundler.newpart('b2x:check:heads', data='01234567890123456789')
-  >     return extradata
+  >     return lambda op: None
   > 
   > @bundle2.parthandler("test:abort")
   > def handleabort(op, part):
   >     raise util.Abort('Abandon ship!', hint="don't panic")
   > 
   > def uisetup(ui):
-  >     extensions.wrapfunction(exchange, '_pushbundle2extraparts', _pushbundle2failpart)
+  >     exchange.bundle2partsgenerators.insert(0, _pushbundle2failpart)
   > 
   > EOF
 
   $ cd main
   $ hg up tip