charlesetc created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In a repo where some directories are included by narrow and the complement are
  excluded by sparse, it was previously impossible to widen either because 
trying
  to widen narrow would complain that the requested files are outside the sparse
  checkout and trying to widen sparse would complain that the requested files 
are
  outside the narrow checkout.
  
  This changes the `hg tracked --addinclude` command to only actually update any
  newly accessible files in the dirstate if they are also accessible via sparse.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/narrowspec.py
  tests/test-narrow-sparse.t

CHANGE DETAILS

diff --git a/tests/test-narrow-sparse.t b/tests/test-narrow-sparse.t
--- a/tests/test-narrow-sparse.t
+++ b/tests/test-narrow-sparse.t
@@ -67,3 +67,36 @@
   treemanifest (tree !)
 
   $ hg debugrebuilddirstate
+
+We only make the following assertions for the flat test case since the
+treemanifest test case fails with "path ends in directory separator: outside/"
+which seems like a bug unrelated to the regression this is testing for.
+
+#if flat
+widening with both sparse and narrow is possible
+
+  $ cat >> .hg/hgrc <<EOF
+  > [extensions]
+  > sparse = 
+  > narrow = 
+  > EOF
+
+  $ hg debugsparse -X outside/f -X widest/f
+  $ hg tracked -q --addinclude outside/f
+  $ tree
+  .
+  `-- inside
+      `-- f
+  
+  1 directory, 1 file
+
+  $ hg debugsparse -d outside/f
+  $ tree
+  .
+  |-- inside
+  |   `-- f
+  `-- outside
+      `-- f
+  
+  2 directories, 2 files
+#endif
diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -347,6 +347,9 @@
         ds.drop(f)
 
     pctx = repo[b'.']
+
+    # only update added files that are in the sparse checkout
+    addedmatch = matchmod.intersectmatchers(addedmatch, sparse.matcher(repo))
     newfiles = [f for f in pctx.manifest().walk(addedmatch) if f not in ds]
     for f in newfiles:
         ds.normallookup(f)



To: charlesetc, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to