mirror of
https://github.com/beetbox/beets.git
synced 2025-12-19 15:13:44 +01:00
parent
ecace62e14
commit
057ff66ad6
1 changed files with 9 additions and 2 deletions
|
|
@ -599,9 +599,9 @@ def show_model_changes(new, old=None, fields=None, always=False):
|
|||
"""
|
||||
old = old or new._db._get(type(new), new.id)
|
||||
|
||||
# Build up lines showing changed or new fields.
|
||||
# Build up lines showing changed fields.
|
||||
changes = []
|
||||
for field in old.keys() + list(set(new.keys()) - set(old.keys())):
|
||||
for field in old:
|
||||
# Subset of the fields. Never show mtime.
|
||||
if field == 'mtime' or (fields and field not in fields):
|
||||
continue
|
||||
|
|
@ -611,6 +611,13 @@ def show_model_changes(new, old=None, fields=None, always=False):
|
|||
if line:
|
||||
changes.append(u' {0}: {1}'.format(field, line))
|
||||
|
||||
# New fields.
|
||||
for field in set(new) - set(old):
|
||||
changes.append(u' {0}: {1}'.format(
|
||||
field,
|
||||
colorize('red', new._get_formatted(field))
|
||||
))
|
||||
|
||||
# Print changes.
|
||||
if changes or always:
|
||||
print_obj(old, old._db)
|
||||
|
|
|
|||
Loading…
Reference in a new issue