view hgext/narrow/narrowrepo.py @ 39884:9c8eff5cfa1b

py3: mask out None type when printing in `debuglocks` Apparently, %b doesn't allow None.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 26 Sep 2018 22:21:25 -0400
parents 9358f5066811
children d5498db5f86a
line wrap: on
line source

# narrowrepo.py - repository which supports narrow revlogs, lazy loading
#
# Copyright 2017 Google, Inc.
#
# 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 absolute_import

from . import (
    narrowdirstate,
    narrowwirepeer,
)

def wraprepo(repo):
    """Enables narrow clone functionality on a single local repository."""

    class narrowrepository(repo.__class__):

        def _makedirstate(self):
            dirstate = super(narrowrepository, self)._makedirstate()
            return narrowdirstate.wrapdirstate(self, dirstate)

        def peer(self):
            peer = super(narrowrepository, self).peer()
            peer._caps.add(narrowwirepeer.NARROWCAP)
            peer._caps.add(narrowwirepeer.ELLIPSESCAP)
            return peer

    repo.__class__ = narrowrepository