D5002: extensions: fix up many many debug logs that use %r

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Fri Oct 12 16:53:24 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This gets us a bunch closer on Python 3, but I'll still have to use a
  ton of sad globs.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/extensions.py

CHANGE DETAILS

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -175,11 +175,12 @@
         return None
     if shortname in _extensions:
         return _extensions[shortname]
-    log('  - loading extension: %r\n', shortname)
+    log('  - loading extension: %r\n', pycompat.bytestr(shortname))
     _extensions[shortname] = None
-    with util.timedcm('load extension %r', shortname) as stats:
+    with util.timedcm('load extension %r',
+                      pycompat.bytestr(shortname)) as stats:
         mod = _importext(name, path, bind(_reportimporterror, ui))
-    log('  > %r extension loaded in %s\n', shortname, stats)
+    log('  > %r extension loaded in %s\n', pycompat.bytestr(shortname), stats)
     if loadingtime is not None:
         loadingtime[shortname] += stats.elapsed
 
@@ -190,15 +191,18 @@
     minver = getattr(mod, 'minimumhgversion', None)
     if minver and util.versiontuple(minver, 2) > util.versiontuple(n=2):
         ui.warn(_('(third party extension %s requires version %s or newer '
-                  'of Mercurial; disabling)\n') % (shortname, minver))
+                  'of Mercurial; disabling)\n') % (
+                      pycompat.bytestr(shortname), minver))
         return
-    log('    - validating extension tables: %r\n', shortname)
+    log('    - validating extension tables: %r\n', pycompat.bytestr(shortname))
     _validatetables(ui, mod)
 
     _extensions[shortname] = mod
     _order.append(shortname)
-    log('    - invoking registered callbacks: %r\n', shortname)
-    with util.timedcm('callbacks extension %r', shortname) as stats:
+    log('    - invoking registered callbacks: %r\n',
+        pycompat.bytestr(shortname))
+    with util.timedcm('callbacks extension %r',
+                      pycompat.bytestr(shortname)) as stats:
         for fn in _aftercallbacks.get(shortname, []):
             fn(loaded=True)
     log('    > callbacks completed in %s\n', stats)
@@ -251,7 +255,8 @@
             if path:
                 if path[0:1] == '!':
                     if name not in _disabledextensions:
-                        log('  - skipping disabled extension: %r\n', name)
+                        log('  - skipping disabled extension: %r\n',
+                            pycompat.bytestr(name))
                     _disabledextensions[name] = path[1:]
                     continue
             try:
@@ -289,31 +294,33 @@
     log('- executing uisetup hooks\n')
     with util.timedcm('all uisetup') as alluisetupstats:
         for name in _order[newindex:]:
-            log('  - running uisetup for %r\n', name)
-            with util.timedcm('uisetup %r', name) as stats:
+            log('  - running uisetup for %r\n', pycompat.bytestr(name))
+            with util.timedcm('uisetup %r', pycompat.bytestr(name)) as stats:
                 if not _runuisetup(name, ui):
-                    log('    - the %r extension uisetup failed\n', name)
+                    log('    - the %r extension uisetup failed\n',
+                        pycompat.bytestr(name))
                     broken.add(name)
-            log('  > uisetup for %r took %s\n', name, stats)
+            log('  > uisetup for %r took %s\n', pycompat.bytestr(name), stats)
             loadingtime[name] += stats.elapsed
     log('> all uisetup took %s\n', alluisetupstats)
 
     log('- executing extsetup hooks\n')
     with util.timedcm('all extsetup') as allextetupstats:
         for name in _order[newindex:]:
             if name in broken:
                 continue
-            log('  - running extsetup for %r\n', name)
-            with util.timedcm('extsetup %r', name) as stats:
+            log('  - running extsetup for %r\n', pycompat.bytestr(name))
+            with util.timedcm('extsetup %r', pycompat.bytestr(name)) as stats:
                 if not _runextsetup(name, ui):
-                    log('    - the %r extension extsetup failed\n', name)
+                    log('    - the %r extension extsetup failed\n',
+                        pycompat.bytestr(name))
                     broken.add(name)
-            log('  > extsetup for %r took %s\n', name, stats)
+            log('  > extsetup for %r took %s\n', pycompat.bytestr(name), stats)
             loadingtime[name] += stats.elapsed
     log('> all extsetup took %s\n', allextetupstats)
 
     for name in broken:
-        log('    - disabling broken %r extension\n', name)
+        log('    - disabling broken %r extension\n', pycompat.bytestr(name))
         _extensions[name] = None
 
     # Call aftercallbacks that were never met.
@@ -325,7 +332,7 @@
 
             for fn in _aftercallbacks[shortname]:
                 log('  - extension %r not loaded, notify callbacks\n',
-                    shortname)
+                    pycompat.bytestr(shortname))
                 fn(loaded=False)
     log('> remaining aftercallbacks completed in %s\n', stats)
 



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


More information about the Mercurial-devel mailing list