diff mbox

[maintainer-tools,v3] dim: Add pull request tag template

Message ID 20170503153013.318-1-seanpaul@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Paul May 3, 2017, 3:30 p.m. UTC
Each pull request is accompanied by a summary that is stored in the git tag
from which it is generated. These summaries all share the same template with
headers classifying changes to UAPI, Cross-subsystem, Core, and Drivers. This
patch adds this template to the tag summary automatically in dim pull-request.

Changes in v2:
  - Tweaked the template var name s/PULL/TAG/ (Daniel)
Changes in v3:
  - Use git tag -F- to ingest template (Jani)
  - Tweak naming/comments again to hopefully clarify things (Jani)

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 dim     | 25 +++++++++++++++++++++++--
 dim.rst |  4 ++++
 2 files changed, 27 insertions(+), 2 deletions(-)

Comments

Jani Nikula May 4, 2017, 8:07 a.m. UTC | #1
On Wed, 03 May 2017, Sean Paul <seanpaul@chromium.org> wrote:
> Each pull request is accompanied by a summary that is stored in the git tag
> from which it is generated. These summaries all share the same template with
> headers classifying changes to UAPI, Cross-subsystem, Core, and Drivers. This
> patch adds this template to the tag summary automatically in dim pull-request.
>
> Changes in v2:
>   - Tweaked the template var name s/PULL/TAG/ (Daniel)
> Changes in v3:
>   - Use git tag -F- to ingest template (Jani)
>   - Tweak naming/comments again to hopefully clarify things (Jani)
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Pushed, thanks.

BR,
Jani.

> ---
>  dim     | 25 +++++++++++++++++++++++--
>  dim.rst |  4 ++++
>  2 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/dim b/dim
> index 8937803..baa0b38 100755
> --- a/dim
> +++ b/dim
> @@ -67,6 +67,9 @@ DIM_TEMPLATE_HELLO=${DIM_TEMPLATE_HELLO:-$HOME/.dim.template.hello}
>  # signature pull request template
>  DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature}
>  
> +# dim pull-request tag summary template
> +DIM_TEMPLATE_TAG_SUMMARY=${DIM_TEMPLATE_TAG_SUMMARY:-$HOME/.dim.template.tagsummary}
> +
>  #
>  # Internal configuration.
>  #
> @@ -1501,6 +1504,24 @@ function dim_tag_next
>  
>  }
>  
> +function prep_pull_tag_summary
> +{
> +	if [ -r $DIM_TEMPLATE_TAG_SUMMARY ]; then
> +		cat $DIM_TEMPLATE_TAG_SUMMARY
> +	else
> +		cat <<-EOF
> +		UAPI Changes:
> +
> +		Cross-subsystem Changes:
> +
> +		Core Changes:
> +
> +		Driver Changes:
> +
> +		EOF
> +	fi
> +}
> +
>  # dim_pull_request branch upstream
>  function dim_pull_request
>  {
> @@ -1533,9 +1554,9 @@ function dim_pull_request
>  		while git tag -l $tag | grep -q $tag ; do
>  			tag="$branch-$today-$((++suffix))"
>  		done
> -
>  		gitk "$branch@{upstream}" ^$upstream &
> -		$DRY git tag -a $tag "$branch@{upstream}"
> +		prep_pull_tag_summary | $DRY git tag -F- $tag "$branch@{upstream}"
> +		$DRY git tag -a -f $tag
>  		$DRY git push $remote $tag
>  		prep_pull_mail $req_file $tag
>  
> diff --git a/dim.rst b/dim.rst
> index 3dd19f9..10572f1 100644
> --- a/dim.rst
> +++ b/dim.rst
> @@ -464,6 +464,10 @@ DIM_TEMPLATE_SIGNATURE
>  ----------------------
>  Path to a file containing a signature template for pull request mails.
>  
> +DIM_TEMPLATE_TAG_SUMMARY
> +-------------------------
> +Path to a file containing the template for dim pull-request tag summaries.
> +
>  dim_alias_<alias>
>  -----------------
>  Make **<alias>** an alias for the subcommand defined as the value. For example,
diff mbox

Patch

diff --git a/dim b/dim
index 8937803..baa0b38 100755
--- a/dim
+++ b/dim
@@ -67,6 +67,9 @@  DIM_TEMPLATE_HELLO=${DIM_TEMPLATE_HELLO:-$HOME/.dim.template.hello}
 # signature pull request template
 DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature}
 
+# dim pull-request tag summary template
+DIM_TEMPLATE_TAG_SUMMARY=${DIM_TEMPLATE_TAG_SUMMARY:-$HOME/.dim.template.tagsummary}
+
 #
 # Internal configuration.
 #
@@ -1501,6 +1504,24 @@  function dim_tag_next
 
 }
 
+function prep_pull_tag_summary
+{
+	if [ -r $DIM_TEMPLATE_TAG_SUMMARY ]; then
+		cat $DIM_TEMPLATE_TAG_SUMMARY
+	else
+		cat <<-EOF
+		UAPI Changes:
+
+		Cross-subsystem Changes:
+
+		Core Changes:
+
+		Driver Changes:
+
+		EOF
+	fi
+}
+
 # dim_pull_request branch upstream
 function dim_pull_request
 {
@@ -1533,9 +1554,9 @@  function dim_pull_request
 		while git tag -l $tag | grep -q $tag ; do
 			tag="$branch-$today-$((++suffix))"
 		done
-
 		gitk "$branch@{upstream}" ^$upstream &
-		$DRY git tag -a $tag "$branch@{upstream}"
+		prep_pull_tag_summary | $DRY git tag -F- $tag "$branch@{upstream}"
+		$DRY git tag -a -f $tag
 		$DRY git push $remote $tag
 		prep_pull_mail $req_file $tag
 
diff --git a/dim.rst b/dim.rst
index 3dd19f9..10572f1 100644
--- a/dim.rst
+++ b/dim.rst
@@ -464,6 +464,10 @@  DIM_TEMPLATE_SIGNATURE
 ----------------------
 Path to a file containing a signature template for pull request mails.
 
+DIM_TEMPLATE_TAG_SUMMARY
+-------------------------
+Path to a file containing the template for dim pull-request tag summaries.
+
 dim_alias_<alias>
 -----------------
 Make **<alias>** an alias for the subcommand defined as the value. For example,