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

template: add contained_in method to commit object in templates #3582

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

noahmayr
Copy link
Contributor

@noahmayr noahmayr commented Apr 26, 2024

Adds a new method to commit objects in templates to check whether they're contained within a given revset

Use cases:

  • distinct coloring for commits that are local/on remote branches (label(if(self.contained_in(::remote_branches()), "remote"), builtin_change_id_with_hidden_and_divergent_info))
  • different node symbols for heads
  • distinct styling for merge commits
  • ...?

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@noahmayr noahmayr force-pushed the noahmayr/push-mrrsozywsuql branch from e2758d1 to ace545c Compare April 26, 2024 20:37
@noahmayr noahmayr changed the title template: add in_revset method to check if a commit is contained in a revset template: add contained_in method to commit object in templates Apr 26, 2024
cli/src/commit_templater.rs Outdated Show resolved Hide resolved
cli/src/commit_templater.rs Outdated Show resolved Hide resolved
cli/src/commit_templater.rs Outdated Show resolved Hide resolved
@noahmayr noahmayr force-pushed the noahmayr/push-mrrsozywsuql branch from ace545c to 2aab206 Compare April 29, 2024 08:21
@noahmayr noahmayr marked this pull request as ready for review April 29, 2024 08:24
@noahmayr noahmayr force-pushed the noahmayr/push-mrrsozywsuql branch from 2aab206 to a9be7f7 Compare April 29, 2024 08:28
Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

docs/templates.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
this allows to conditionally display or label elements depending on 
whether the given commit is contained within the revset
@noahmayr noahmayr force-pushed the noahmayr/push-mrrsozywsuql branch from a9be7f7 to c5bc87c Compare April 29, 2024 09:52
@noahmayr noahmayr merged commit dc693e7 into main Apr 29, 2024
16 checks passed
@noahmayr noahmayr deleted the noahmayr/push-mrrsozywsuql branch April 29, 2024 10:16
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.

3 participants