summaryrefslogtreecommitdiff
path: root/v4l/scripts/prep_commit_msg.pl
blob: ac958667b6c4734fcf7148035001bdb5cb2da556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl

$f=shift; 
open IN,"hg diff|diffstat -p1 |"; 
my $n=2;
my $from="";
my $first="";
my $changed="";
$out="";
while (<IN>) {
	$changed="$changed#$_";
}

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 below if you are not patch author\n#\nFrom: $user";
$out= "# At the end Signed-off-by: fields by patch author and committer, 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 below if the committer is not the patch author\n#\n%s\n\n" .
	"# Then a detailed description:\n\n\n%s",
	$changed,$from,$out;