tests/test-extensions-wrapfunction.py.out
author Martin von Zweigbergk <martinvonz@google.com>
Mon, 21 Aug 2017 16:46:05 -0700
changeset 34014 47e52f079a57
parent 29765 19578bb84731
child 34128 82bd4c5a81e5
permissions -rw-r--r--
extensions: add wrappedfunction() context manager Several extensions exist that temporarily want to wrap a function (at least narrowhg, any many of the extensions in hg-experimental). That's why we have the unwrapfunction() that was introduced in 19578bb84731 (extensions: add unwrapfunction to undo wrapfunction, 2016-08-10). This patch adds a simple wrappedfunction() that returns a context manager. Differential Revision: https://phab.mercurial-scm.org/D472

wrap 0: [0, 'orig']
wrap 1: [1, 0, 'orig']
wrap 2: [2, 1, 0, 'orig']
wrap 3: [3, 2, 1, 0, 'orig']
wrap 4: [4, 3, 2, 1, 0, 'orig']
wrap 0: [0, 4, 3, 2, 1, 0, 'orig']
unwrap 3: 3: [0, 4, 2, 1, 0, 'orig']
unwrap -: 0: [4, 2, 1, 0, 'orig']
unwrap 0: 0: [4, 2, 1, 'orig']
unwrap 4: 4: [2, 1, 'orig']
unwrap 0: -: ValueError
unwrap 2: 2: [1, 'orig']
unwrap 1: 1: ['orig']
unwrap -: -: IndexError
context manager ['orig']
context manager [1, 'orig']
context manager [0, 1, 'orig']
context manager [2, 0, 1, 'orig']
context manager [2, 1, 'orig']
context manager [2, 'orig']