D4614: narrow: use diffmatcher to send only new filelogs in non-ellipses widening

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Mon Sep 17 13:32:24 UTC 2018


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

REVISION SUMMARY
  Before this patch, when we widen a non-ellipses narrow clone, we downloads all
  the filelogs matching the resulting new matcher. This is same as the ellipses
  case but can be improved because, we don't pull new csets in non-ellipses cases,
  we can only download the new added files instead of downloading all the files
  which matches the new matcher.
  
  So, we only download files which matches the new matcher but does not matches
  the old matcher. There exists a match.differencematcher() which is used here.
  
  This will lead to significant amount of speedup in extending a non-ellipses
  narrow copy on large repos because we will download and process only the new
  required filelogs.
  
  The tests changes demonstrate that we are downloading now less files.
  
  Thanks to Augie for pointing that functionality of differencematcher exists in
  core.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  tests/test-narrow-widen-no-ellipsis.t

CHANGE DETAILS

diff --git a/tests/test-narrow-widen-no-ellipsis.t b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -95,7 +95,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 0 changesets with 1 changes to 2 files
+  added 0 changesets with 1 changes to 1 files
   3 local changesets published
   $ hg tracked
   I path:inside
@@ -154,7 +154,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 0 changesets with 1 changes to 3 files
+  added 0 changesets with 1 changes to 1 files
   5 local changesets published
   $ hg tracked
   I path:inside
@@ -259,7 +259,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 0 changesets with 1 changes to 5 files
+  added 0 changesets with 1 changes to 1 files
   11 local changesets published
   $ hg tracked
   I path:d0
@@ -351,7 +351,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 0 changesets with 1 changes to 2 files
+  added 0 changesets with 1 changes to 1 files
   11 local changesets published
   $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
   11: local
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -21,6 +21,7 @@
     error,
     exchange,
     extensions,
+    match as matchmod,
     narrowspec,
     repair,
     repository,
@@ -72,6 +73,9 @@
     newmatch = narrowspec.match(repo.root, include=include, exclude=exclude)
     oldinclude = sorted(filter(bool, kwargs.get(r'oldincludepats', [])))
     oldexclude = sorted(filter(bool, kwargs.get(r'oldexcludepats', [])))
+    oldmatch = narrowspec.match(repo.root, include=oldinclude,
+                                exclude=oldexclude)
+    diffmatch = matchmod.differencematcher(newmatch, oldmatch)
     common = set(common or [nullid])
 
     if (oldinclude != include or oldexclude != exclude):
@@ -84,7 +88,7 @@
             # XXX: we should only send the filelogs (and treemanifest). user
             # already has the changelog and manifest
             packer = changegroup.getbundler(version, repo,
-                                            filematcher=newmatch,
+                                            filematcher=diffmatch,
                                             fullnodes=commonnodes)
             cgdata = packer.generate(set([nullid]), list(commonnodes), False,
                     source)



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


More information about the Mercurial-devel mailing list