Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new_index = diff.indexes[1]
table = texttable.Texttable(max_width=0)
table.set_deco(texttable.Texttable.HEADER)
rows = []
rows.append(['Action', 'Path', 'Last deployed', 'By'])
file_rows = []
for add in diff.adds:
file_rows.append(cls._make_diff_row(
texttable.bcolors.GREEN, 'add', add))
for edit in diff.edits:
file_rows.append(cls._make_diff_row(
texttable.bcolors.PURPLE, 'edit', edit))
for delete in diff.deletes:
file_rows.append(cls._make_diff_row(
texttable.bcolors.RED, 'delete', delete))
file_rows.sort(key=lambda row: row[1])
rows += file_rows
table.add_rows(rows)
logging.info('\n' + table.draw() + '\n')
if last_index.deployed and last_index.deployed_by:
logging.info('Last deployed: {} by {}'.format(
last_index.deployed, cls._format_author(last_index.deployed_by)))
last_commit_sha = last_commit.sha if last_commit else ''
new_commit_sha = new_commit.sha if new_commit else ''
if new_index.deployed_by:
between_commits = '{}..{}'.format(
last_commit_sha[:7],
new_commit_sha[:7])
if new_commit:
if new_commit.has_unstaged_changes:
between_commits += ' (with unstaged changes)'