summaryrefslogtreecommitdiff
path: root/v4l/scripts/do_commit.sh
blob: 4fa4e18471024d0754a590cf720c72b80e6cf31c (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
35
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"