D4851: streamclone: pass narrowing related info in generatev2() and _walkstreamfiles()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

D4851: streamclone: pass narrowing related info in generatev2() and _walkstreamfiles()

martinvonz (Martin von Zweigbergk)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds includes and excludes as argument to generatev2() and build a
  matcher using that and pass that into _walkstreamfiles(). This will help us in
  filtering files we stream depending on the includes and excludes passed in by
  the user.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/streamclone.py

CHANGE DETAILS

diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -16,6 +16,7 @@
     branchmap,
     cacheutil,
     error,
+    narrowspec,
     phases,
     pycompat,
     store,
@@ -190,8 +191,8 @@
     return True
 
 # This is it's own function so extensions can override it.
-def _walkstreamfiles(repo):
-    return repo.store.walk()
+def _walkstreamfiles(repo, matcher=None):
+    return repo.store.walk(matcher)
 
 def generatev1(repo):
     """Emit content for version 1 of a streaming clone.
@@ -527,7 +528,7 @@
             finally:
                 fp.close()
 
-def generatev2(repo):
+def generatev2(repo, includes=None, excludes=None):
     """Emit content for version 2 of a streaming clone.
 
     the data stream consists the following entries:
@@ -545,8 +546,12 @@
         entries = []
         totalfilesize = 0
 
+        matcher = None
+        if includes or excludes:
+            matcher = narrowspec.match(repo.root, includes, excludes)
+
         repo.ui.debug('scanning\n')
-        for name, ename, size in _walkstreamfiles(repo):
+        for name, ename, size in _walkstreamfiles(repo, matcher):
             if size:
                 entries.append((_srcstore, name, _fileappend, size))
                 totalfilesize += size



To: pulkit, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D4851: streamclone: pass narrowing related info in _walkstreamfiles()

martinvonz (Martin von Zweigbergk)
pulkit updated this revision to Diff 12209.
pulkit edited the summary of this revision.
pulkit retitled this revision from "streamclone: pass narrowing related info in generatev2() and _walkstreamfiles()" to "streamclone: pass narrowing related info in _walkstreamfiles()".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4851?vs=11603&id=12209

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

AFFECTED FILES
  mercurial/streamclone.py

CHANGE DETAILS

diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -16,6 +16,7 @@
     branchmap,
     cacheutil,
     error,
+    narrowspec,
     phases,
     pycompat,
     repository,
@@ -194,8 +195,8 @@
     return True
 
 # This is it's own function so extensions can override it.
-def _walkstreamfiles(repo):
-    return repo.store.walk()
+def _walkstreamfiles(repo, matcher=None):
+    return repo.store.walk(matcher)
 
 def generatev1(repo):
     """Emit content for version 1 of a streaming clone.
@@ -553,8 +554,12 @@
         entries = []
         totalfilesize = 0
 
+        matcher = None
+        if includes or excludes:
+            matcher = narrowspec.match(repo.root, includes, excludes)
+
         repo.ui.debug('scanning\n')
-        for name, ename, size in _walkstreamfiles(repo):
+        for name, ename, size in _walkstreamfiles(repo, matcher):
             if size:
                 entries.append((_srcstore, name, _fileappend, size))
                 totalfilesize += size



To: pulkit, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D4851: streamclone: pass narrowing related info in _walkstreamfiles()

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf0e8f27768eb: streamclone: pass narrowing related info in _walkstreamfiles() (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4851?vs=12209&id=12228

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

AFFECTED FILES
  mercurial/streamclone.py

CHANGE DETAILS

diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -16,6 +16,7 @@
     branchmap,
     cacheutil,
     error,
+    narrowspec,
     phases,
     pycompat,
     repository,
@@ -194,8 +195,8 @@
     return True
 
 # This is it's own function so extensions can override it.
-def _walkstreamfiles(repo):
-    return repo.store.walk()
+def _walkstreamfiles(repo, matcher=None):
+    return repo.store.walk(matcher)
 
 def generatev1(repo):
     """Emit content for version 1 of a streaming clone.
@@ -553,8 +554,12 @@
         entries = []
         totalfilesize = 0
 
+        matcher = None
+        if includes or excludes:
+            matcher = narrowspec.match(repo.root, includes, excludes)
+
         repo.ui.debug('scanning\n')
-        for name, ename, size in _walkstreamfiles(repo):
+        for name, ename, size in _walkstreamfiles(repo, matcher):
             if size:
                 entries.append((_srcstore, name, _fileappend, size))
                 totalfilesize += size



To: pulkit, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel