Modify

#17459 closed enhancement (fixed)

[patch] remove duplicated code in reverter corehacks

Reported by: GerdP Owned by: Upliner
Priority: normal Milestone:
Component: Plugin reverter Version:
Keywords: Cc: Upliner, Don-vip

Description

I think it would be good to remove the core hacks in the reverter plugin sources, they are completely out of sync with the core and it requires only small changes to the core sources to make them obsolete.

Attachments (5)

add-reverter-core-hacks.patch (9.0 KB) - added by GerdP 16 months ago.
patch for core
plugin-remove-corehacks.patch (36.8 KB) - added by GerdP 16 months ago.
patch for reverter plugin
add-reverter-core-hacks-v2.patch (9.1 KB) - added by GerdP 16 months ago.
improve patch for core: when useEarliestVersion is true and multiple versions appear in one cs, compare version to make sure we keep the earliest
add-reverter-core-hacks-v3.patch (21.7 KB) - added by GerdP 16 months ago.
plugin-remove-corehacks-v2.patch (39.5 KB) - added by GerdP 16 months ago.

Download all attachments as: .zip

Change History (13)

Changed 16 months ago by GerdP

patch for core

Changed 16 months ago by GerdP

patch for reverter plugin

comment:1 Changed 16 months ago by GerdP

Cc: Upliner added

@Upliner: My understanding is that the first appearance of a primitve in a changeset will always have the "lowest" version number.
If that is not true the code patch needs more code (see also ticket:5160#comment:3).

comment:2 in reply to:  1 Changed 16 months ago by Upliner

Replying to GerdP:

@Upliner: My understanding is that the first appearance of a primitve in a changeset will always have the "lowest" version number.

Hmm, I don't think we should rely on that even if I relied on it some time ago.

comment:3 Changed 16 months ago by GerdP

OK, you probably have seen more special cases than I. I'll re-add your code that makes sure that really the earliest change is found.

Changed 16 months ago by GerdP

improve patch for core: when useEarliestVersion is true and multiple versions appear in one cs, compare version to make sure we keep the earliest

comment:4 Changed 16 months ago by GerdP

Cc: Don-vip added

I've now learned that these patches are not fully compatible :(
@Don-vip:
While working on a better version I've noticed that we sometimes store the changeset ID as long and sometimes as int.
I found no clear hint in the api 0.6 wiki what should be used, but it seems reasonable to use int.
Why does HistoryOsmPrimitive use long for both the changeset id and the version? This seems like a waste of memory to me.

Changed 16 months ago by GerdP

Changed 16 months ago by GerdP

comment:5 Changed 16 months ago by GerdP

With the attached patches reverter should work as before. The major change is in ChangesetDataSet which now keeps the first and the last change in a changeset (if there are multiple changes) and provides methods to get them.
I've removed the unused method getPrimitivesByModificationType(). It was only used in the unit test, I found no reference in core or any plugin and I was not sure what to do with it when an object is first created and then modified.
I've also added some code to check that the order of versions is strictly ascending.
I plan to commit these changes after next milestone (19.3).

comment:6 Changed 15 months ago by GerdP

In 14946/josm:

see #17459: remove duplicated code in reverter corehacks
Step 1: Add needed code to core methods.
Major changes:
1) If a changeset contains multiple versions for a primitive, class ChangesetDataSet keeps the first and the last version (not just the last) and provides methods to access them, unused method getPrimitivesByModificationType() was removed
2) The changeset reader classes have a new field useAnonymousUser. If set, the user found in a changeset is replaced by the anonymous user.

comment:8 Changed 15 months ago by GerdP

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Upliner.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.