( )⚙ D1250 sparse: list available and active profiles

This is an archive of the discontinued Mercurial Phabricator instance.

sparse: list available and active profiles
ClosedPublic

Authored by mjpieters on Oct 26 2017, 11:20 AM.
Tags
None
Subscribers

Details

Reviewers
durham
Group Reviewers
Restricted Project
Commits
rFBHGX540cdcbca7d5: sparse: list available and active profiles
Summary

This lets you list your currently active profiles, as well as let you discover
new profiles, provided sparse.profile_directory is set.

Includes JSON output. Future revisions can build on this to provide richer
metadata (parsed from the profile files).

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

mjpieters created this revision.Oct 26 2017, 11:20 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 26 2017, 11:20 AM
durham requested changes to this revision.Oct 31 2017, 12:59 PM
durham added a subscriber: durham.

Requesting changes for printing the key at least.

hgext3rd/fbsparse.py
685

Should probably be repo.wvfs.join(profile_directory).

Actually, this whole thing should probably be operating on the manifest, so the user doesn't have to have these files materialized inorder to enable them.

699

If we're going to use these symbols to represent things, I think we should print out a short oneline message to stderr explaining the symbols.

tests/test-sparse-profiles.t
303

In json, it might be better to just say 'active', 'included', etc.

This revision now requires changes to proceed.Oct 31 2017, 12:59 PM
mjpieters marked 2 inline comments as done.EditedNov 7 2017, 12:12 PM

Agreed on all points. The following update makes these changes, and in addition:

  • uses treemanifests if available to list profiles fast; we don't want to loop over a large manifest if we can help it
  • adds labels, so we can colour the output.

Try --list-profiles --config color.sparse.profile.active="green bold" --config color.sparse.profile.included="cyan italic" --config color.sparse.profile.legend="dim" for some added pizazz., for example.

mjpieters updated this revision to Diff 3311.Nov 7 2017, 12:13 PM
durham requested changes to this revision.Nov 7 2017, 1:20 PM
durham added inline comments.
hgext3rd/fbsparse.py
697

if tmf is None then files is undefined and I think it will crash. Maybe do this type of pattern?

files = None
if util.safehashattr...:
   tmf = ...
   if tmf is not None:
      ...
      files = ...

if files is None:
   files = (f for f in mf if...)
718

I still think we need to print out a key to the user to explain these symbols.

This revision now requires changes to proceed.Nov 7 2017, 1:20 PM
mjpieters marked 2 inline comments as done.Nov 8 2017, 11:17 AM
mjpieters added inline comments.
hgext3rd/fbsparse.py
718

Uhm, I implemented that and then must've fumbled updating the diff.. This update will include it.

mjpieters marked an inline comment as done.Nov 8 2017, 11:19 AM
mjpieters updated this revision to Diff 3335.
durham accepted this revision.Nov 9 2017, 11:47 AM
This revision is now accepted and ready to land.Nov 9 2017, 11:47 AM
This revision was automatically updated to reflect the committed changes.