This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
from pathlib import Path | |
import re | |
import subprocess | |
changed_files = subprocess.check_output("git diff-tree --no-commit-id --name-status -r HEAD", shell=True) | |
changed_status = [line.split('\t') for line in changed_files.decode('utf-8').rstrip('\n').split('\n')] | |
changed_migrations = {fname for status, fname in changed_status | |
if '/migrations/' in fname and Path(fname).name[0].isdigit() and status != 'D'} |