view tests/testlib/ext-phase-report.py @ 42817:69506e1b3214

run-tests: handle --local before --with-hg We no longer support them both together, so this is now safe to do. By checking --local first, we avoid error out about an invalid --with-hg script if --local was also given (we instead tell the user that the options are mutually exclusive). I also had to wrap the 'binpath' we pass to setattr() in _strpath() to keep `python3 run-tests.py -l` working. That change also made `python3 run-tests.py -l --chg` work, which was the reason for this series. Differential Revision: https://phab.mercurial-scm.org/D6760
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 23 Aug 2019 08:54:32 -0700
parents 3b4d14beac3d
children 2372284d9457
line wrap: on
line source

# tiny extension to report phase changes during transaction

from __future__ import absolute_import

def reposetup(ui, repo):

    def reportphasemove(tr):
        for rev, move in sorted(tr.changes[b'phases'].items()):
            if move[0] is None:
                ui.write((b'test-debug-phase: new rev %d:  x -> %d\n'
                          % (rev, move[1])))
            else:
                ui.write((b'test-debug-phase: move rev %d: %d -> %d\n'
                          % (rev, move[0], move[1])))

    class reportphaserepo(repo.__class__):
        def transaction(self, *args, **kwargs):
            tr = super(reportphaserepo, self).transaction(*args, **kwargs)
            tr.addpostclose(b'report-phase', reportphasemove)
            return tr

    repo.__class__ = reportphaserepo