diff --git a/releasenotes/notes/fix-delete-handling-55232c50b647aa57.yaml b/releasenotes/notes/fix-delete-handling-55232c50b647aa57.yaml new file mode 100644 index 0000000..eaca402 --- /dev/null +++ b/releasenotes/notes/fix-delete-handling-55232c50b647aa57.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Correct a problem with handling deleted release notes that + triggered a TypeError with a message like "Can't mix strings and + bytes in path components" \ No newline at end of file diff --git a/reno/scanner.py b/reno/scanner.py index 2df1166..2f1587a 100644 --- a/reno/scanner.py +++ b/reno/scanner.py @@ -176,7 +176,7 @@ class _ChangeAggregator(object): path = c.old.path.decode('utf-8') if c.old.path else None if _note_file(path): uid = _get_unique_id(path) - by_uid[uid].append((c.type, path)) + by_uid[uid].append((c.type, path, sha)) else: LOG.debug('ignoring') elif c.type == diff_tree.CHANGE_MODIFY: @@ -1013,7 +1013,7 @@ class Scanner(object): tracker.add(fullpath, sha, current_version) elif c_type == diff_tree.CHANGE_DELETE: - path = change[-1] + path, blob_sha = change[-2:] fullpath = os.path.join(notesdir, path) tracker.delete(fullpath, sha, current_version) diff --git a/reno/tests/test_scanner.py b/reno/tests/test_scanner.py index 486d1a0..a9f8a36 100644 --- a/reno/tests/test_scanner.py +++ b/reno/tests/test_scanner.py @@ -1883,7 +1883,7 @@ class AggregateChangesTest(Base): ] results = list(self.aggregator.aggregate_changes(entry, changes)) self.assertEqual( - [('%016x' % n, 'delete', name)], + [('%016x' % n, 'delete', name, entry.commit.id)], results, )