Skip to contentSkip to conversation

b4 ty feature requests

DISCUSSION Mark Brown 2 participants 8 messages Apr 17, 2020 – Apr 20, 2020

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

I've started using b4 ty to generate thanks mails in production and it seems to be working very well for me so far, thanks!

One thing that would be nice would be mechanism to supply some additional values to be filled in the templates - I want to be able to tell people what tree and branch I applied things to. A command line option to set the templates might also work but would be clunkier for me.

Thanks,
Mark

#1 lore raw
Quoted 2 lines · Mark Brown

I've started using b4 ty to generate thanks mails in production and it seems to be working very well for me so far, thanks!

Excellent. Thanks for helping iron out the kinks.

Quoted 5 lines

One thing that would be nice would be mechanism to supply some additional values to be filled in the templates - I want to be able to tell people what tree and branch I applied things to. A command line option to set the templates might also work but would be clunkier for me.

Branch would be easy, e.g.:

---
Applied to ${branch}, thanks!
---

I'm not sure how to convey the tree information. Would it be a sane approach to try to use current dirname as default, overridable via a b4.thanks-tree-name value? E.g.:

---
Applied to ${treename} ${branch} branch, thanks!
---

Becomes:

---
Applied to spi.git for-next branch, thanks!
---

-K

author Applied
#2 lore raw
Quoted 14 lines · Konstantin Ryabitsev
Quoted 5 lines · Mark Brown

One thing that would be nice would be mechanism to supply some additional values to be filled in the templates - I want to be able to tell people what tree and branch I applied things to. A command line option to set the templates might also work but would be clunkier for me.

Branch would be easy, e.g.:

---
Applied to ${branch}, thanks!
---

Quoted 7 lines

I'm not sure how to convey the tree information. Would it be a sane approach to try to use current dirname as default, overridable via a b4.thanks-tree-name value? E.g.:

---
Applied to ${treename} ${branch} branch, thanks!
---

That wouldn't work well for me since I have a single repo with multiple remotes - I'm invoking b4 as:

b4 ty -b remote/branch -a

so I'd need to switch out the config file to update the variable for the tree name and the branch name would I think come out wrong. People probably would mostly understand the short names I use for my remotes so it wouldn't be the end of the world to just say ${branch} and have it show up as remote/branch but I know inexperienced contributors sometimes find figuring out exactly which tree you mean a bit confusing so the URL is useful for them.

In that particular usage b4 could parse out the fact that it's a remote based on asking git-remote if the thing before the first / is a remote and use the info from that to rewrite such that the branch gets expanded into a GIT URL plus branch but that may be a bit too much DWIM. You'd get something like

	b4 ty -b asoc/for-5.8 -a

with a template of

	Applied to ${branch}

generating

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.8

TBH I'd personally be happy just specifying variables I name on the command line (the actual b4 invocation is scripted for me) and that's what I'd been imagining, although something more fancy would be very nice.

#3 lore raw
Quoted 4 lines · Mark Brown
Quoted 3 lines

I'm not sure how to convey the tree information. Would it be a sane approach to try to use current dirname as default, overridable via a b4.thanks-tree-name value? E.g.:

Quoted 8 lines
Quoted 3 lines

---
Applied to ${treename} ${branch} branch, thanks!
---

That wouldn't work well for me since I have a single repo with multiple remotes - I'm invoking b4 as:

b4 ty -b remote/branch -a

Ah, excellent data point. How about we approach it from a slightly different angle. We already allow setting a per-repo "thanks-commit-url-mask", but how about also a way to record that in the remote section of .git/config, e.g.:

[remote "foo"]
url = [email protected]:pub/scm/linux/kernel/git/foo/linux fetch = +refs/heads/*:refs/remotes/foo/*
b4-treename = "foo/linux.git"
b4-commit-url-mask = "https://git.kernel.org/foo/c/%.8s"

With a template:

---
Applied to ${treename} ${branch}:

${summary}
---

This way when you do b4 ty -b foo/for-5.8 -a, you get:

---
Applied to foo/linux.git for-5.8:

[1/2] doc: importance of being foo

      https://git.kernel.org/foo/c/1234abcd
[2/2] drivers/foo: make sure to instantiate foo
      https://git.kernel.org/foo/c/abcd1234

---

Would that work?

-K

author
#4 lore raw
Quoted 5 lines · Konstantin Ryabitsev

Ah, excellent data point. How about we approach it from a slightly different angle. We already allow setting a per-repo "thanks-commit-url-mask", but how about also a way to record that in the remote section of .git/config, e.g.:

Quoted 7 lines

[remote "foo"]
url = [email protected]:pub/scm/linux/kernel/git/foo/linux fetch = +refs/heads/*:refs/remotes/foo/*
b4-treename = "foo/linux.git"
b4-commit-url-mask = "https://git.kernel.org/foo/c/%.8s"

Would that work?

I think so, yes - the treename could even default to either url or the remote name so a lot of the time it'd not even need to be set.

One thing to watch out for is that you can name branches foo/bar without them being remotes so just because there's a / that doesn't mean the branch is a remote branch.

#5 lore raw
Quoted 6 lines · Mark Brown
Quoted 5 lines

[remote "foo"]
url = [email protected]:pub/scm/linux/kernel/git/foo/linux fetch = +refs/heads/*:refs/remotes/foo/*
b4-treename = "foo/linux.git"
b4-commit-url-mask = "https://git.kernel.org/foo/c/%.8s"

Quoted 8 lines
Quoted 1 line

Would that work?

I think so, yes - the treename could even default to either url or the remote name so a lot of the time it'd not even need to be set.

One thing to watch out for is that you can name branches foo/bar without them being remotes so just because there's a / that doesn't mean the branch is a remote branch.

I committed a change that should do the above (with proper precautions). Please try it out (see .example files for ${branch} and ${treename} usage examples).

-K

author
#6 lore raw
Quoted 9 lines · Konstantin Ryabitsev
Quoted 3 lines · Mark Brown

One thing to watch out for is that you can name branches foo/bar without them being remotes so just because there's a / that doesn't mean the branch is a remote branch.

I committed a change that should do the above (with proper precautions). Please try it out (see .example files for ${branch} and ${treename} usage examples).

This all seems to be working great, thanks!

#7 lore raw
Quoted 10 lines · Mark Brown
Quoted 8 lines
Quoted 4 lines

One thing to watch out for is that you can name branches foo/bar without
them being remotes so just because there's a / that doesn't mean the branch is a remote branch.

I committed a change that should do the above (with proper precautions). Please try it out (see .example files for ${branch} and ${treename} usage examples).

This all seems to be working great, thanks!

Good to hear. I'll probably release 0.4.0 with this set of features some time mid-week.

-K