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)
Change History (13)
by , 6 years ago
Attachment: | add-reverter-core-hacks.patch added |
---|
follow-up: 2 comment:1 by , 6 years ago
Cc: | 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 by , 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 , 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 , 6 years ago
Attachment: | add-reverter-core-hacks-v2.patch added |
---|
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 , 6 years ago
Cc: | 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 , 6 years ago
Attachment: | add-reverter-core-hacks-v3.patch added |
---|
by , 6 years ago
Attachment: | plugin-remove-corehacks-v2.patch added |
---|
comment:5 by , 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:8 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
patch for core