#!/usr/bin/env bash # --- T2-COPYRIGHT-BEGIN --- # t2/scripts/Apply # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 # --- T2-COPYRIGHT-END --- [ "$1" = -help ] && echo "Usage: " && exit 0 for f; do tmp= case "$f" in http*://*) tmp=$(mktemp) if ! curl -L "$f" > $tmp; then echo "failed to download $f" >&2 rm -f $tmp exit 1 fi f=$tmp esac for p in p1 p0; do # git apply patch --dry-run -$p < $f > /dev/null || continue patch -$p < $f && break done toadd=$(sed -n '/.* \(.*\)[[:space:]](nonexistent)/s//\1/p' < $tmp) [ "$toadd" ] && svn add --parents $toadd [ "$tmp" ] && rm -f $tmp done