diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-08-16 10:24:21 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-08-16 10:24:21 -0300 |
commit | 4f97ebf2c76b8763da9f57e7ad6d1457fc97a2bd (patch) | |
tree | 3b589dddf7f7f04abdcdcf773e69a2a3dde0a1a6 | |
parent | 2020c904cc51965234736bfabc7769532a532fad (diff) | |
download | mediapointer-dvb-s2-4f97ebf2c76b8763da9f57e7ad6d1457fc97a2bd.tar.gz mediapointer-dvb-s2-4f97ebf2c76b8763da9f57e7ad6d1457fc97a2bd.tar.bz2 |
Properly handles commit messages with date: field
From: Mauro Carvalho Chehab <mchehab@infradead.org>
This patch allows a better support for third party patches. Now, it will
properly recognize and proccess messages with the following format:
Date: <some date>
From: <some developer>
Subject: <patch subject>
<body>
This will help to better proccess messages received via email.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | Makefile | 13 | ||||
-rwxr-xr-x | v4l/scripts/do_commit.sh | 36 | ||||
-rwxr-xr-x | v4l/scripts/hghead.pl | 12 |
3 files changed, 40 insertions, 21 deletions
@@ -19,18 +19,7 @@ install: $(MAKE) -C $(BUILD_DIR) $(MAKECMDGOALS) commit cvscommit hgcommit change changes changelog:: whitespace - @cd $(BUILD_DIR); scripts/cardlist; cd .. - @v4l/scripts/prep_commit_msg.pl $(TMP)/v4l_hg_whitespace > \ - $(TMP)/v4l_hg_commit.msg - @CHECKSUM=`md5sum "$(TMP)/v4l_hg_commit.msg"`; \ - $(EDITOR) $(TMP)/v4l_hg_commit.msg || exit $?; \ - echo "$$CHECKSUM" | md5sum -c --status && \ - echo "*** commit message not changed. Aborting. ***" \ - && exit 13 || exit 0 - $(BUILD_DIR)/scripts/hghead.pl $(TMP)/v4l_hg_commit.msg | grep -v '^#' | hg commit -l - - @echo "*** PLEASE CHECK IF LOG IS OK:" - @hg log -v -r -1 - @echo "*** If not ok, do \"hg rollback\" and \"make commit\" again" + @cd $(BUILD_DIR); scripts/cardlist; scripts/do_commit.sh $(EDITOR) $(TMP)/v4l_hg_whitespace; cd .. qrefresh: Q=q qrefresh:: whitespace diff --git a/v4l/scripts/do_commit.sh b/v4l/scripts/do_commit.sh new file mode 100755 index 000000000..4fa4e1847 --- /dev/null +++ b/v4l/scripts/do_commit.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +EDITOR=$1 +WHITESPCE=$2 + +if [ "$WHITESPCE" == "" ]; then + exit 13 +fi + +TMPMSG=$1 + +scripts/cardlist +scripts/prep_commit_msg.pl $WHITESPCE > $TMPMSG + +#trap 'rm -rf $TMPMSG' EXIT + +CHECKSUM=`md5sum "$TMPMSG"` +$EDITOR $TMPMSG || exit $? +echo "$CHECKSUM" | md5sum -c --status && echo "*** commit message not changed. Aborting. ***" && exit 13 +DATE="`scripts/hghead.pl $TMPMSG|perl -ne 'if (m/\#[dD]ate:\s+(.*)/) { print $1; }'`" + +if [ "$DATE" != "" ]; then + echo Patch date is $DATE + scripts/hghead.pl $TMPMSG| grep -v '^#' | hg commit -d "$DATE" -l - +else + scripts/hghead.pl $TMPMSG| grep -v '^#' | hg commit -l - +fi + +if [ "$?" != "0" ]; then + echo "Couldn't apply the patch" + exit 13 +fi + +echo "*** PLEASE CHECK IF LOG IS OK:" +hg log -v -r -1 +echo "*** If not ok, do \"hg rollback\" and \"make commit\" again" diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl index 7dd40380a..dc989dd61 100755 --- a/v4l/scripts/hghead.pl +++ b/v4l/scripts/hghead.pl @@ -1,6 +1,5 @@ #!/usr/bin/perl use strict; -use Date::Parse; ################################################################# # analyse diffs @@ -46,18 +45,13 @@ while ($line = <IN>) { last; } - if ($line =~ m/^# Date\s*(.*)/) { + if ($line =~ m/^#\s*Date\s*(.*)/) { print "#Date: $1\n"; + next; } if ($line =~ m/^Date:\s*(.*)/) { - my $time = str2time($1); - - if ($time) { - print "#Date: $time 0\n"; - } else { - print "#Date: $1\n"; - } + print "#Date: $1\n"; next; } |