summaryrefslogtreecommitdiff
path: root/v4l/scripts/prep_commit_msg.pl
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/scripts/prep_commit_msg.pl')
-rwxr-xr-xv4l/scripts/prep_commit_msg.pl55
1 files changed, 24 insertions, 31 deletions
diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl
index 239fb6092..9c4447313 100755
--- a/v4l/scripts/prep_commit_msg.pl
+++ b/v4l/scripts/prep_commit_msg.pl
@@ -1,41 +1,34 @@
#!/usr/bin/perl
$f=shift;
-open IN,"<$f";
+open IN,"hg diff|diffstat -p1 |";
my $n=2;
my $from="";
my $first="";
my $changed="";
$out="";
while (<IN>) {
- if (m/^[0-9]/) {
- $n--;
- next;
- }
- if ($n>0) {
- s/[\t -]*//;
- if (m/^\* (.*):/) {
- $changed="#\t$1\n$changed";
- } else {
- if ($first eq "") {
- if ($_ eq "\n") {
- next;
- }
- $first="$_";
- next;
- }
- if ($from eq "") {
- if (m/Signed-off-by:/) {
- $from = $_;
- $from =~ s/Signed-off-by/From/;
- $first="$first\n#\n# Then From line\n$from\n";
- }
- }
- $out="$out$_";
- }
- }
+ $changed="$changed#$_";
}
-printf "#Added/removed/changed files:\n%s" .
- "# First line should be the subject, without Subject:\n%s" .
- "# Then a detailed description followed by Signed-off-by: fields:\n%s",
- $changed,$first,$out;
+
+my $user = $ENV{HGUSER};
+
+if ( $user eq "" ) {
+ my $name = $ENV{CHANGE_LOG_NAME};
+ my $email = $ENV{CHANGE_LOG_EMAIL_ADDRESS};
+
+ $user="$name <$email>";
+}
+
+$first= "# Please change bellow if you are not patch author\n#\nFrom: $user";
+$out= "# At the end Signed-off-by: fields by patch author and commiter, at least\n#\nSigned-off-by: $user";
+$from= "From: $user";
+
+printf "#Added/removed/changed files:\n%s#\n" .
+ "# For better log display, please keep a blank line after subject, after from\n" .
+ "# and before signed-off-by\n" .
+ "# First line should be the subject, without Subject:\n#\n\n\n" .
+ "# Now, patch author (just the main one), on a From: field\n" .
+ "# Please change bellow if the commiter is not the patch author\n#\n%s\n\n" .
+ "# Then a detailed description:\n\n\n%s",
+ $changed,$from,$out;