Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support wildcards and meta items in diff/commit filters #532

Merged
merged 4 commits into from
Jan 12, 2022

Conversation

craigds
Copy link
Member

@craigds craigds commented Dec 24, 2021

Description

This PR adds support for the following filter styles:

  • kart diff HEAD^ datasetname:meta:title - diff a meta item
  • kart diff HEAD^ datasetname:meta - diff all meta items from datasetname
  • kart diff HEAD^ *:meta - diff all meta items from all datasets
  • kart diff HEAD^ *:feature - diff all features from all datasets
  • kart diff HEAD^ *abc*:feature - diff all features from datasets whose names contain abc

In addition specific-feature filters no longer also show meta items.

Todo:

Related links:

Checklist:

  • Have you reviewed your own change?
  • Have you included test(s)?
  • Have you updated the changelog?

@craigds craigds requested a review from olsen232 December 24, 2021 03:45
Copy link
Collaborator

@olsen232 olsen232 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@craigds
Copy link
Member Author

craigds commented Jan 11, 2022

Prevent user from committing a feature without an associated schema change (kart commit '*:feature' when a schema change is also present

This in fact turns out to not be a problem since Kart actually commits your meta items whenever you commit any feature. This might be improved in future to be less implicit, but for now it seems okay and doesn't need to explicitly prevent you from committing a feature when you have a local schema change.

@craigds
Copy link
Member Author

craigds commented Jan 11, 2022

I disabled the specific case of wildcard dataset name with feature IDs (e.g. *:feature:123), because it's quite tricky to implement. Since kart log delegates to git log, supporting this would mean we would need to figure out the full paths of features affected by the pathspecs in advance of calling git log. But we'd need to look at the associated schemas for those features to figure out the mapping from PK to feature path, and the mapping may change over time...

In short, it's very difficult unless we stop calling git log and implement log ourselves, so I just disabled it:

$ kart log -- *:feature:0008240571
Error: `kart log` doesn't currently support filters with both wildcards and feature IDs

I don't expect anyone will notice for a good while, in which time maybe we'll implement log ourselves

@craigds craigds marked this pull request as ready for review January 11, 2022 22:51
@craigds craigds merged commit a42d34f into master Jan 12, 2022
@craigds craigds deleted the wilder-filters branch January 12, 2022 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants