view hgext/narrow/narrowmerge.py @ 38045:18e6ea9ba81d

narrow: filter set of files to check for case-folding to core Differential Revision: https://phab.mercurial-scm.org/D3575
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 17 May 2018 15:25:52 -0700
parents 8f37b5fc5abf
children
line wrap: on
line source

# narrowmerge.py - extensions to mercurial merge module to support narrow clones
#
# 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 mercurial import (
    copies,
    extensions,
)

def setup():
    def _computenonoverlap(orig, repo, *args, **kwargs):
        u1, u2 = orig(repo, *args, **kwargs)
        narrowmatch = repo.narrowmatch()
        if narrowmatch.always():
            return u1, u2

        u1 = [f for f in u1 if narrowmatch(f)]
        u2 = [f for f in u2 if narrowmatch(f)]
        return u1, u2
    extensions.wrapfunction(copies, '_computenonoverlap', _computenonoverlap)