From 7bc2a9de3848c0ea06877adcb53c29b9155840ef Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Mon, 12 Mar 2007 16:08:21 -0700 Subject: build: add a qrefresh target, like commit for use with mq Adds a qrefresh target to the top-level Makefile. It's like commit, but for use with the Hg mq extension. It will execute hg qrefresh, so you should have a current mq patch created with hg qnew already! It will run the whitespace and cardlist scripts. If you do not have a commit message from the current mq patch, it will create a default one, as make commit does. If one already exists, then it will put a comment at the beginning of the existing message with the current diffstat and a note of any changes the whitespace script made. The diffstat is done with qdiff, which will show the total diffstat of the patch instead of just the diffstat of from the last version of the patch to the current version. Signed-off-by: Trent Piepho --- v4l/scripts/prep_commit_msg.pl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'v4l/scripts/prep_commit_msg.pl') diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl index f4047c6ba..819009c57 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,25 @@ 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 = ; + close IN; + if ($#header > 0) { + # Use existing header + print @header; + exit; + } + # No header, use pre-made log message below +} print <<"EOF"; # # For better log display, please keep a blank line after subject, after from, -- cgit v1.2.3 From d99177342d725d7fbbd024245697d33c63952ed9 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Fri, 30 Mar 2007 17:37:53 -0700 Subject: build: Fix bug with make qrefresh From: Trent Piepho Annoyingly, the Hg mq extension will strip lines starting with "From: " from the patch header. Since the v4l-dvb format commit message contains a line starting with "From: ", it will mess them up. This changes prep_commit_msg to create a decoy "from" line to keep mq from messing up commit messages. Signed-off-by: Trent Piepho --- v4l/scripts/prep_commit_msg.pl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'v4l/scripts/prep_commit_msg.pl') diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl index 819009c57..cb0740a5d 100755 --- a/v4l/scripts/prep_commit_msg.pl +++ b/v4l/scripts/prep_commit_msg.pl @@ -62,12 +62,18 @@ if ($diff eq 'qdiff') { open IN, "hg qheader |"; my @header = ; 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"; # -- cgit v1.2.3