changeset 37751:483de34f23b1

hook: use stringutil.pprint instead of reinventing it Differential Revision: https://phab.mercurial-scm.org/D3360
author Augie Fackler <augie@google.com>
date Fri, 13 Apr 2018 23:56:11 -0400
parents f7194c925003
children 63b7415e37a5
files mercurial/hook.py
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hook.py	Fri Apr 13 23:57:57 2018 -0400
+++ b/mercurial/hook.py	Fri Apr 13 23:56:11 2018 -0400
@@ -21,6 +21,7 @@
 )
 from .utils import (
     procutil,
+    stringutil,
 )
 
 def _pythonhook(ui, repo, htype, hname, funcname, args, throw):
@@ -137,11 +138,7 @@
         if callable(v):
             v = v()
         if isinstance(v, dict):
-            # make the dictionary element order stable across Python
-            # implementations
-            v = ('{' +
-                 ', '.join('%r: %r' % i for i in sorted(v.iteritems())) +
-                 '}')
+            v = stringutil.pprint(v, bprefix=False)
         env['HG_' + k.upper()] = v
 
     if repo: