comparison mercurial/tags.py @ 24143:7b09dbbbd502

tags: write tags cache deterministically An upcoming test verifies content of the .hg/cache/tags file. During testing, inconsistent output was observed. This is the result of iterating over a dictionary. Throw a sorted() around tags entries to ensure .hg/cache/tags is written deterministically so test output is stable.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 24 Feb 2015 00:06:47 -0800
parents 7cc77030c557
children c71edbafe603
comparison
equal deleted inserted replaced
24142:be7cb25186be 24143:7b09dbbbd502
335 # Tag names in the cache are in UTF-8 -- which is the whole reason 335 # Tag names in the cache are in UTF-8 -- which is the whole reason
336 # we keep them in UTF-8 throughout this module. If we converted 336 # we keep them in UTF-8 throughout this module. If we converted
337 # them local encoding on input, we would lose info writing them to 337 # them local encoding on input, we would lose info writing them to
338 # the cache. 338 # the cache.
339 cachefile.write('\n') 339 cachefile.write('\n')
340 for (name, (node, hist)) in cachetags.iteritems(): 340 for (name, (node, hist)) in sorted(cachetags.iteritems()):
341 for n in hist: 341 for n in hist:
342 cachefile.write("%s %s\n" % (hex(n), name)) 342 cachefile.write("%s %s\n" % (hex(n), name))
343 cachefile.write("%s %s\n" % (hex(node), name)) 343 cachefile.write("%s %s\n" % (hex(node), name))
344 344
345 try: 345 try: