edit: Correctly reset the old object, do not reload it from the tags

Previously, if continuing to edit (i.e. invoking the $EDITOR) multiple
times in one invocation of EditPlugin.edit_objects, the plugin would
reload the old state from the file tags. The initial 'old state' is
usually only loaded from the database, though. As a consequence, if
database and tags were not in sync, the diffs from first and all
subsequent edits could differ unexpectedly.
This commit is contained in:
wordofglass 2017-08-24 13:07:20 +02:00
parent e983929e52
commit 989845199b

View file

@ -302,9 +302,14 @@ class EditPlugin(plugins.BeetsPlugin):
elif choice == u'c': # Cancel.
return False
elif choice == u'e': # Keep editing.
# Reset the temporary changes to the objects.
# Reset the temporary changes to the objects. I we have a
# deepcopy from above, use that, else reload from the
# database.
objs = [(old_obj or obj)
for old_obj, obj in zip(objs_old, objs)]
for obj in objs:
obj.read()
if obj._db:
obj.load()
continue
# Remove the temporary file before returning.