D7099: widening: pass in matchers instead of patterns

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Oct 14 13:57:18 EDT 2019


martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This matches how it's done for the non-ellipsis case. The oldmatch is
  not used yet, but it should be used eventually when widening no longer
  resends manifests and files the client already has.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowwirepeer.py

CHANGE DETAILS

diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py
--- a/hgext/narrow/narrowwirepeer.py
+++ b/hgext/narrow/narrowwirepeer.py
@@ -102,13 +102,13 @@
         cgversion = cgversion
 
         bundler = bundle2.bundle20(repo.ui)
+        newmatch = narrowspec.match(
+            repo.root, include=newincludes, exclude=newexcludes
+        )
+        oldmatch = narrowspec.match(
+            repo.root, include=oldincludes, exclude=oldexcludes
+        )
         if not ellipses:
-            newmatch = narrowspec.match(
-                repo.root, include=newincludes, exclude=newexcludes
-            )
-            oldmatch = narrowspec.match(
-                repo.root, include=oldincludes, exclude=oldexcludes
-            )
             bundle2.widen_bundle(
                 bundler,
                 repo,
@@ -121,15 +121,7 @@
             )
         else:
             narrowbundle2.generate_ellipses_bundle2_for_widening(
-                bundler,
-                repo,
-                oldincludes,
-                oldexcludes,
-                newincludes,
-                newexcludes,
-                cgversion,
-                common,
-                known,
+                bundler, repo, oldmatch, newmatch, cgversion, common, known,
             )
     except error.Abort as exc:
         bundler = bundle2.bundle20(repo.ui)
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -112,20 +112,8 @@
 
 
 def generate_ellipses_bundle2_for_widening(
-    bundler,
-    repo,
-    oldinclude,
-    oldexclude,
-    newinclude,
-    newexclude,
-    version,
-    common,
-    known,
+    bundler, repo, oldmatch, newmatch, version, common, known,
 ):
-    newmatch = narrowspec.match(
-        repo.root, include=newinclude, exclude=newexclude
-    )
-
     common = set(common or [nullid])
     # Steps:
     # 1. Send kill for "$known & ::common"



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


More information about the Mercurial-devel mailing list