Skip to content

cli: duplicate: add setting for templating the new commit descriptions #6303

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

Merged
merged 1 commit into from
Apr 13, 2025

Conversation

winterqt
Copy link
Member

@winterqt winterqt commented Apr 10, 2025

This allows the customization of the duplicated commit descriptions.

An ideal use case for this is emulating git cherry-pick -x, as illustrated in the tests.

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

@winterqt winterqt requested a review from a team as a code owner April 10, 2025 05:20
@winterqt
Copy link
Member Author

Could probably use a mention in the Git command table at the very least (if we decide to keep this as a flag and not a setting a la templates.draft_commit_description).

Copy link
Member Author

@winterqt winterqt left a comment

Choose a reason for hiding this comment

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

Excluding the efficiency of writing 2x the commits with this option enabled, the main downside of this method is that the evolog looks ugly with the extra commit (IMO):

    ○  yostqsxw [email protected] 2001-02-03 08:05:15 4037fb05
    │  a
    ○  yostqsxw hidden [email protected] 2001-02-03 08:05:15 3d341b2f
    │  a
    ○  rlvkpnrz [email protected] 2001-02-03 08:05:09 a 2443ea76
    │  a
    ○  rlvkpnrz hidden [email protected] 2001-02-03 08:05:08 d8d5f980
       (empty) a

However, the op log looks good. :)

    @  44a208b90324 [email protected] 2001-02-03 04:05:15.000 +07:00 - 2001-02-03 04:05:15.000 +07:00
    │  duplicate 1 commit(s)
    │  args: jj duplicate a -T 'concat(description, "\n", "(cherry-picked from ", commit_id, ")")'
    │
    │  Changed commits:
    │  ○  + yostqsxw 4037fb05 a

Probably not that big of a deal, though; our working copy snapshots put more "wear" on the repo than this ever could.

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.

The implementation generally looks good to me, thanks.

@winterqt winterqt force-pushed the push-szumtyoxuxws branch from 9d24ab3 to 3f3d1cf Compare April 10, 2025 21:34
@winterqt winterqt changed the title cli: duplicate: add --template flag cli: duplicate: add setting for templating the new commit descriptions Apr 10, 2025
@winterqt winterqt force-pushed the push-szumtyoxuxws branch from 3f3d1cf to a077c6c Compare April 10, 2025 21:40
@winterqt winterqt requested review from yuja and emilazy April 10, 2025 21:41
@winterqt winterqt force-pushed the push-szumtyoxuxws branch from a077c6c to 985330a Compare April 10, 2025 21:57
@winterqt winterqt force-pushed the push-szumtyoxuxws branch from 985330a to 73cd8c8 Compare April 11, 2025 07:05
@winterqt winterqt requested a review from yuja April 11, 2025 07:06
@winterqt

This comment was marked as resolved.

@winterqt winterqt force-pushed the push-szumtyoxuxws branch from 73cd8c8 to 76df180 Compare April 11, 2025 07:14
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.

Thanks.

@winterqt winterqt force-pushed the push-szumtyoxuxws branch from 76df180 to e80f723 Compare April 11, 2025 20:17
@winterqt winterqt force-pushed the push-szumtyoxuxws branch from e80f723 to af9cda6 Compare April 12, 2025 03:27
@winterqt winterqt requested a review from yuja April 12, 2025 03:27
@winterqt
Copy link
Member Author

Alright, this should be good to go now; would appreciate one more review pass. Thanks for the help!

@winterqt winterqt force-pushed the push-szumtyoxuxws branch from af9cda6 to 7af06ee Compare April 13, 2025 06:17
@winterqt winterqt force-pushed the push-szumtyoxuxws branch from 7af06ee to d731c9c Compare April 13, 2025 21:06
This allows the customization of the duplicated commit descriptions.

An ideal use case for this is emulating `git cherry-pick -x`, as
illustrated in the tests.
@winterqt winterqt force-pushed the push-szumtyoxuxws branch from d731c9c to 0910a42 Compare April 13, 2025 21:16
@winterqt winterqt added this pull request to the merge queue Apr 13, 2025
Merged via the queue into jj-vcs:main with commit f3c4cc2 Apr 13, 2025
28 checks passed
@winterqt winterqt deleted the push-szumtyoxuxws branch April 13, 2025 22:01
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