Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff command output has strange order if input files don't have equal set of metadata attributes set #93

Open
Nakaner opened this issue Mar 14, 2018 · 0 comments

Comments

@Nakaner
Copy link
Contributor

Nakaner commented Mar 14, 2018

This is related to #90. The same command and input was used. The output looks like this:

+n10 v1 dV c0 t i0 u T x1 y1
-n10 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T x1 y1
-n11 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T x1 y2
+n11 v2 dV c0 t i0 u T x2 y2
+n12 v1 dV c0 t i0 u T x1 y3
-n12 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T x1 y3
-n13 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T x1 y4
+n14 v1 dV c0 t i0 u T x1 y5
+n15 v1 dV c0 t i0 u T x1 y5
-n15 v1 dV c1 t2015-01-01T02:00:00Z i2 utest T x1 y5
+n16 v1 dV c0 t i0 u T x1 y5
-n16 v1 dV c1 t2015-01-01T02:00:00Z i1 utest T x2 y5
+w20 v1 dV c0 t i0 u Tfoo=bar Nn10,n11,n12
-w20 v1 dV c1 t2015-01-01T01:00:00Z i1 utest Tfoo=bar Nn10,n11,n12
-w21 v1 dV c1 t2015-01-01T01:00:00Z i1 utest Txyz=abc Nn12,n13
+w21 v2 dV c0 t i0 u Txyz=new Nn12,n14
+r30 v1 dV c0 t i0 u T Mn12@m1,w20@m2
-r30 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T Mn12@m1,w20@m2

I think that +n10 should appear after -n10. The same applies to other lines where only the metadata was different. If I use osmium::object_order_type_id_version_without_timestamp instead of osmium::OSMObject::operator< to compare two objects, the order is correct:

michael@hatano:~/git/osmium-tool$ build/osmium diff --ignore-timestamps --output-format opl test/diff/input1.osm test/diff/input2-only-version.osm 
[======================================================================] 100% 
-n10 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T x1 y1
+n10 v1 dV c0 t i0 u T x1 y1
-n11 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T x1 y2
+n11 v2 dV c0 t i0 u T x2 y2
-n12 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T x1 y3
+n12 v1 dV c0 t i0 u T x1 y3
-n13 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T x1 y4
+n14 v1 dV c0 t i0 u T x1 y5
-n15 v1 dV c1 t2015-01-01T02:00:00Z i2 utest T x1 y5
+n15 v1 dV c0 t i0 u T x1 y5
-n16 v1 dV c1 t2015-01-01T02:00:00Z i1 utest T x2 y5
+n16 v1 dV c0 t i0 u T x1 y5
-w20 v1 dV c1 t2015-01-01T01:00:00Z i1 utest Tfoo=bar Nn10,n11,n12
+w20 v1 dV c0 t i0 u Tfoo=bar Nn10,n11,n12
-w21 v1 dV c1 t2015-01-01T01:00:00Z i1 utest Txyz=abc Nn12,n13
+w21 v2 dV c0 t i0 u Txyz=new Nn12,n14
-r30 v1 dV c1 t2015-01-01T01:00:00Z i1 utest T Mn12@m1,w20@m2
+r30 v1 dV c0 t i0 u T Mn12@m1,w20@m2

Shall I change the default? Or shall I implement it like in #88?

Some commands currently take the timestamp into account when comparing objects (diff, apply-changes, derive-changes) while other commands don't (merge-changes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant