comparison hggit/git_handler.py @ 759:eb9ebc7ed061

git_handler: store hg extra data in git deterministically by sorting it Previously, we'd iterate over the extra elements in arbitrary order. We now sort the elements and store them in deterministic order. Without sorting, the included test fails half the time.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 31 Aug 2014 05:13:39 -0700
parents 1d16139b8e50
children 13a3513f8e67
comparison
equal deleted inserted replaced
758:1d16139b8e50 759:eb9ebc7ed061
584 584
585 if renames: 585 if renames:
586 for oldfile, newfile in renames: 586 for oldfile, newfile in renames:
587 extra_message += "rename : " + oldfile + " => " + newfile + "\n" 587 extra_message += "rename : " + oldfile + " => " + newfile + "\n"
588 588
589 for key, value in extra.iteritems(): 589 extraitems = extra.items()
590 extraitems.sort()
591 for key, value in extraitems:
590 if key in ('author', 'committer', 'encoding', 'message', 'branch', 'hg-git'): 592 if key in ('author', 'committer', 'encoding', 'message', 'branch', 'hg-git'):
591 continue 593 continue
592 else: 594 else:
593 extra_message += "extra : " + key + " : " + urllib.quote(value) + "\n" 595 extra_message += "extra : " + key + " : " + urllib.quote(value) + "\n"
594 596