D3360: hook: use stringutil.pprint instead of reinventing it

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Mon Apr 16 19:22:31 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG483de34f23b1: hook: use stringutil.pprint instead of reinventing it (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3360?vs=8237&id=8354

REVISION DETAIL
  https://phab.mercurial-scm.org/D3360

AFFECTED FILES
  mercurial/hook.py

CHANGE DETAILS

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -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:



To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel


More information about the Mercurial-devel mailing list