diff options
Diffstat (limited to 'v4l/scripts/prep_commit_msg.pl')
-rwxr-xr-x | v4l/scripts/prep_commit_msg.pl | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl index f4047c6ba..cb0740a5d 100755 --- a/v4l/scripts/prep_commit_msg.pl +++ b/v4l/scripts/prep_commit_msg.pl @@ -1,5 +1,10 @@ #!/usr/bin/perl +my $diff = 'diff'; +if ($ARGV[0] eq '-q') { + $diff = 'qdiff'; + shift; +} my $autopatch = shift; # Get Hg username from environment @@ -45,13 +50,31 @@ if ($user eq "") { } print "# Added/removed/changed files:\n"; -system "hg diff | diffstat -p1 -c"; +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"; } +if ($diff eq 'qdiff') { + # Use existing mq patch logfile? + open IN, "hg qheader |"; + my @header = <IN>; + close IN; + + if ($#header > 0) { + # Use existing header + print @header; + exit; + } + # No header, use pre-made log message below + + # Hg will strip lines that start with "From: " from mq patch headers! + # In order to stop it, we insert this extra From line at the top, + # Hg will strip it and then leave the real from line alone. + print "From: $user\n\n"; +} print <<"EOF"; # # For better log display, please keep a blank line after subject, after from, |