Patchwork D7099: widening: pass in matchers instead of patterns

login
register
mail settings
Submitter phabricator
Date Oct. 14, 2019, 5:57 p.m.
Message ID <differential-rev-PHID-DREV-jlpa3ief2ewsgyat6qpw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42337/
State Superseded
Headers show

Comments

phabricator - Oct. 14, 2019, 5:57 p.m.
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




To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 16, 2019, 1:58 p.m.
This revision is now accepted and ready to land.
pulkit added a comment.
pulkit accepted this revision.


  > The oldmatch is not used yet, but it should be used eventually when widening no longer resends manifests and files the client already has.
  
  You mean for ellipses case? If yes, nice!!!!

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7099/new/

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

To: martinvonz, durin42, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel
phabricator - Oct. 16, 2019, 2:33 p.m.
martinvonz added a comment.


  In D7099#104414 <https://phab.mercurial-scm.org/D7099#104414>, @pulkit wrote:
  
  >> The oldmatch is not used yet, but it should be used eventually when widening no longer resends manifests and files the client already has.
  >
  > You mean for ellipses case? If yes, nice!!!!
  
  Yes, for the ellipses case. I think you already fixed the non-ellipses case. We should be able to unify them better. But I'll probably only get around to doing that next year.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7099/new/

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

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

Patch

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"