How to undo some local changes before upload?

I’m still learning JOSM and trying to make the most of it. I discovered this awesome plugin (GitHub - DavidKarlas/JosmReviewPlugin: JOSM plugin for reviewing changes.) in JOSM that helps me navigate my local changes and avoid uploading unintended modifications.

The plugin nicely displays the changes I’ve made.

image

(this is not a real use case, I just added something and modified some objects for the sake of a demo)

However, I’m struggling to figure out how to undo specific changes and upload the remaining ones. I can do it within the same session using the Command Stack, but when I close and reopen JOSM either with the saved session or an .osm file, the Command Stack is empty again.

Since this plugin can highlight (actually, “select”) the changes, I assume there must be a way to revert them somehow (but not using this plugin, there’s nothing in it for reverting).

Can anyone tell me how you normally do it?

3 Likes

First another Hallelujah to a great plugin addition found for me. Learned from another mapper about the command stack but that did not allow (don’t know how), to undo a specific change, I only got so far that it reversed everything from the item I wanted to undo / back out.

For this plugin Ctrl+Alt+F4 and it addsa pane gets added to the sidebar at right. It’s much better than ways seen so far that I can remember, so goodos for this pointer.

On the quick I guess the toggle (mouse double click the item which does it too in addition to the space bar) adds a green tick-mark to self-indicate to be happy with the item, but like you see nothing to take a bad apple out… seems not to have been the intend of this enhancement.

thanks

2 Likes

In general “undoing” any changes except at the end of your edits, regardless of which editor you are using is iffy (but I’ll leave that for another day). In any case the simple solution is to use the Upload Selection function and then discard any changes that you didn’t want to upload.

2 Likes

You can “undo” specific changes using Purge.

Select the change object and select Purge (Ctrl+Shift+P) and the object will be deleted for you local check out as if you did not make change/download that data. Works quite nicely.

3 Likes

First of all, thank you, @SimonPoole, for pointing out Upload Selection. And I also like what @emvee suggests, Purge. I think those two completely cover my question.

To your point about “undoing” being iffy, maybe I wasn’t clear enough. I was specifically referring to unintentional changes, such as when I was working on something, accidentally moved something else, kept working, and only noticed it before uploading. It would be a waste of time to redo everything just because of that annoyance. But you both answered how to deal with such a situation.

I think I need to apologize for not being clear. The problem is when you have a series of edits (chronological order):

e1 e2 e3 e4 e5

then it is always safe to undo e5 then e4, e3 and so on (aka in reverse chronological order).

However if you actually get what you expect if you just undo, say, e3, depends on what you did in e4 and e5.

1 Like

For each object’s tags and individual point positions, you can go into its history panel. Right-clicking allows you to undo back to that version.

5 Likes

@Kovoschiz, this is incredibly useful for reverting modified objects! I can’t believe I overlooked it. I’ve tried the History dialog multiple times, but I didn’t realize it had this “Restore” functionality. It was not obvious. So, I’m adding a screenshot here.

However, in order to modify a way, you need to know which node to click on to revert it. The plugin I mentioned earlier doesn’t help in this regard, as it only shows “moved (xxxx) 4 noded”. But using additionally the map paint style “Modified objects” is helpful in this situation because it highlights not just the way they belong to but also the modified nodes. The only downside is that “Modified objects” can be a bit buggy. You have to toggle it off and on again to remove the highlighting of the way itself (not the nodes, they are properly handled) after restoring the modified nodes and reloading the history from the server (Ctrl+Alt-M). It might not necessarily be related to “Modified objects” but rather to the style re-rendering. I’m not sure.

Also, I wish it were possible to assign a keyboard shortcut to quickly toggle “Modify objects” on and off.

1 Like

I actually figured out how to do it: you can simply add the plugin to the toolbar and assign a shortcut to it :wink:

Screenshot from 2023-06-27 18-37-55

The only minor inconvenience is that the button’s green color is excessively bright. In my opinion, the icon would be better suited with a slightly less intense shade. However, it’s not a major issue, and it’s relatively simple to make the adjustment.

Well if you really want to you can locally modify the icon in the cached map style zip file ^^

Thanks, @Woazboat, that’s almost what I did. But I made a copy of the style package, updated the icon, repacked the .zip file, and added the resulting package to the styles preferences.