Skip to content

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

@Nakaner

Description

@Nakaner

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions