tests/mocktime.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Mon, 08 Jul 2024 17:02:27 +0200
changeset 51682 c10fa6388dbf
parent 48946 642e31cb55f0
permissions -rw-r--r--
revlog: use an explicit config option to enable mmap usage for index We replace the `experimental.mmapindexthreshold` with two options: The `storage.revlog.mmap.index` is a boolean option to enable or disable the feature. The `storage.revlog.mmap.index:size-threshold` is a bytes option that control when we will be using mmap instead of plain reading.

import os
import time


class mocktime:
    def __init__(self, increment):
        self.time = 0
        self.increment = [float(s) for s in increment.split()]
        self.pos = 0

    def __call__(self):
        self.time += self.increment[self.pos % len(self.increment)]
        self.pos += 1
        return self.time


def uisetup(ui):
    time.time = mocktime(os.environ.get('MOCKTIME', '0.1'))