metomi/rose — pull request #562 by benfitzpatrick (2013-04-15 11:19:46+00:00)
Title: rose config-dump: fix index sort consistency for integer/string indices

A Rose configuration file with the following content:
```
[namelist:foo(1)]
baz=1

[namelist:foo(1abc)]
baz=1abc

[namelist:foo(5)]
baz=5

[namelist:foo(10)]
baz=10

[namelist:foo(10abc)]
baz=10abc

[namelist:foo(50)]
baz=50

[namelist:foo(5abc)]
baz=5abc

[namelist:foo(5xyz)]
baz=5xyz

[namelist:foo(abc)]
baz=abc
```
will currently be transformed via rose config-dump to:
```
[namelist:foo(1)]
baz=1

[namelist:foo(10)]
baz=10

[namelist:foo(10abc)]
baz=10abc

[namelist:foo(1abc)]
baz=1abc

[namelist:foo(5)]
baz=5

[namelist:foo(50)]
baz=50

[namelist:foo(5abc)]
baz=5abc

[namelist:foo(5xyz)]
baz=5xyz

[namelist:foo(abc)]
baz=abc
```

which is incorrect and not consistent against removal of sections - `foo(5)` is between `foo(10)` and `foo(50)`, which would not be the case if they were the only 3 sections.

This occurs when an integer-like index is compared to a string-like index, which is currently handled as string-vs-string. This produces the above problem. The code in this pull request enforces a rigid string/integer sort preference (actually, the same is true for Python's cmp function for integer types vs string types, but it was thought better to have it explicit).

@arjclark, please review.