Modify

Opened 6 years ago

Closed 6 years ago

#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 6 years ago.
patch for core
plugin-remove-corehacks.patch (36.8 KB ) - added by GerdP 6 years ago.
patch for reverter plugin
add-reverter-core-hacks-v2.patch (9.1 KB ) - added by GerdP 6 years 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 6 years ago.
plugin-remove-corehacks-v2.patch (39.5 KB ) - added by GerdP 6 years ago.

Download all attachments as: .zip

Change History (13)

by GerdP, 6 years ago

patch for core

by GerdP, 6 years ago

patch for reverter plugin

comment:1 by GerdP, 6 years ago

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).

in reply to:  1 comment:2 by Upliner, 6 years ago

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 by GerdP, 6 years ago

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.

by GerdP, 6 years 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

comment:4 by GerdP, 6 years ago

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.

by GerdP, 6 years ago

by GerdP, 6 years ago

comment:5 by GerdP, 6 years ago

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 by GerdP, 6 years ago

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:7 by GerdP, 6 years ago

see [o34958:34959]

comment:8 by GerdP, 6 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.