Only consider added migrations

This commit is contained in:
Felix Bauer authored and David-Wobrock committed 2018-01-18 21:45:27 +01:00
1 parent ced0b8c3ef
commit 5bef4e7a17
1 file changed
+3 -3
+3 -3
View File
@@ -152,16 +152,16 @@ class MigrationLinter(object):
def _gather_migrations_git(self, git_commit_id):
migrations = []
# Get changes since specified commit
git_diff_command = 'cd {0} && git diff --name-only {1}'.format(
git_diff_command = 'cd {0} && git diff --name-status {1}'.format(
self.django_path, git_commit_id)
log.info('Executing {0}'.format(git_diff_command))
diff_process = Popen(
git_diff_command, shell=True, stdout=PIPE, stderr=PIPE)
for line in map(
utils.clean_bytes_to_str, diff_process.stdout.readlines()):
# Only gather lines that include migrations
# Only gather lines that include added migrations
if re.search(
'\/{0}\/.*\.py'.format(self.MIGRATION_FOLDER_NAME),
'^A.*\/{0}\/.*\.py'.format(self.MIGRATION_FOLDER_NAME),
line) and \
'__init__' not in line:
app_name, migration_name = self._split_migration_path(line)