fix the way we handle deleted notes
The aggregated change information for a deleted note includes the SHA as well as the filename. Extract both from the tuple separately so the path value is set correctly to a filename. Change-Id: I41fb4a7a0f6d24af47c8f059945b9bf45f859f15 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
e3dcbdd582
commit
5cefb37405
@ -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"
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user