sapling/tests/translate
Jun Wu a381eddae1 tests: add a script to translate tests to Python
Summary:
The script does:
- Run the Python translate script.
  - With `--verify` so the test will be disabled if it does not pass.
  - With `--black` so the test file is formatted.
  - With `--hgmv` so the test is marked as a "rename", and `hg log` on it can
    trace back to the old history.
- Make a commit, so the manual edits are easier to review.

Reviewed By: xavierd

Differential Revision: D17609337

fbshipit-source-id: 0ce61e8a2e1a1d4424b1d3f15426f44a6fcaa739
2019-09-26 13:23:29 -07:00

34 lines
548 B
Bash
Executable File

#!/bin/bash
# Translate .t tests to .py tests.
# Usage:
# 1. ./translate test-foo.t
# 2. Edit test-foo-t.py
# 3. Commit
../hg debugpython -- -m testutil.dott.translate --black --verify --hgmv "$@" || exit 1
commitmessagepath="$(mktemp)"
cat > "$commitmessagepath" << EOF
[hg] tests: auto translate "$@"
Summary:
This is done by running:
./translate "$@"
Test Plan: CI
Reviewers: #mercurial
Tags: easy
EOF
finish() {
rm "$commitmessagepath"
}
trap finish EXIT
hg commit -l "$commitmessagepath" $(echo "$@" | sed 's#\.t#-t.py#g') "$@"