Skip to content

Commit

Permalink
fixup! Update CHANGES.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrunn committed May 27, 2022
1 parent b86e83b commit 58c7e80
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/migrate-black.py
Expand Up @@ -5,14 +5,15 @@
import logging
import os
import sys
from collections import abc
from subprocess import check_output, run, Popen, PIPE


def git(*args):
def git(*args: abc.Iterable[str]) -> str:
return check_output(["git"] + list(args)).decode("utf8").strip()


def blackify(base_branch, black_command, logger):
def blackify(base_branch: str, black_command: str, logger: logging.Logger) -> int:
current_branch = git("branch", "--show-current")

if not current_branch or base_branch == current_branch:
Expand Down Expand Up @@ -70,13 +71,16 @@ def blackify(base_branch, black_command, logger):
],
stdin=git_diff.stdout,
)
git_diff.stdout.close()
if git_diff.stdout is not None:
git_diff.stdout.close()
git_apply.communicate()
git("commit", "--allow-empty", "-aqC", commit)

for commit in commits:
git("branch", "-qD", "%s-black" % commit)

return 0


if __name__ == "__main__":
import argparse
Expand Down

0 comments on commit 58c7e80

Please sign in to comment.