diff options
author | Patrick Boettcher <pb@linuxtv.org> | 2006-07-04 17:58:23 +0200 |
---|---|---|
committer | Patrick Boettcher <pb@linuxtv.org> | 2006-07-04 17:58:23 +0200 |
commit | 8fbac88a9c801be025c283275f2eb6585a5cc454 (patch) | |
tree | bd82f6b1848d218e56f57805fdc569b9574e8089 /v4l/scripts/prep_commit_msg.pl | |
parent | c0b0560a9ed6e97eca6da5f8432c0dbb2fe471ad (diff) | |
parent | 54b507ede0a1c5349b47f84af7d3d0b417467e3a (diff) | |
download | mediapointer-dvb-s2-8fbac88a9c801be025c283275f2eb6585a5cc454.tar.gz mediapointer-dvb-s2-8fbac88a9c801be025c283275f2eb6585a5cc454.tar.bz2 |
sync with master
From: Patrick Boettcher <pb@linuxtv.org>
sync with master
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Diffstat (limited to 'v4l/scripts/prep_commit_msg.pl')
-rwxr-xr-x | v4l/scripts/prep_commit_msg.pl | 73 |
1 files changed, 49 insertions, 24 deletions
diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl index ac958667b..a4594c7f9 100755 --- a/v4l/scripts/prep_commit_msg.pl +++ b/v4l/scripts/prep_commit_msg.pl @@ -1,34 +1,59 @@ #!/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 $autopatch = shift; +# Get Hg username from environment my $user = $ENV{HGUSER}; -if ( $user eq "" ) { +# Didn't work? Try the .hgrc file +if ($user eq "") { + open IN, "<$ENV{HOME}/.hgrc"; + while (<IN>) { + if(/^\s*username\s*=\s*(\S.*)$/) { + $user = $1; + last; + } + } + close IN; +} + +# Still no luck? Try some other environment variables +if ($user eq "") { my $name = $ENV{CHANGE_LOG_NAME}; my $email = $ENV{CHANGE_LOG_EMAIL_ADDRESS}; + $user = "$name <$email>" if ($name ne "" || $email ne ""); +} + +# Last try to come up with something +if ($user eq "") { + $user = "$ENV{USER} <>"; +} - $user="$name <$email>"; +print "# Added/removed/changed files:\n"; +system "hg diff | diffstat -p1 -c"; +if (-s $autopatch) { + print "#\n# Note, a problem with your patch was detected! These changes were made\n"; + print "# automatically: $autopatch\n"; + system "diffstat -p0 -c $autopatch"; + print "#\n# Please review these changes and see if they belong in your patch or not.\n"; } +print <<"EOF"; +# +# For better log display, please keep a blank line after subject, after from, +# and before signed-off-by. +# First line should be the subject, without Subject: +# + + +# Now, patch author (just the main one), on a From: field +# Please change below if the committer is not the patch author. +# +From: $user + +# Then a detailed description: + -$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; +# At the end Signed-off-by: fields by patch author and committer, at least. +# +Signed-off-by: $user +EOF |