How to downstream changes from Aesara #32
twiecki
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Here is a script that does it all: #!/bin/bash
if [ -z "$1" ]
then
echo "Usage: downstream_pr.sh <PR_number>"
echo "Will create a new branch, apply changes, and create a new PR"
exit 1
fi
set -e
git checkout main
git pull origin main
git checkout -b downstream_$1
echo "Downloading patch..."
wget -O $1.patch https://patch-diff.githubusercontent.com/raw/aesara-devs/aesara/pull/$1.patch
echo "Replacing aesara strings..."
declare -a replace_strings=(
"s/aesara/pytensor/g"
"s/Aesara/PyTensor/g"
# "s/import pytensor.tensor as at/import pytensor.tensor as pt/g"
"s/at\./pt./g"
# "s/from pytensor import tensor as pt/from pytensor import tensor as pt/g"
)
for replace in "${replace_strings[@]}"; do
find . -name "*$1.patch" -type f -exec sed -i -e "/png/!$replace" {} \;
done
echo "Applying patch..."
git am -3 --reject $1.patch
echo "Running pre-commit"
pre-commit run --all
git push origin downstream_$1
gh pr create --repo pymc-devs/pytensor --title "Downstreaming $1" --body "Downstreaming https://github.com/aesara-devs/aesara/pull/$1"
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
wget https://patch-diff.githubusercontent.com/raw/aesara-devs/aesara/pull/1285.patch
(you can just append.patch
to the URL of the PR).git am --reject -3 1285.patch
.reject
file. It is probably easiest to go in and change the pytensor code back to match with what the patch assumes andgit add
the changed file and thengit am --continue
to continue with the patch.Beta Was this translation helpful? Give feedback.
All reactions