diff --git a/hgext3rd/sparse.py b/hgext3rd/sparse.py --- a/hgext3rd/sparse.py +++ b/hgext3rd/sparse.py @@ -988,6 +988,11 @@ def prefix(self): return False + def visitdir(self, dir): + if any(True for path in self._includes if path.startswith(dir)): + return True + return self._matcher.visitdir(dir) + def hash(self): sha1 = hashlib.sha1() sha1.update(_hashmatcher(self._matcher)) @@ -1021,6 +1026,12 @@ def prefix(self): return False + def visitdir(self, dir): + for match in self._matchers: + if match.visitdir(dir): + return True + return False + def hash(self): sha1 = hashlib.sha1() for m in self._matchers: @@ -1046,6 +1057,9 @@ def anypats(self): return True + def visitdir(self, dir): + return True + def hash(self): sha1 = hashlib.sha1() sha1.update('negate') diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t --- a/tests/test-treemanifest.t +++ b/tests/test-treemanifest.t @@ -134,3 +134,16 @@ Node Delta Base Delta Length 8289b85c6a30 000000000000 92 + +Test treemanifest with sparse enabled + $ cat >> .hg/hgrc < [extensions] + > sparse = $TESTDIR/../hgext3rd/sparse.py + > reset = $TESTDIR/../hgext3rd/reset.py + > EOF + $ hg sparse -I subdir + $ hg reset '.^' + resetting without an active bookmark + saved backup bundle to $TESTTMP/client/.hg/strip-backup/27a577922312-3ad85b1a-backup.hg (glob) + $ hg status + M subdir/y