Changeset 17273 in josm


Ignore:
Timestamp:
2020-10-27T14:50:10+01:00 (4 years ago)
Author:
GerdP
Message:

see #6529: Deleting locally referenced objects in conflict resolution breaks data integrity

  • Correct calculation of commands when a selection of conflicts is resolved to "my" or "their" version

The old code computed a list of commands before executing any of them. This fails when the execution of a command changes the data that is used by following commands. I don't know if this fixes all problems. I expected that these conflicts also require a special order, but there is no code to sort them. The displayed list doesn't seem to be ordered.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

    r17188 r17273  
    518518                        resolver.populate(c);
    519519                        resolver.decideRemaining(type);
    520                         commands.add(resolver.buildResolveCommand());
     520                        Command cmd = resolver.buildResolveCommand();
     521                        cmd.executeCommand(); // execute now, see #6529
     522                        commands.add(cmd);
    521523                    }
    522524                }
    523525            }
    524             UndoRedoHandler.getInstance().add(new SequenceCommand(name, commands));
     526            UndoRedoHandler.getInstance().add(new ResolveConflictsCommand(name, commands), false);
    525527            refreshView();
     528        }
     529    }
     530
     531    private static class ResolveConflictsCommand extends SequenceCommand {
     532        // just  a wrapper for already executed commands
     533        ResolveConflictsCommand(String name, Collection<Command> sequenz) {
     534            super(name, sequenz, true);
     535            setSequenceComplete(true);
    526536        }
    527537    }
Note: See TracChangeset for help on using the changeset viewer.