I've been trying to reverse engineer the generation of the changedFiles file with temacity and mercurial.
I've pretty much got the same outout but can't figure out how it is sorted.
Priority is the following where the most recent revision number if used.
Then sorting seems to be from most recent revision number first, with files sorted by name in that grouping. There is however some sorting applied to added files that have subsequently been changed, could you reveal what you are doing please.