Description: Adds the --dep3 option to include a DEP-3 template in the header.
 .
 intensively using quilt for Debian packages and trying to adopt the
 DEP-3 Patch Tagging Guidelines for my patches, I often get to go on
 http://dep.debian.net/ to find the correct fields.
 .
 The proposed patch adds a --dep3 option to "quilt -e header" that
 adds a template feeded to $EDITOR iff the header is empty. The
 template contains all fields and documents them, with indications of
 required/optional.
 .
 With the "really soon now" adoption of 3.0 source packages, quilt
 will become more and more used and this small patch (which only
 _adds_ an option, so nothing mandatory) makes it easier to adopt
 DEP-3 headers in patches.
Origin:      vendor
Author:      Didier Raboud <didier@raboud.com>
Reviewed-by: Martin Quinson <mquinson@debian.org>
Forwarded: This is rather debian specific, I'd say
Last-Update: 2009-08-24
Bug-Debian: http://bugs.debian.org/543355


---
 quilt/header.in |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

Index: b/quilt/header.in
===================================================================
--- a/quilt/header.in
+++ b/quilt/header.in
@@ -19,7 +19,7 @@ fi
 
 usage()
 {
-	printf $"Usage: quilt header [-a|-r|-e] [--backup] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n"
+	printf $"Usage: quilt header [-a|-r|-e] [--backup] [--dep3] [--strip-diffstat] [--strip-trailing-whitespace] [patch]\n"
 
 	if [ x$1 = x-h ]
 	then
@@ -39,6 +39,10 @@ Print or change the header of the topmos
 
 --backup
 	Create a backup copy of the old version of a patch as patch~.
+
+--dep3
+	When editing (-e), insert a template with DEP-3 headers.
+	DEP-3 is http://dep.debian.net/deps/dep3/ Patch Tagging Guidelines.
 " "$EDITOR"
 		exit 0
 	else
@@ -66,7 +70,7 @@ maybe_strip_diffstat()
 	fi
 }
 
-options=`getopt -o areh --long backup,strip-trailing-whitespace,strip-diffstat -- "$@"`
+options=`getopt -o areh --long backup,dep3,strip-trailing-whitespace,strip-diffstat -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -90,6 +94,9 @@ do
 	--backup)
 		QUILT_BACKUP=1
 		shift ;;
+	--dep3)
+		opt_use_dep3_headers=1
+		shift ;;
 	--strip-diffstat)
 		opt_strip_diffstat=1
 		shift ;;
@@ -147,6 +154,19 @@ else
 		fi
 	) > $tmp
 
+        # If triggered and file is empty, cat dep-3 headers into it
+	if [ -n "$opt_use_dep3_headers" -a ! -s $tmp ]
+	then
+		( echo "Description: <Description of the patch (can span multiple lines) - required>"
+		  echo "Origin:      <{upstream,backport,vendor,other} [URL] - required except if Author is present>"
+		  echo "Bug-<Vendor>:<URL to the bug. Use Bug: for upstream bugs and Bug-Debian: for Debian bugs - optional>"
+		  echo "Forwarded:   <URL where the patch has been forwarded - optional>"
+		  echo "Author:      <Name and email of the patch author - optional>"
+		  echo "Reviewed-by: <Name and email of the patch reviewers - optional>"
+		  echo "Last-Update: <YYYY-MM-DD - optional>"
+                ) > $tmp
+        fi
+
 	if [ -n "$opt_edit" ]
 	then
 		LANG=$ORIGINAL_LANG sensible-editor "$tmp" || exit 1
