diff -r c311424ea579 -r 440f5b65be57 mercurial/exchange.py --- a/mercurial/exchange.py Thu Nov 01 16:51:21 2018 -0700 +++ b/mercurial/exchange.py Tue Oct 16 17:53:26 2018 +0300 @@ -40,6 +40,7 @@ streamclone, url as urlmod, util, + wireprototypes, ) from .utils import ( stringutil, @@ -1633,6 +1634,13 @@ kwargs['common'] = pullop.common kwargs['heads'] = pullop.heads or pullop.rheads + # check server supports narrow and then adding includepats and excludepats + servernarrow = pullop.remote.capable(wireprototypes.NARROWCAP) + if servernarrow and pullop.includepats: + kwargs['includepats'] = pullop.includepats + if servernarrow and pullop.excludepats: + kwargs['excludepats'] = pullop.excludepats + if streaming: kwargs['cg'] = False kwargs['stream'] = True