Add pullrev.sh script.
This commit is contained in:
parent
57362d6ecd
commit
c5a1e6a57b
53
pullrev.sh
Executable file
53
pullrev.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "What?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
repo="https://svn.apache.org/repos/asf/subversion/trunk"
|
||||
#repo="https://svn.apache.org/repos/asf/subversion/branches/1.11.x"
|
||||
prefix=`rpmspec -q --queryformat='%{name}-%{version}\n' ./subversion.spec | sed 1q`
|
||||
suffix="r$1${2:++}"
|
||||
fn="${prefix}-${suffix}.patch"
|
||||
vcurl="http://svn.apache.org/viewvc?view=revision&revision="
|
||||
|
||||
if test -f ${fn}; then
|
||||
mv -v -f ${fn} ${fn}\~
|
||||
echo "# $0 $*" > ${fn}
|
||||
sed '1{/#.*pullrev/d;};/^--- /,$d' < ${fn}\~ >> ${fn}
|
||||
else
|
||||
echo "# $0 $*" > ${fn}
|
||||
fi
|
||||
|
||||
new=0
|
||||
for r in $*; do
|
||||
if ! grep -q "${vcurl}${r}" ${fn}; then
|
||||
echo "${vcurl}${r}"
|
||||
new=1
|
||||
fi
|
||||
done >> ${fn}
|
||||
|
||||
[ $new -eq 0 ] || echo >> ${fn}
|
||||
|
||||
prev=/dev/null
|
||||
for r in $*; do
|
||||
echo "+ fetching ${r}"
|
||||
this=`mktemp /tmp/pullrevXXXXXX`
|
||||
svn diff -c ${r} ${repo} | filterdiff --remove-timestamps --clean -x 'CHANGES' -x 'next-number' -x 'STATUS' \
|
||||
--addprefix="${prefix}/" > ${this}
|
||||
next=`mktemp /tmp/pullrevXXXXXX`
|
||||
combinediff --quiet ${prev} ${this} > ${next}
|
||||
rm -f "${this}"
|
||||
[ "${prev}" = "/dev/null" ] || rm -f "${prev}"
|
||||
prev=${next}
|
||||
done
|
||||
|
||||
cat ${prev} >> ${fn}
|
||||
|
||||
vi "${fn}"
|
||||
echo "+ git add ${fn}"
|
||||
git add "${fn}"
|
||||
echo "+ spec template:"
|
||||
echo "PatchN: ${fn}"
|
||||
echo "%patchN -p1 -b .${suffix}"
|
Loading…
Reference in New Issue
Block a user