Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion scripts/apply_patches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ CDIR="$(cd "$(dirname "$0")" ; pwd -P)"
XDIR=$CDIR/..
PTDIR=$XDIR/..

TORCH_PIN="$XDIR/torch_patches/.torch_pin"
if [ -f "$TORCH_PIN" ]; then
CID=$(cat "$TORCH_PIN")
# If starts with # and it's not merged into master, fetch from origin
if [[ $CID = \#* ]]; then
PRNUM="${CID//[!0-9]/}"
set +x
MCHECK=$(git -C $PTDIR log -1000)
if [[ $MCHECK != *"Pull Request resolved: https://github.com/pytorch/pytorch/pull/$PRNUM"* ]]; then
echo "Fetching PyTorch PR #$PRNUM"
pushd "$PTDIR"
git fetch origin "pull/$PRNUM/head:$PRNUM"
git checkout "$PRNUM"
popd
fi
set -x
elif [[ "$CID" != "" ]]; then
echo 'Checking out branch $CID'
pushd "$PTDIR"
git fetch origin "$CID"
git checkout "$CID"
popd
fi
fi

python $CDIR/cond_patch.py \
$XDIR/torch_patches \
$PTDIR
$PTDIR
16 changes: 15 additions & 1 deletion torch_patches/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Guidelines For Patch File Names

The only files which are considered by the apply script are the ones with extension '.diff'.
Files with extension '.diff' are consider as git patches by apply script.

A file for PyTorch PR _N_ needs to be named 'N.diff'.

Expand All @@ -15,3 +15,17 @@ X10-optimizer.diff
Patch file are alphabetically ordered, so PyTorch PR patches are always applied
before the non PyTorch ones.


There's a special file `torch_patches/.torch_pin`, which is used to coordinate landing PRs in
`pytorch/pytorch` and `pytorch/xla`.

To test a `pytorch/xla` PR against a `pytorch/pytorch` PR or branch,
put the PR number or branch name in this file.
Example:

```
#32451
# or
my_awesome_branch # (must live in `pytorch/pytorch`)
```