comparison mercurial/hook.py @ 13207:1775382ff833

hooks: sort any dictionaries set in the environment The actual order of dictionary items is implementation-defined in Python, and differs between CPython and PyPy. With this change, test-hooks.t passes with PyPy.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 24 Dec 2010 15:22:00 +0100
parents ecf7d6e0eef0
children 600e64004eb5
comparison
equal deleted inserted replaced
13205:18f0084a97c8 13207:1775382ff833
90 90
91 env = {} 91 env = {}
92 for k, v in args.iteritems(): 92 for k, v in args.iteritems():
93 if hasattr(v, '__call__'): 93 if hasattr(v, '__call__'):
94 v = v() 94 v = v()
95 if isinstance(v, dict):
96 # make the dictionary element order stable across Python
97 # implementations
98 v = ('{' +
99 ', '.join('%r: %r' % i for i in sorted(v.iteritems())) +
100 '}')
95 env['HG_' + k.upper()] = v 101 env['HG_' + k.upper()] = v
96 102
97 if repo: 103 if repo:
98 cwd = repo.root 104 cwd = repo.root
99 else: 105 else: