summaryrefslogtreecommitdiff
path: root/scripts/nvkm-am
blob: c61902c193113c4b500f000c6583b1dd2177356e (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
37
38
39
40
41
42
#!/bin/bash

APPLY="-p3 --include=drm/nouveau/*"
  LOG=(
       "drm/nouveau/\(.*\)\:" "\2\:"
       "drm/nouveau\:" "drm\:"
      )
 REPO=
 TEMP=`mktemp -d`

while getopts "Rc:" ARG; do
	case ${ARG} in
	R) APPLY="--directory=drivers/gpu --include=drivers/gpu/drm/nouveau/*"
	     LOG=(
		  "\(.*\)\:" "drm/nouveau/\2\:"
		  "drm/nouveau/drm\:" "drm/nouveau\:"
		 );;
	c)  REPO=${OPTARG};;
	?) exit 1;;
	esac
done
shift $(($OPTIND - 1))

if [[ ${REPO} != "" ]]; then
	pushd ${REPO}
	git format-patch -o ${TEMP} $1
	popd
else
	cp $@ ${TEMP}
fi
FILES=${TEMP}/*

for FILE in ${FILES}; do
	for (( i = 0; i < ${#LOG[@]}; i += 2)); do
		OLD=${LOG[$i + 0]}
		NEW=${LOG[$i + 1]}
		sed -i -e "s:^Subject\(.*\)] ${OLD}:Subject\1] ${NEW}:" ${FILE}
	done
done
git am -3 ${APPLY} ${FILES}

rm -rf ${TEMP}