##// END OF EJS Templates
exchange: support defining narrow file patterns for pull...
exchange: support defining narrow file patterns for pull This commit teaches exchange.pull() about the desire to perform a narrow file pull. We simply pass include and exclude patterns to the function. The values are validated and stored on the pulloperation instance. hg.clone() has been taught to pass these arguments to exchange.pull(). If the arguments are not passed to exchange.pull(), the active narrow patterns from the repository will automatically be used. We /could/ always use the narrow patterns from the repo. However, allowing explicit values to be passed in allows us to perform data fetching that doesn't necessarily align with the repo configuration. This provides more flexibility. Differential Revision: https://phab.mercurial-scm.org/D4539

File last commit:

r39565:e82da0fc default
r39589:130e5df3 default
Show More
narrowrepo.py
36 lines | 1.1 KiB | text/x-python | PythonLexer
# 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,
narrowrevlog,
narrowwirepeer,
)
def wraprepo(repo):
"""Enables narrow clone functionality on a single local repository."""
class narrowrepository(repo.__class__):
def file(self, f):
fl = super(narrowrepository, self).file(f)
narrowrevlog.makenarrowfilelog(fl, self.narrowmatch())
return fl
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