use _show_model_changes in mbsync

This commit is contained in:
Adrian Sampson 2014-02-22 14:37:04 -08:00
parent ace34a8654
commit 58dd5f47f5

View file

@ -1,5 +1,5 @@
# This file is part of beets.
# Copyright 2013, Jakob Schnitzer.
# Copyright 2014, Jakob Schnitzer.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@ -28,18 +28,10 @@ def _print_and_apply_changes(lib, item, old_data, move, pretend, write):
"""Apply changes to an Item and preview them in the console. Return
a boolean indicating whether any changes were made.
"""
changes = {}
for key in library.ITEM_KEYS_META:
if key in item._dirty:
changes[key] = old_data[key], getattr(item, key)
if not changes:
changed = ui.commands._show_model_changes(item)
if not changed:
return False
# Something changed.
ui.print_obj(item, lib)
for key, (oldval, newval) in changes.iteritems():
ui.commands._showdiff(key, oldval, newval)
# If we're just pretending, then don't move or save.
if not pretend:
# Move the item if it's in the library.