contextlib2/dev/save_diff_snapshot.sh

28 lines
824 B
Bash
Raw Normal View History

#!/bin/sh
git_root="$(git rev-parse --show-toplevel)"
cpython_dir="${1:-$git_root/../cpython}"
diff_prefix="py3_12" # Update based on the version being synced
function diff_file()
{
diff -ud "$2" "$git_root/$3" > "$git_root/dev/${diff_prefix}_$1.patch"
}
diff_file rst_to_contextlib2 \
"$cpython_dir/Doc/library/contextlib.rst" "docs/contextlib2.rst"
diff_file py_to_contextlib2 \
"$cpython_dir/Lib/contextlib.py" "contextlib2/__init__.py"
diff_file pyi_to_contextlib2 \
"$git_root/dev/typeshed_contextlib.pyi" "contextlib2/__init__.pyi"
diff_file test_to_contextlib2 \
"$cpython_dir/Lib/test/test_contextlib.py" "test/test_contextlib.py"
diff_file test_async_to_contextlib2 \
"$cpython_dir/Lib/test/test_contextlib_async.py" "test/test_contextlib_async.py"