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

2018-10-24 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG09a37a5d8f5d: extensions: fix up many many debug logs that 
use %r (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5002?vs=12323=12334

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

AFFECTED FILES
  mercurial/extensions.py
  mercurial/hg.py
  tests/test-bad-extension.t
  tests/test-extension-timing.t

CHANGE DETAILS

diff --git a/tests/test-extension-timing.t b/tests/test-extension-timing.t
--- a/tests/test-extension-timing.t
+++ b/tests/test-extension-timing.t
@@ -46,23 +46,23 @@
   $ hg foo --traceback --config devel.debug.extensions=yes --debug 2>&1
   debug.extensions: loading extensions
   debug.extensions: - processing 1 entries
-  debug.extensions:   - loading extension: 'foobar'
-  debug.extensions:   > 'foobar' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'foobar'
-  debug.extensions: - invoking registered callbacks: 'foobar'
+  debug.extensions:   - loading extension: foobar
+  debug.extensions:   > foobar extension loaded in * (glob)
+  debug.extensions: - validating extension tables: foobar
+  debug.extensions: - invoking registered callbacks: foobar
   debug.extensions: > callbacks completed in * (glob)
   debug.extensions: > loaded 1 extensions, total time * (glob)
   debug.extensions: - loading configtable attributes
   debug.extensions: - executing uisetup hooks
-  debug.extensions:   - running uisetup for 'foobar'
+  debug.extensions:   - running uisetup for foobar
   uisetup called [debug]
   uisetup called
   uisetup called [status]
-  debug.extensions:   > uisetup for 'foobar' took * (glob)
+  debug.extensions:   > uisetup for foobar took * (glob)
   debug.extensions: > all uisetup took * (glob)
   debug.extensions: - executing extsetup hooks
-  debug.extensions:   - running extsetup for 'foobar'
-  debug.extensions:   > extsetup for 'foobar' took * (glob)
+  debug.extensions:   - running extsetup for foobar
+  debug.extensions:   > extsetup for foobar took * (glob)
   debug.extensions: > all extsetup took * (glob)
   debug.extensions: - executing remaining aftercallbacks
   debug.extensions: > remaining aftercallbacks completed in * (glob)
@@ -87,7 +87,7 @@
   debug.extensions:   - running reposetup for foobar
   reposetup called for a
   ui == repo.ui
-  debug.extensions:   > reposetup for 'foobar' took * (glob)
+  debug.extensions:   > reposetup for foobar took * (glob)
   debug.extensions: > all reposetup took * (glob)
   Foo
 
diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -85,21 +85,21 @@
   > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|not 
import|ModuleNotFound'
   debug.extensions: loading extensions
   debug.extensions: - processing 5 entries
-  debug.extensions:   - loading extension: 'gpg'
-  debug.extensions:   > 'gpg' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'gpg'
-  debug.extensions: - invoking registered callbacks: 'gpg'
+  debug.extensions:   - loading extension: gpg
+  debug.extensions:   > gpg extension loaded in * (glob)
+  debug.extensions: - validating extension tables: gpg
+  debug.extensions: - invoking registered callbacks: gpg
   debug.extensions: > callbacks completed in * (glob)
-  debug.extensions:   - loading extension: 'badext'
+  debug.extensions:   - loading extension: badext
   *** failed to import extension badext from $TESTTMP/badext.py: bit bucket 
overflow
   Traceback (most recent call last):
   Exception: bit bucket overflow
-  debug.extensions:   - loading extension: 'baddocext'
-  debug.extensions:   > 'baddocext' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'baddocext'
-  debug.extensions: - invoking registered callbacks: 'baddocext'
+  debug.extensions:   - loading extension: baddocext
+  debug.extensions:   > baddocext extension loaded in * (glob)
+  debug.extensions: - validating extension tables: baddocext
+  debug.extensions: - invoking registered callbacks: baddocext
   debug.extensions: > callbacks completed in * (glob)
-  debug.extensions:   - loading extension: 'badext2'
+  debug.extensions:   - loading extension: badext2
   debug.extensions: - could not import hgext.badext2 (No module named 
*badext2*): trying hgext3rd.badext2 (glob)
   Traceback (most recent call last):
   ImportError: No module named badext2 (no-py3 !)
@@ -121,16 +121,16 @@
   debug.extensions: > loaded 2 extensions, total time * (glob)
   debug.extensions: - loading configtable attributes
   debug.extensions: - executing uisetup hooks
-  debug.extensions:   - running uisetup for 'gpg'
-  debug.extensions:   > uisetup for 'gpg' took * (glob)
-  debug.extensions:   - running uisetup for 'baddocext'
-  

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

2018-10-23 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 12323.
durin42 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5002?vs=11910=12323

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

AFFECTED FILES
  mercurial/extensions.py
  mercurial/hg.py
  tests/test-bad-extension.t
  tests/test-extension-timing.t

CHANGE DETAILS

diff --git a/tests/test-extension-timing.t b/tests/test-extension-timing.t
--- a/tests/test-extension-timing.t
+++ b/tests/test-extension-timing.t
@@ -46,23 +46,23 @@
   $ hg foo --traceback --config devel.debug.extensions=yes --debug 2>&1
   debug.extensions: loading extensions
   debug.extensions: - processing 1 entries
-  debug.extensions:   - loading extension: 'foobar'
-  debug.extensions:   > 'foobar' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'foobar'
-  debug.extensions: - invoking registered callbacks: 'foobar'
+  debug.extensions:   - loading extension: foobar
+  debug.extensions:   > foobar extension loaded in * (glob)
+  debug.extensions: - validating extension tables: foobar
+  debug.extensions: - invoking registered callbacks: foobar
   debug.extensions: > callbacks completed in * (glob)
   debug.extensions: > loaded 1 extensions, total time * (glob)
   debug.extensions: - loading configtable attributes
   debug.extensions: - executing uisetup hooks
-  debug.extensions:   - running uisetup for 'foobar'
+  debug.extensions:   - running uisetup for foobar
   uisetup called [debug]
   uisetup called
   uisetup called [status]
-  debug.extensions:   > uisetup for 'foobar' took * (glob)
+  debug.extensions:   > uisetup for foobar took * (glob)
   debug.extensions: > all uisetup took * (glob)
   debug.extensions: - executing extsetup hooks
-  debug.extensions:   - running extsetup for 'foobar'
-  debug.extensions:   > extsetup for 'foobar' took * (glob)
+  debug.extensions:   - running extsetup for foobar
+  debug.extensions:   > extsetup for foobar took * (glob)
   debug.extensions: > all extsetup took * (glob)
   debug.extensions: - executing remaining aftercallbacks
   debug.extensions: > remaining aftercallbacks completed in * (glob)
@@ -87,7 +87,7 @@
   debug.extensions:   - running reposetup for foobar
   reposetup called for a
   ui == repo.ui
-  debug.extensions:   > reposetup for 'foobar' took * (glob)
+  debug.extensions:   > reposetup for foobar took * (glob)
   debug.extensions: > all reposetup took * (glob)
   Foo
 
diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -85,21 +85,21 @@
   > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|not 
import|ModuleNotFound'
   debug.extensions: loading extensions
   debug.extensions: - processing 5 entries
-  debug.extensions:   - loading extension: 'gpg'
-  debug.extensions:   > 'gpg' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'gpg'
-  debug.extensions: - invoking registered callbacks: 'gpg'
+  debug.extensions:   - loading extension: gpg
+  debug.extensions:   > gpg extension loaded in * (glob)
+  debug.extensions: - validating extension tables: gpg
+  debug.extensions: - invoking registered callbacks: gpg
   debug.extensions: > callbacks completed in * (glob)
-  debug.extensions:   - loading extension: 'badext'
+  debug.extensions:   - loading extension: badext
   *** failed to import extension badext from $TESTTMP/badext.py: bit bucket 
overflow
   Traceback (most recent call last):
   Exception: bit bucket overflow
-  debug.extensions:   - loading extension: 'baddocext'
-  debug.extensions:   > 'baddocext' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'baddocext'
-  debug.extensions: - invoking registered callbacks: 'baddocext'
+  debug.extensions:   - loading extension: baddocext
+  debug.extensions:   > baddocext extension loaded in * (glob)
+  debug.extensions: - validating extension tables: baddocext
+  debug.extensions: - invoking registered callbacks: baddocext
   debug.extensions: > callbacks completed in * (glob)
-  debug.extensions:   - loading extension: 'badext2'
+  debug.extensions:   - loading extension: badext2
   debug.extensions: - could not import hgext.badext2 (No module named 
*badext2*): trying hgext3rd.badext2 (glob)
   Traceback (most recent call last):
   ImportError: No module named badext2 (no-py3 !)
@@ -121,16 +121,16 @@
   debug.extensions: > loaded 2 extensions, total time * (glob)
   debug.extensions: - loading configtable attributes
   debug.extensions: - executing uisetup hooks
-  debug.extensions:   - running uisetup for 'gpg'
-  debug.extensions:   > uisetup for 'gpg' took * (glob)
-  debug.extensions:   - running uisetup for 'baddocext'
-  debug.extensions:   > uisetup for 'baddocext' took * (glob)
+  debug.extensions:   - running uisetup for gpg
+  

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

2018-10-19 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > 1. use pycompat.bytestr() as this patch does
  > 2. use '%s' and add quotes in the output
  
  I think they can be just "... '%s'" given extension names are unlikely to
  contain meta characters.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, indygreg
Cc: yuja, pulkit, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2018-10-19 Thread Yuya Nishihara
>   1. use pycompat.bytestr() as this patch does
>   2. use '%s' and add quotes in the output

I think they can be just "... '%s'" given extension names are unlikely to
contain meta characters.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2018-10-19 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  How do we want to move forward with this?
  
  1. use pycompat.bytestr() as this patch does
  2. use '%s' and add quotes in the output
  
  This is one the failure breaking python3-buildbot.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, indygreg
Cc: pulkit, indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2018-10-14 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Switching to %s loses some quotes I like having.

INLINE COMMENTS

> indygreg wrote in extensions.py:178
> Can't we just switch to `%s`?

That'll result in less quoting in the output, and I like having the quoting.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2018-10-12 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> extensions.py:178
>  return _extensions[shortname]
> -log('  - loading extension: %r\n', shortname)
> +log('  - loading extension: %r\n', pycompat.bytestr(shortname))
>  _extensions[shortname] = None

Can't we just switch to `%s`?

> extensions.py:181
> +with util.timedcm('load extension %r',
> +  pycompat.bytestr(shortname)) as stats:
>  mod = _importext(name, path, bind(_reportimporterror, ui))

Ditto.

> extensions.py:202-204
> +log('- invoking registered callbacks: %r\n',
> +pycompat.bytestr(shortname))
> +with util.timedcm('callbacks extension %r',

Ditto.

> extensions.py:258
>  if name not in _disabledextensions:
> -log('  - skipping disabled extension: %r\n', name)
> +log('  - skipping disabled extension: %r\n',
> +pycompat.bytestr(name))

Ditto.

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2018-10-12 Thread durin42 (Augie Fackler)
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