<snip>

Just began hacking up a bit: here's a little script which imports
dpatch'es directly as git commits.

One thing I can't clearly figure out yet is the original author,
it doesnt seem to be a standard there (mbox-style patchfiles
would be much better here, IMHO), but thats not that important.


cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weig...@metux.de
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------
#!/bin/bash

[ "$AUTHOR" ] || AUTHOR="Debian Autoimport <weig...@metux.de>"

DPATCH_FILE=$1
if [ ! -f ${DPATCH_FILE} ]; then
    echo "$0 <dpatch file>"
    exit 1
fi

## retrieve the header of an dpatch file
dpatch_header() {
    local file=$1
    local hdr_lines=`grep -m 1 -n "@DPATCH@" < $file | head -n 1 | sed -E 
's~:.*~~; s~([0-9]*).*~\\1~;'`
    ((hdr_lines--))
    head -n "$hdr_lines" < $file | \
        grep -v "#! /bin/sh /usr/share/dpatch/dpatch-run" | \
        grep -vE 'All lines beginning with .## DP:. are a description of the 
patch.' | \
        sed -E 's~^## *~~; s~^DP: *~~'
}

TMP_HEADER=`mktemp`

(
    echo "(Debian) dpatch: $DPATCH_FILE"
    echo ""
    dpatch_header $DPATCH_FILE
) > $TMP_HEADER

git reset

if ! git apply --index $DPATCH_FILE ; then
    echo "git-apply failed: $DPATCH_FILE" >&2
    exit 1
fi

cat $TMP_HEADER

git commit --author="$AUTHOR" --allow-empty -F $TMP_HEADER

rm -f $TMP_HEADER
_______________________________________________
64studio-devel mailing list
64studio-devel@lists.64studio.com
http://lists.64studio.com/mailman/listinfo/64studio-devel

Reply via email to