/usr/bin/svnbackport is in kdesdk-scripts 4:17.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #!/bin/sh
# Backport the last change in HEAD, to a branch.
# Usage: svnbackport [-b branch] <file> [<file> ...]
#
# This is a port of the "cvsbackport" script:
# Initial author: Dirk Mueller
# Support for multiple command-line arguments, handling of patch rejects: David Faure
# Ported to SVN: Till Gerken
# Options and quote-safety: Matthew Woehlke
#
# This isn't the most sophisticated script ever, and might break. It needs to be
# used from within the repository so that it can guess the remote URL correctly.
#
#REPOSITORY=https://svn.kde.org/home/kde
usage() {
echo "Usage: $(basename $0) [-b <branch>] [-r <revision number>] <file> [<file> ...]"
echo " default branch is $DEF_BRANCH"
exit
}
DEF_BRANCH=4.9
BRANCH=$DEF_BRANCH
while getopts 'b:r:-:h' opt ; do
case $opt in
b) BRANCH="$OPTARG";;
r) REV="-r $OPTARG";;
*) usage;; # -h, --help will also trip this
esac
done
unset opt
shift `expr ${OPTIND} - 1`
[ -z "$*" ] && usage
export LC_ALL="C"
SRC_REMOTE="`svn info | sed -n '/URL:/s/^URL: //p'`"
TARGET_REMOTE="`echo $SRC_REMOTE | sed "s|trunk/KDE|branches/KDE/$BRANCH|"`"
echo "Backporting to $BRANCH"
TMPFILE=`mktemp svnbackport.XXXXXX` || exit 1
patchok=1
for file in "$@" ; do
echo "Looking for last change to $file..."
svnlastchange -ws $REV "$file" > $TMPFILE || exit 1
echo "Browsing last change to $file..."
less "$TMPFILE"
FILE_PATH="$file"
FROM_URL="$SRC_REMOTE/$file"
TO_URL="$TARGET_REMOTE/$file"
echo "Switching to branch..."
svn switch "$TO_URL" "$FILE_PATH" || exit 1
if patch "$FILE_PATH" "$TMPFILE"; then
rm -f "$TMPFILE"
echo "Showing diff for $file..."
svn diff "$FILE_PATH" | less
else
rm -f "$TMPFILE"
patchok=0
break
fi
done
if [ $patchok -eq 1 ]; then
echo "Do you want to commit all changes? (y/n) [y]"
read confirm
if [ -z "$confirm" ] || [ "`echo $confirm | cut -c 1 | tr Y y`" = "y" ] ; then
svn ci "$@"
else
echo "Aborted!" >&2
fi
else
echo -n "Patch failed! Press enter to revert changes and switch back to trunk: "
read confirm
for file in "$@" ; do
svn revert "$file"
done
fi
echo "Switching back to trunk..."
for file in "$@" ; do
svn switch "$SRC_REMOTE/$file" "$file"
done
|