This makes the test run succesfully on Python 3. There is just a b'' prefix
extra in the output.
- skip-blame because we added just b'' prefixes
| hg-reviewers |
This makes the test run succesfully on Python 3. There is just a b'' prefix
extra in the output.
| Lint Skipped |
| Unit Tests Skipped |
| > registrar, | > registrar, | ||||
| > error, | > error, | ||||
| > ui as uimod, | > ui as uimod, | ||||
| > ) | > ) | ||||
| > | > | ||||
| > configtable = {} | > configtable = {} | ||||
| > configitem = registrar.configitem(configtable) | > configitem = registrar.configitem(configtable) | ||||
| > | > | ||||
| > configitem('ui', 'ioerrors', | > configitem(b'ui', b'ioerrors', | ||||
| > default=list, | > default=list, | ||||
| > ) | > ) | ||||
| > | > | ||||
| > def pretxncommit(ui, repo, **kwargs): | > def pretxncommit(ui, repo, **kwargs): | ||||
| > ui.warn('warn during pretxncommit\n') | > ui.warn(b'warn during pretxncommit\n') | ||||
| > | > | ||||
| > def pretxnclose(ui, repo, **kwargs): | > def pretxnclose(ui, repo, **kwargs): | ||||
| > ui.warn('warn during pretxnclose\n') | > ui.warn(b'warn during pretxnclose\n') | ||||
| > | > | ||||
| > def txnclose(ui, repo, **kwargs): | > def txnclose(ui, repo, **kwargs): | ||||
| > ui.warn('warn during txnclose\n') | > ui.warn(b'warn during txnclose\n') | ||||
| > | > | ||||
| > def txnabort(ui, repo, **kwargs): | > def txnabort(ui, repo, **kwargs): | ||||
| > ui.warn('warn during abort\n') | > ui.warn(b'warn during abort\n') | ||||
| > | > | ||||
| > class fdproxy(object): | > class fdproxy(object): | ||||
| > def __init__(self, ui, o): | > def __init__(self, ui, o): | ||||
| > self._ui = ui | > self._ui = ui | ||||
| > self._o = o | > self._o = o | ||||
| > | > | ||||
| > def __getattr__(self, attr): | > def __getattr__(self, attr): | ||||
| > return getattr(self._o, attr) | > return getattr(self._o, attr) | ||||
| > | > | ||||
| > def write(self, msg): | > def write(self, msg): | ||||
| > errors = set(self._ui.configlist('ui', 'ioerrors')) | > errors = set(self._ui.configlist(b'ui', b'ioerrors')) | ||||
| > pretxncommit = msg == 'warn during pretxncommit\n' | > pretxncommit = msg == b'warn during pretxncommit\n' | ||||
| > pretxnclose = msg == 'warn during pretxnclose\n' | > pretxnclose = msg == b'warn during pretxnclose\n' | ||||
| > txnclose = msg == 'warn during txnclose\n' | > txnclose = msg == b'warn during txnclose\n' | ||||
| > txnabort = msg == 'warn during abort\n' | > txnabort = msg == b'warn during abort\n' | ||||
| > msgabort = msg == _('transaction abort!\n') | > msgabort = msg == _(b'transaction abort!\n') | ||||
| > msgrollback = msg == _('rollback completed\n') | > msgrollback = msg == _(b'rollback completed\n') | ||||
| > | > | ||||
| > if pretxncommit and 'pretxncommit' in errors: | > if pretxncommit and b'pretxncommit' in errors: | ||||
| > raise IOError(errno.EPIPE, 'simulated epipe') | > raise IOError(errno.EPIPE, 'simulated epipe') | ||||
| > if pretxnclose and 'pretxnclose' in errors: | > if pretxnclose and b'pretxnclose' in errors: | ||||
| > raise IOError(errno.EIO, 'simulated eio') | > raise IOError(errno.EIO, 'simulated eio') | ||||
| > if txnclose and 'txnclose' in errors: | > if txnclose and b'txnclose' in errors: | ||||
| > raise IOError(errno.EBADF, 'simulated badf') | > raise IOError(errno.EBADF, 'simulated badf') | ||||
| > if txnabort and 'txnabort' in errors: | > if txnabort and b'txnabort' in errors: | ||||
| > raise IOError(errno.EPIPE, 'simulated epipe') | > raise IOError(errno.EPIPE, 'simulated epipe') | ||||
| > if msgabort and 'msgabort' in errors: | > if msgabort and b'msgabort' in errors: | ||||
| > raise IOError(errno.EBADF, 'simulated ebadf') | > raise IOError(errno.EBADF, 'simulated ebadf') | ||||
| > if msgrollback and 'msgrollback' in errors: | > if msgrollback and b'msgrollback' in errors: | ||||
| > raise IOError(errno.EIO, 'simulated eio') | > raise IOError(errno.EIO, 'simulated eio') | ||||
| > | > | ||||
| > return self._o.write(msg) | > return self._o.write(msg) | ||||
| > | > | ||||
| > def uisetup(ui): | > def uisetup(ui): | ||||
| > class badui(ui.__class__): | > class badui(ui.__class__): | ||||
| > def write_err(self, *args, **kwargs): | > def write_err(self, *args, **kwargs): | ||||
| > olderr = self.ferr | > olderr = self.ferr | ||||
| > try: | > try: | ||||
| > self.ferr = fdproxy(self, olderr) | > self.ferr = fdproxy(self, olderr) | ||||
| > return super(badui, self).write_err(*args, **kwargs) | > return super(badui, self).write_err(*args, **kwargs) | ||||
| > finally: | > finally: | ||||
| > self.ferr = olderr | > self.ferr = olderr | ||||
| > | > | ||||
| > ui.__class__ = badui | > ui.__class__ = badui | ||||
| > | > | ||||
| > def reposetup(ui, repo): | > def reposetup(ui, repo): | ||||
| > ui.setconfig('hooks', 'pretxnclose.badui', pretxnclose, 'badui') | > ui.setconfig(b'hooks', b'pretxnclose.badui', pretxnclose, b'badui') | ||||
| > ui.setconfig('hooks', 'txnclose.badui', txnclose, 'badui') | > ui.setconfig(b'hooks', b'txnclose.badui', txnclose, b'badui') | ||||
| > ui.setconfig('hooks', 'pretxncommit.badui', pretxncommit, 'badui') | > ui.setconfig(b'hooks', b'pretxncommit.badui', pretxncommit, b'badui') | ||||
| > ui.setconfig('hooks', 'txnabort.badui', txnabort, 'badui') | > ui.setconfig(b'hooks', b'txnabort.badui', txnabort, b'badui') | ||||
| > EOF | > EOF | ||||
| $ cat >> $HGRCPATH << EOF | $ cat >> $HGRCPATH << EOF | ||||
| > [extensions] | > [extensions] | ||||
| > badui = $TESTTMP/badui.py | > badui = $TESTTMP/badui.py | ||||
| > EOF | > EOF | ||||
| An I/O error during pretxncommit is handled | An I/O error during pretxncommit is handled | ||||