tests/testlib/ext-phase-report.py
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Fri, 26 Apr 2024 19:10:35 +0100
changeset 51626 865efc020c33
parent 48875 6000f5b25c9b
permissions -rw-r--r--
dirstate: remove the python-side whitelist of allowed matchers This whitelist is too permissive because it allows matchers that contain disallowed ones deep inside, for example through `intersectionmatcher`. It is also too restrictive because it doesn't pass through some of the matchers we support, such as `patternmatcher`. It's also unnecessary because unsupported matchers raise `FallbackError` and we fall back anyway. Making this change makes more of the tests use rust code path, and therefore subtly change behavior. For example, rust status in largefiles repos seems to have strange behavior.

# tiny extension to report phase changes during transaction


def reposetup(ui, repo):
    def reportphasemove(tr):
        for revs, move in sorted(tr.changes[b"phases"], key=lambda r: r[0][0]):
            for rev in revs:
                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