diff options
Diffstat (limited to 'mailimport')
-rwxr-xr-x | mailimport | 80 |
1 files changed, 51 insertions, 29 deletions
diff --git a/mailimport b/mailimport index f1a64af35..b563eecd9 100755 --- a/mailimport +++ b/mailimport @@ -10,7 +10,12 @@ #2) hg mailqueue. It is easier to manage patches using mq, allowing to work with # the patches before applying to the tree. +#uncomment to use mq +#usemq=1 + +#uncomment to stop at the first error while testing a patch with --dry-run #exitonerror=1 + head=v4l/scripts/hghead.pl if [ "$1" == "" ]; then @@ -68,36 +73,53 @@ apply_patch () { fi done -# hg qnew doesn't support specifying a date -# date="`perl -ne '{ if ( s/^# Date: //) { print; } }' $TMP2`" -# echo "Patch date is $date" -# patch -s -t -p1 -l -N -d linux -i ../$next -# cd linux -# hg addremove `diffstat -p1 -l $next` -# cd .. - - name=`cat $next | perl -ne ' - if (s/Subject:\s+(.*)/$1/) { - m/\s*(.*)\s*\n/; - $_="$1"; - - tr/[A-Z]/[a-z]/; - s/[^a-z0-9]/_/g; - s/_+$//; - s/_+/_/g; - s/^v4l_dvb_\d+[a-z]*_//g; - - printf "%s.patch",$_; - exit; - }'` - - cat $next| grep -v "^#" >$TMPDIR/$name - - echo hg -m "`cat $TMP2|grep -v "^#"`" qnew $name - hg qnew -m "`cat $TMP2|grep -v "^#"`" $name - patch -s -t -p1 -l -N -d $pdir -i $next make whitespace - hg qrefresh + + committer=`grep "Committer:" $TMP2|sed s/"#Committer: "//` + + if [ "$usemq" != "" ]; then + name=`cat $next | perl -ne ' + if (s/Subject:\s+(.*)/$1/) { + m/\s*(.*)\s*\n/; + $_="$1"; + + tr/[A-Z]/[a-z]/; + s/[^a-z0-9]/_/g; + s/_+$//; + s/_+/_/g; + s/^v4l_dvb_\d+[a-z]*_//g; + + printf "%s.patch",$_; + exit; + }'` + + cat $next| grep -v "^#" >$TMPDIR/$name + + echo hg -m "`cat $TMP2|grep -v "^#"`" qnew $name + hg qnew -m "`cat $TMP2|grep -v "^#"`" $name + hg qrefresh + else + patch -s -t -p1 -l -N -d $pdir -i $next + if [ "$?" != "0" ]; then + echo "*** ERROR at: patch -s -t -p1 -l -N -d $pdir -i $next" + exit + fi + cur=`pwd` + cd $pdir + hg addremove `diffstat -p1 -l $next` + if [ "$?" != "0" ]; then + echo "*** ERROR at hg addremove" + exit + fi + # Commit the changed files + hg commit -u "$committer" -m "`cat $TMP2|grep -v "^#"`" `diffstat -p1 -l $next` + if [ "$?" != "0" ]; then + echo "*** ERROR at hg commit" + cd $cur + exit + fi + cd $cur + fi } echo git-mailsplit $MBOX $DIR |