Skip to content

Instantly share code, notes, and snippets.

@smondet
Last active January 19, 2021 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smondet/955171e33c23e5bcc5030552bc8937a8 to your computer and use it in GitHub Desktop.
Save smondet/955171e33c23e5bcc5030552bc8937a8 to your computer and use it in GitHub Desktop.
t16check () {
cat > /tmp/list-of-files.txt <<EOF
.gitlab/ci/opam.yml
CHANGES.md
src/lib_client_base/client_context.ml
src/lib_client_base/client_context.mli
src/lib_client_base_unix/client_config.ml
src/lib_client_base_unix/client_context_unix.ml
src/lib_client_base_unix/client_context_unix.mli
src/lib_client_base_unix/client_main_run.ml
src/lib_contract_metadata/.ocamlformat
src/lib_contract_metadata/dune
src/lib_contract_metadata/dune-project
src/lib_contract_metadata/metadata_contents.ml
src/lib_contract_metadata/metadata_contents.mli
src/lib_contract_metadata/metadata_uri.ml
src/lib_contract_metadata/metadata_uri.mli
src/lib_contract_metadata/micheline_helpers.ml
src/lib_contract_metadata/micheline_helpers.mli
src/lib_contract_metadata/tezos-contract-metadata.opam
src/proto_006_PsCARTHA/lib_client_commands/alpha_commands_registration.ml
src/proto_006_PsCARTHA/lib_client_commands/contract_metadata_commands.ml
src/proto_006_PsCARTHA/lib_client_commands/dune
src/proto_006_PsCARTHA/lib_client_commands/tezos-client-006-PsCARTHA-commands.opam
src/proto_007_PsDELPH1/lib_client_commands/alpha_commands_registration.ml
src/proto_007_PsDELPH1/lib_client_commands/contract_metadata_commands.ml
src/proto_007_PsDELPH1/lib_client_commands/dune
src/proto_008_PtEdoTez/lib_client_commands/alpha_commands_registration.ml
src/proto_008_PtEdoTez/lib_client_commands/contract_metadata_commands.ml
src/proto_008_PtEdoTez/lib_client_commands/dune
src/proto_008_PtEdoTez/lib_client_commands/tezos-client-008-PtEdoTez-commands.opam
src/proto_alpha/lib_client_commands/alpha_commands_registration.ml
src/proto_alpha/lib_client_commands/contract_metadata_commands.ml
src/proto_alpha/lib_client_commands/dune
src/proto_alpha/lib_client_commands/tezos-client-alpha-commands.opam
tezt/lib/process.ml
tezt/lib/process.mli
tezt/lib_tezos/client.ml
tezt/lib_tezos/client.mli
tezt/lib_tezos/constant.ml
tezt/lib_tezos/protocol.ml
tezt/manual_tests/migration.ml
tezt/tests/dune
tezt/tests/main.ml
tezt/tests/metadata_commands.ml
EOF
git diff --name-only smondet-contract-metadata origin/master > /tmp/diff-files.txt
diff /tmp/diff-files.txt /tmp/list-of-files.txt || {
echo "List of files not up to date" >&2
exit 2
}
}
t16branch () {
t16check
git checkout master
git branch -D smondet-tzip-016-implementation || echo ok
git checkout -b smondet-tzip-016-implementation -t origin/master --force
get_re () {
grep -E "$1" /tmp/list-of-files.txt | while read file ; do
mkdir -p "$(dirname "$file")"
git show "smondet-contract-metadata:$file" > "$file"
done
}
get_re '(.gitlab|src/lib_contract)'
git add .gitlab/ci src/lib_contract_metadata/
git commit -m 'TZIP-016: Add library `tezos-contract-metadata`'
get_re 'src/lib_client'
git add src/lib_client*
git commit -m 'Client: Add global configuration for IPFS-Gateway'
get_re 'src/proto_006'
git add src/proto_006*
git commit -m 'Client/006: Add TZIP-16 contract metadata commands'
get_re 'src/proto_007'
git add src/proto_007*
git commit -m 'Client/007: Add TZIP-16 contract metadata commands'
get_re 'src/proto_008'
git add src/proto_008*
git commit -m 'Client/008: Add TZIP-16 contract metadata commands'
get_re 'src/proto_alpha'
git add src/proto_alpha*
git commit -m 'Client/Alpha: Add TZIP-16 contract metadata commands'
get_re 'tezt/lib/process'
git add tezt/lib/process*
git commit -m 'Tezt: Add support for getting stderr'
get_re 'tezt/lib_tezos/(constant|client)'
git add tezt/lib_tezos/
git commit -m "$(printf "Tezt: Improve Client module\n\n\
- Make binary paths lists so that we can use \`[\"dune\"; \"exec\" ...]\`.\n\
- Add generic functions \`run_command_{full,or_fail}\`.\n\
")"
get_re 'tezt/lib_tezos/protocol'
git add tezt/lib_tezos/
get_re 'tezt/manual_tests/migration.ml'
git add tezt/manual_tests/
git commit -m 'Tezt: Add `Tezt.Protocol.{Edo,all}`'
get_re 'tezt/tests/'
git add tezt/tests
git commit -m 'Tezt/TZIP-016: Add tests for contract-metadata commands'
get_re 'CHANGES.md'
git add CHANGES.md
git commit -m 'Meta/TZIP-016: Add entry to CHANGES.md'
echo "============== Done ============"
git log --oneline origin/master..smondet-tzip-016-implementation
tmpbr=tmp-$(date "+%Y%m%d-%H%M%S")
echo "============== Switching to $tmpbr ============"
git checkout -b $tmpbr
echo "============== Diff should be empty ============"
git diff --name-only --exit-code smondet-contract-metadata smondet-tzip-016-implementation || {
echo "Something FAILED !!!" >&2
exit 2
}
}
ttdiff () {
printf "\nDiff between: \`{$1,$2}/$3\`\n"
tmp=$(mktemp)
diff "$1/$3" "$2/$3" > "$tmp" && {
echo "⇒ **Empty!**"
} || {
printf '\n```\n'
cat "$tmp"
printf '```\n\n→ '
return 2
}
}
t16props () {
t16check
ttdiff src/proto_006_PsCARTHA src/proto_007_PsDELPH1 \
lib_client_commands/alpha_commands_registration.ml
ttdiff src/proto_006_PsCARTHA src/proto_007_PsDELPH1 \
lib_client_commands/contract_metadata_commands.ml
ttdiff src/proto_alpha src/proto_007_PsDELPH1 \
lib_client_commands/alpha_commands_registration.ml || {
echo "Only sapling was added by Edo (master branch)."
}
ttdiff src/proto_alpha src/proto_007_PsDELPH1 \
lib_client_commands/contract_metadata_commands.ml || {
echo "A couple of RPC arguments changed."
}
ttdiff src/proto_alpha src/proto_008_PtEdoTez \
lib_client_commands/alpha_commands_registration.ml
ttdiff src/proto_alpha src/proto_008_PtEdoTez \
lib_client_commands/contract_metadata_commands.ml
}
if [ "$1" = "" ] ; then
build
else
"$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment