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

cli: migrate "tag list" to template #3595

Merged
merged 7 commits into from
May 3, 2024
Merged

Conversation

yuja
Copy link
Contributor

@yuja yuja commented Apr 29, 2024

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

@yuja yuja force-pushed the push-sylsnnyopyvo branch from 413a9cd to 16d2a3e Compare April 29, 2024 14:01
@jonathantanmy
Copy link
Contributor

Looks good to me, but I haven't contributed to jj in a while so I'll let someone else approve.

This PR seems to do 3 things:

  • add templating support to tag list
  • add several more functions that a template can use
  • use those functions to make a ref describer called format_ref_targets, and use format_ref_targets in the default template of tag list

These all seem reasonable to me and are very clearly laid out in this series of commits. I can't judge if the functions are what the jj project wants long-term (whether naming or functionality) so I'll let someone else approve.

Copy link
Contributor

@noahmayr noahmayr left a comment

Choose a reason for hiding this comment

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

lgtm as well, looking forward to the follow up for branch list templates

@yuja yuja force-pushed the push-sylsnnyopyvo branch from 16d2a3e to 0161bd8 Compare May 1, 2024 13:35
@yuja
Copy link
Contributor Author

yuja commented May 1, 2024

Thanks. I'll merge this PR after the release. This wouldn't be that useful without branch templating.

yuja added 7 commits May 3, 2024 14:29
I'm going to add ref_name.target*() template methods so the commit templater
can be reused for branches/tags templates. RefTarget could be looked up by
(name, kind) pair, but it's simpler to store it in RefName.
It will be called from cmd_tag_list().
I'll update the test to include conflicted tag, which can't be easily set up
by fetching from remote.
I'm going to add more detailed output there. This is a step towards "branch
list" template. "tag list -T" wouldn't be that useful, but it shares primitives
with "branch list -T".
"working_copy tag" wouldn't be needed, but is added for consistency.
I considered adding RefTarget template type, but some of the methods naturally
fit to RefName. For example, a conflicted branch name is decorated as "??", so
it makes sense to add branch.conflict() instead of branch.target().conflict().

I'm not pretty sure how many RefName methods we'll need to add to port the
current branch listing, but there will be .tracked(), .tracking_local_present(),
.ahead_by(), and .behind_by().
This is basically a template version of print_branch_target().
@yuja yuja force-pushed the push-sylsnnyopyvo branch from 0161bd8 to 1329516 Compare May 3, 2024 06:09
@yuja yuja enabled auto-merge (rebase) May 3, 2024 06:10
@yuja yuja merged commit 0d630ac into jj-vcs:main May 3, 2024
16 checks passed
@yuja yuja deleted the push-sylsnnyopyvo branch May 3, 2024 06: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