JOSM/Plugins/Reverter

From OpenStreetMap Wiki
< JOSM‎ | Plugins(Redirected from JOSM reverter)
Jump to navigation Jump to search

Reverter is a JOSM plugin for changeset rollback.

Caution

Anything written in Revert scripts#Act_responsibly! and the Automated Edits page applies here. The plugin is not intended for use in edit wars and destructive actions.

Do not revert changes by other users without contacting them first in a polite way and giving them enough time to reply (one week minimum). Broken data can be fixed easily, but a broken community is not so easy to restore. :)

Do not be tempted to revert early, just to avoid potential conflicting edits by other users! When in doubt, discuss things on the mailing list before you act.

Note that blatant vandalism like adding "Infant Sacrifice Ritual Area" in the middle of ice sheet in Greenland can be reverted immediately.

Undiscussed automated edits can also be reverted immediately, without waiting. But if there is any real chance that something is not an automated edit - ask before reverting.

Usage

Screenshot-JOSM reverter plugin.png
  • You need to have JOSM available
  • Download the area affected by the changeset to be reverted. If you miss a few objects, this does not matter - they will be downloaded automatically. You can also start with an empty layer. (File -> New Layer)
  • After selecting the Reverter plugin from the JOSM/Plugins list, installing it and restarting JOSM, you should find a new menu item Data -> Revert changeset. Select it and enter the changeset id to be reverted. If the clipboard contains a valid id or the URL for a changeset the field is filled with that value. For a full revert, keep the default option.
    • Hint: If there was a way deleted by the changeset you want to revert, and after the first downloading of map data by the reverter plugin only the nodes of that detected way are shown, try to do a second revert with the same changeset number. In some cases, the deleted way itself is now in JOSM's screen display.
  • The plugin creates changes that take back the actions by the previous changeset. Review the results.
  • Upload. In the upload dialog you can check the summary of changes one last time

Partial reverts

If the changeset was mostly OK, but broke a few objects, you can do a partial revert. There are two ways to do a partial revert:

  • Do a full revert as described above, but do not upload. Select the objects that should be reverted and run File -> Upload selection. However, if the revert contains deletions of objects, those cannot be selected anymore and would not be included.
  • Initially, download the objects to be reverted, select them and use the option Revert selection only in the Reverter dialog.

In both cases, to restore the geometry of a way, you have to select both the way and its nodes. (Because a way only stores a list of node ids, but not their positions.) You can search (Ctrl+F) for the expression selected | child (selected type:way) to add the nodes of all selected ways to the selection.

Clean and dirty reverts

A changeset is clean, if there are no modifications on to top of it (e.g. by other users), otherwise it is dirty. The Reverter Plugin is able to handle both clean and dirty reverts. In case of a subsequent change by another user, the upload will fail and a conflict is created. You can resolve these conflicts with the JOSM's standard conflict dialog and upload afterwards.

Revert multiple changesets in one upload

It is possible to undo multiple subsequent changesets in one upload. Just enter the changeset IDs and they will be reverted in the proper order. (Latest first)

(This is advanced usage, not recommended if you are not sure what you are doing. Contact the Data working group for help and advice on handling complex reverts.)

Resolving conflicts

How does it work?

The reverter plugin downloads the changeset from the server. It fetches all the objects affected by the changeset. It will not download the current version of the objects, but the version immediately after the changeset to be reverted. Then it automatically modifies the local copy of the objects, such that the changeset is undone. These modifications are tracked by JOSM in the same way it would record your manual edits.

In particular:

  • If the changeset to be reverted added a tag to an existing object, this tag will be removed by the reverter plugin and the object will be internally marked as dirty (and will be part of the list of "modified" objects returned by the JOSM data search tool).
  • If the changeset to be reverted removed or modified a tag to an existing object, this tag will be restored by the reverter plugin and the object will be marked as dirty.
  • If the changeset to be reverted deleted objects, the plugin will undelete it (i.e. remove the deleted flag). The id of the object will stay the same and the history is conserved as is (the object will not be uploadable immediately if its tags, geometry or members are left as is, because the internal version of an undeleted object is still not marked as dirty and the undeleted object is is still not part of the "modified" objects list of the editor).
  • If the changeset to be reverted created any new object (e.g. a duplicate), it will be deleted (this object will internally marked as dirty). In this case you won't have visual feedback on the editor map if they were not already loaded before you use the reverter, or they will no longer be selectable and will disappear from the editor map. (But you can see the deletions to apply in the upload dialog)

You can still cancel this reversion to make selectable and visible again on the editor map any object whose reversion will delete them, by using Ctrl+Z (Undo), which instantly applies to every modification made by the reverter (kept in a lited item of the edit history window), and then press Ctrl+Y to redo it instantly (this can be useful to compare visually the effect on specific areas or compare tags values before and after the revert, and decide if you'll really upload this revert to the data server.

The upload is not special in any way, it will increase the version of each affected object and the revert process will be visible in the history.

Issues

Please file a bug report, if you have any problems with this Plugin. A "Precondition failed" message from the server should not occur, this would be an error to report. When writing a bug ticket, try to remember the steps you did and note the changeset ids.

Development

Written by User:Upliner

Source code in SVN: https://trac.openstreetmap.org/browser/applications/editors/josm/plugins/reverter

See also