From 605f1e11883603ebdff5393dba81e084dbd41f12 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 27 Jun 2008 10:30:04 -0300 Subject: Fix a few bugs at the script From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/hghead.pl | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'v4l/scripts') diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 6f8a814ad..7eacd7019 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -130,12 +130,8 @@ while ($line = ) { next; } - if ($line =~ m/^[a-zA-Z\-]*:/) { - if ($line =~ m/Changeset:\s*(.*)\n/) { - $num=$1; - } - print "# $line"; - next; + if ($tag =~ m/changeset:\s*(.*)\n/) { + $num=$1; } if ($line =~ m|^(V4L\/DVB\s*\(.+\)\s*:.*\n)|) { @@ -155,13 +151,8 @@ while ($line = ) { if ($subject =~ m|V4L\/DVB\s*(.+)|) { $subject=$1; } - if ($hgimport) { - $subject=$line; - next; - } - if ($line =~ m/^\n/) { - next; - } + $subject=$line; + next; } if ($noblank) { @@ -191,11 +182,17 @@ if (!$signed =~ m/$from/) { die; } -$body="$from\n$body"; -$body=~s/[\n\s]+$//; +$from=~s/^[\n\s]+//; +$from=~s/[\n\s]+$//; + +$subject=~s/^[\n\s]+//; +$subject=~s/[\n\s]+$//; + +$body="$body\n\n$signed"; + $body=~s/^[\n\s]+//; +$body=~s/[\n\s]+$//; # First from is used by hg to recognize commiter name print "#Committer: $maintainer_name <$maintainer_email>\n"; -print "$subject\n$body\n\n$signed"; - +print "$subject\n\n$from\n\n$body\n"; -- cgit v1.2.3 From b171b4bf6091c1b3482b7ac3c14e1672f10c6950 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 27 Jun 2008 11:19:39 -0300 Subject: Improves commit message scripts From: Mauro Carvalho Chehab This patch improves message description sanity rules: - mailimport now prefers to edit using editdiff. This helps to fix trivial CodingStyle errors at receive patches; - hghead.pl will now remove blank whitespaces if no body exists; - "make commit" will now run hghead.pl. This will do some sanity checks at commit messages: *) Will warrant that "from:" metatag exists, avoiding to have patches without proper authorship id at someone's else tree; *) Will order the tags at the expected way (subject, from, body, signatures); *) Will warrant that one and just one blank line exists between each of the four parts of the commit message. Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/hghead.pl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'v4l/scripts') diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 7eacd7019..02295bcef 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -188,6 +188,9 @@ $from=~s/[\n\s]+$//; $subject=~s/^[\n\s]+//; $subject=~s/[\n\s]+$//; +$body=~s/^[\n\s]+//; +$body=~s/[\n\s]+$//; + $body="$body\n\n$signed"; $body=~s/^[\n\s]+//; -- cgit v1.2.3