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

login
register
mail settings
Submitter phabricator
Date April 14, 2018, 4:32 a.m.
Message ID <differential-rev-PHID-DREV-ertj2gguvuskpn4rjche-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30984/
State Superseded
Headers show

Comments

phabricator - April 14, 2018, 4:32 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hook.py

CHANGE DETAILS




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

Patch

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: