D5487: remotefilelog: fix bug in maybesparsematch returning alwaysmatcher

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Fri Dec 28 00:15:30 UTC 2018


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

REVISION SUMMARY
  The description of the method says that it should return None if sparse is not
  used in this repository; since sparse.matcher() returns alwaysmatcher if sparse
  is not enabled, I'm using that as the signal to return None here to preserve the
  previous behavior.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/remotefilelog/shallowrepo.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/shallowrepo.py b/hgext/remotefilelog/shallowrepo.py
--- a/hgext/remotefilelog/shallowrepo.py
+++ b/hgext/remotefilelog/shallowrepo.py
@@ -143,8 +143,13 @@
             sparse repository.
             '''
             if revs:
-                return sparse.matcher(repo, revs=revs)
-            return sparse.matcher(repo)
+                ret = sparse.matcher(repo, revs=revs)
+            else:
+                ret = sparse.matcher(repo)
+
+            if ret.always():
+                return None
+            return ret
 
         def file(self, f):
             if f[0] == '/':



To: spectral, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list