-
Notifications
You must be signed in to change notification settings - Fork 284
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
Adds support for providing custom PR string template in config #524
base: main
Are you sure you want to change the base?
Conversation
$bulleted_list | ||
''') | ||
else: | ||
body = string.Template(template) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "works" as in doesn't crash at runtime but none of the template variables are injected properly yet. Any ideas what I am doing wrong? Static strings are injected properly.
~/sl/bin/sl pr submit --config pr.template="$commit_msg\n$horizontal_rule\nStack created with [Sapling](https://sapling-scm.com).\n$bulleted_list"
results in
\n\nStack created with [Sapling](https://sapling-scm.com).\n
@@ -48,19 +50,28 @@ def create_pull_request_title_and_body( | |||
owner, name = repository.get_upstream_owner_and_name() | |||
pr = pr_numbers_and_num_commits[pr_numbers_index][0] | |||
reviewstack_url = f"https://reviewstack.dev/{owner}/{name}/pull/{pr}" | |||
if not template: | |||
body = string.Template(f''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This default template logic works as expected.
@quark-zju has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch! I hope eventually we can add two more patches
sl pr submit --edit
(or--interactive
) that will open your editor to type the PR's body- a config
pr.useUpstreamTemplate
that when used withsl pr s --edit
will prefill the editor with the repo's GitHub PR template (if the repo has a PR template)
Chatted with @quark-zju on Discord -- I should redo this PR using the native template engine https://discord.com/channels/1042527964224557107/1042527965256364157/1120945622892159078 https://github.com/facebook/sapling/blob/main/eden/scm/edenscm/cmdutil.py#L1080 |
Any updates on this, would nice to have |
In discussing with maintainers, I need to redo the PR using the template
framework that Sapling ships with. I honestly have no idea when I get
around to it. If you want to take a stab, feel free to do so.
Right now my primary usage of Sapling is in my own open source repo so I
haven’t needed the custom template stuff in a while.
…On Wed, Oct 25, 2023 at 09:31 Dillon Mulroy ***@***.***> wrote:
Any updates on this, would nice to have
—
Reply to this email directly, view it on GitHub
<#524 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AATRDMCEXOBER2WPSBLKBCDYBE5FZAVCNFSM6AAAAAAUTSWLX2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZZGY2DQNJVGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Adds support for providing custom PR string template in config
Stack created with Sapling. Best reviewed with ReviewStack.