[arch-projects] [devtools] [PATCH] commitpkg: Provide a commit message template

Dan McGee dpmcgee at gmail.com
Sat Aug 13 09:29:09 EDT 2011


On Friday, August 12, 2011, Lukas Fleischer <archlinux at cryptocrack.de>
wrote:
> Generate a message template when omitting the commit message (includes
> the same subject line that is used if a commit message is specified).
>
> Also, use two newlines to separate the subject line from the message
> body as it looks much clearer that way.
>
> Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
> ---
> I fully agree that this is a bit hacky. I really dislike the current
> behaviour of adding a header if a message is specified on the command
> line and not adding anything if you use an editor.

This gets a +1 from me (untested), it is crazy SVN makes this so hard to do.
>
> If anyone can come up with a better idea - suggestions welcome!
>
>  commitpkg |   21 ++++++++++++++++++---
>  1 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/commitpkg b/commitpkg
> index 07b0994..be40344 100755
> --- a/commitpkg
> +++ b/commitpkg
> @@ -109,11 +109,26 @@ if [ "$1" = "-a" ]; then
>  fi
>
>  echo -n 'committing changes to trunk...'
> +msgtemplate="upgpkg: $pkgbase $(get_full_version ${epoch:-0} $pkgver
$pkgrel)
> +
> +"
>  if [ -n "$1" ]; then
> -       svn commit -q -m "upgpkg: $pkgbase $(get_full_version ${epoch:-0}
$pkgver $pkgrel)
> -$1" || abort
> +       svn commit -q -m "${msgtemplate}${1}" || abort
>  else
> -       svn commit -q || abort
> +       msgfile="$(mktemp)"
> +       echo "$msgtemplate" > "$msgfile"
> +       if [ -n "$SVN_EDITOR" ]; then
> +               $SVN_EDITOR "$msgfile"
> +       elif [ -n "$VISUAL" ]; then
> +               $VISUAL "$msgfile"
> +       elif [ -n "$EDITOR" ]; then
> +               $EDITOR "$msgfile"
> +       else
> +               vi "$msgfile"
> +       fi
> +       [ -s "$msgfile" ] || abort
> +       svn commit -q -F "$msgfile" || abort
> +       unlink "$msgfile"
>  fi
>  echo 'done'
>
> --
> 1.7.6
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.archlinux.org/pipermail/arch-projects/attachments/20110813/ea59e50f/attachment.html>


More information about the arch-projects mailing list