view mercurial/cacheutil.py @ 51935:77e2994bd617

mdiff: convert a few block definitions from lists to tuples These were flagged by adding type hints. Some places were using a tuple of 4 ints to define a block, and others were using a list of 4. A tuple is better for typing, because we can define the length and the type of each entry. One of the places had to redefine the tuple, since writing to a tuple at an index isn't supported. This change spills out into the tests, and archeology says it was added to the repo in this state. There was no reason given for the divergence, and I suspect it wasn't intentional. It looks like `splitblock()` is completely unused in the codebase.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 30 Sep 2024 23:50:40 -0400
parents 0f26ee69cf36
children 145f66ea1664
line wrap: on
line source

# scmutil.py - Mercurial core utility functions
#
#  Copyright Olivia Mackall <olivia@selenic.com> and other
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

from __future__ import annotations

from . import repoview


def cachetocopy(srcrepo):
    """return the list of cache file valuable to copy during a clone"""
    # In local clones we're copying all nodes, not just served
    # ones. Therefore copy all branch caches over.
    cachefiles = [b'branch2']
    cachefiles += [b'branch2-%s' % f for f in repoview.filtertable]
    cachefiles += [b'branch3']
    cachefiles += [b'branch3-%s' % f for f in repoview.filtertable]
    cachefiles += [b'rbc-names-v2', b'rbc-revs-v2']
    cachefiles += [b'tags2']
    cachefiles += [b'tags2-%s' % f for f in repoview.filtertable]
    cachefiles += [b'hgtagsfnodes1']
    return cachefiles