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

templates: add .normal_hex() for {Commit,Change}Id #4477

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

avamsi
Copy link
Member

@avamsi avamsi commented Sep 15, 2024

This doesn't do much for CommitId but outputs the "forward" hex for
ChangeId, which can be useful to use as Gerrit Change-Id.

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

cli/src/commit_templater.rs Outdated Show resolved Hide resolved
@avamsi avamsi force-pushed the jj_wokvqlnoyppv branch 2 times, most recently from 5740549 to 4f3e860 Compare September 16, 2024 01:36
@avamsi avamsi changed the title templates: add a hex() method for commit/change_ids templates: add normal_hex() method for {Commit,Change}Id Sep 16, 2024
@avamsi avamsi changed the title templates: add normal_hex() method for {Commit,Change}Id templates: add .normal_hex() for {Commit,Change}Id Sep 16, 2024
@avamsi avamsi requested a review from yuja September 17, 2024 23:50
@avamsi
Copy link
Member Author

avamsi commented Sep 17, 2024

@yuja are you good with this now? (Or if anyone else has any opinions..)

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.

CHANGELOG.md Outdated Show resolved Hide resolved
This doesn't do much for CommitId but outputs the "forward" hex for
ChangeId, which can be useful to use as Gerrit Change-Id.
@avamsi avamsi enabled auto-merge (rebase) September 18, 2024 02:01
@avamsi avamsi merged commit a2e67bd into jj-vcs:main Sep 18, 2024
18 checks passed
@avamsi avamsi deleted the jj_wokvqlnoyppv branch September 18, 2024 02:11
@avamsi
Copy link
Member Author

avamsi commented Sep 18, 2024

For posterity, I'm using it like this --

[templates]
    draft_commit_description = '''
        separate("\n",
            description.remove_suffix("\n"),
            if(description.contains(change_id.normal_hex()),
                "",
                "\nChange-Id: Id0000000" ++ change_id.normal_hex()
            ),
            "\n",
            surround("JJ: Changes:\n", "", indent("JJ: \t", diff.summary()))
        )
    '''

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