D5119: exchange: pass includepats and excludepats as arguments to getbundle()

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Thu Oct 18 06:38:25 EDT 2018


pulkit updated this revision to Diff 12231.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5119?vs=12207&id=12231

REVISION DETAIL
  https://phab.mercurial-scm.org/D5119

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  mercurial/exchange.py
  mercurial/wireprototypes.py

CHANGE DETAILS

diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py
--- a/mercurial/wireprototypes.py
+++ b/mercurial/wireprototypes.py
@@ -162,6 +162,8 @@
     'cg': 'boolean',
     'cbattempted': 'boolean',
     'stream': 'boolean',
+    'includepats': 'csv',
+    'excludepats': 'csv',
 }
 
 class baseprotocolhandler(interfaceutil.Interface):
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -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 --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -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.



To: pulkit, #hg-reviewers, indygreg, durin42, martinvonz
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list