From efd45069e370c2f5fe4878024205cb69c859ca91 Mon Sep 17 00:00:00 2001 From: Martijn Pieters Date: Tue, 20 Mar 2018 08:22:48 -0700 Subject: [PATCH] sparse: use relglob to exclude readme files Summary: Although the old glob *should* work, in practice the treemanifest matcher seems to have issues with glob:**/ paths, where relglob: works. Reviewed By: ryanmce Differential Revision: D7287992 fbshipit-source-id: d3802e730d937eeca7059dac691d8dac5a5de262 --- hgext/fbsparse.py | 2 +- tests/test-fb-hgext-sparse-profiles.t | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hgext/fbsparse.py b/hgext/fbsparse.py index 9f6005a86e..c0282059ee 100644 --- a/hgext/fbsparse.py +++ b/hgext/fbsparse.py @@ -814,7 +814,7 @@ def _discover(ui, repo): matcher = matchmod.match( repo.root, repo.getcwd(), patterns=['path:' + profile_directory], - exclude=['**/README.*', '**/README']) + exclude=['relglob:README.*', 'relglob:README']) available.update(mf.matches(matcher)) # sort profiles and read profile metadata as we iterate diff --git a/tests/test-fb-hgext-sparse-profiles.t b/tests/test-fb-hgext-sparse-profiles.t index cbfefaf863..f1aa2512fe 100644 --- a/tests/test-fb-hgext-sparse-profiles.t +++ b/tests/test-fb-hgext-sparse-profiles.t @@ -376,6 +376,18 @@ Test profile discovery } ] +The current working directory plays no role in listing profiles: + + $ mkdir otherdir + $ cd otherdir + $ hg sparse --list-profiles + symbols: * = active profile, ~ = transitively included + ~ profiles/bar/eggs - Base profile including the profiles directory + profiles/bar/python + profiles/foo/monty + * profiles/foo/spam - Profile that only includes another + $ cd .. + Profiles are loaded from the manifest, so excluding a profile directory should not hamper listing.