| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -ueo pipefail |
| 4 |
FILE=$1 |
| 5 |
|
| 6 |
echo "will update $FILE" |
| 7 |
|
| 8 |
echo $LINENO $? |
| 9 |
pyupgrade --py36-plus --exit-zero-even-if-changed $FILE |
| 10 |
|
| 11 |
echo $LINENO $? |
| 12 |
git commit -am"Apply pyupgrade to $FILE |
| 13 |
|
| 14 |
pyupgrade --py36-plus $FILE |
| 15 |
|
| 16 |
To ignore those changes when using git blame see the content of |
| 17 |
.git-blame-ignore-revs" |
| 18 |
|
| 19 |
HASH=$(git rev-parse HEAD) |
| 20 |
|
| 21 |
echo "$HASH # apply pyupgrade to $FILE" >> .git-blame-ignore-revs |
| 22 |
|
| 23 |
git commit -am'Update .git-blame-ignore-revs with previous commit' |
| 24 |
|
| 25 |
##### |
| 26 |
|
| 27 |
black --target-version py36 $FILE |
| 28 |
|
| 29 |
|
| 30 |
git commit -am"Apply black to $FILE |
| 31 |
|
| 32 |
black --target-version py36 $FILE |
| 33 |
|
| 34 |
To ignore those changes when using git blame see the content of |
| 35 |
.git-blame-ignore-revs" |
| 36 |
|
| 37 |
HASH=$(git rev-parse HEAD) |
| 38 |
|
| 39 |
echo "$HASH # apply black to $FILE" >> .git-blame-ignore-revs |
| 40 |
|
| 41 |
git commit -am'Update .git-blame-ignore-revs with previous commit' |
| 42 |
|
| 43 |
echo |
| 44 |
echo "Updating, reformatting and adding to .git-blame-ignore-revs successful" |
| 45 |
|
| 46 |
|