# HG changeset patch # User Pulkit Goyal # Date 1539701606 -10800 # Node ID 440f5b65be573333e7d0234051e17274f0cbfa3d # Parent c311424ea579ed24f9b45228c6b0bd8280d35b23 exchange: pass includepats and excludepats as arguments to getbundle() This will help in implementing narrow stream clones. Also narrow extension used to add these arguments, now we add them by default if they are not empty. Since reading includepats and excludepats on the server only works when narrow is enabled, we check if narrow if enabled or not before passing them. Differential Revision: https://phab.mercurial-scm.org/D5119 diff -r c311424ea579 -r 440f5b65be57 hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py Thu Nov 01 16:51:21 2018 -0700 +++ b/hgext/narrow/narrowbundle2.py Tue Oct 16 17:53:26 2018 +0300 @@ -260,8 +260,6 @@ getbundleargs['depth'] = 'plain' getbundleargs['oldincludepats'] = 'csv' getbundleargs['oldexcludepats'] = 'csv' - getbundleargs['includepats'] = 'csv' - getbundleargs['excludepats'] = 'csv' getbundleargs['known'] = 'csv' # Extend changegroup serving to handle requests from narrow clients. 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 diff -r c311424ea579 -r 440f5b65be57 mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py Thu Nov 01 16:51:21 2018 -0700 +++ b/mercurial/wireprototypes.py Tue Oct 16 17:53:26 2018 +0300 @@ -162,6 +162,8 @@ 'cg': 'boolean', 'cbattempted': 'boolean', 'stream': 'boolean', + 'includepats': 'csv', + 'excludepats': 'csv', } class baseprotocolhandler(interfaceutil.Interface):