[PATCH 03 of 10] py3: use %s instead of %b to print a list

Yuya Nishihara yuya at tcha.org
Fri May 5 06:16:59 EDT 2017


On Fri, 05 May 2017 04:16:48 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1493837589 -19800
> #      Thu May 04 00:23:09 2017 +0530
> # Node ID 100e7fc11bf088bfa58532680f8917bf3750599f
> # Parent  b686f18461301572e82a1d85b2691d1d1d7f27b5
> py3: use %s instead of %b to print a list
> 
> Here pats is a list obviously. We add u'' to make sure %s don't get converted
> to %b by the transformer. r'' is not used because then \n won't be interpreted
> as newline.
> 
> diff -r b686f1846130 -r 100e7fc11bf0 hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py	Wed May 03 15:41:28 2017 +0530
> +++ b/hgext/largefiles/overrides.py	Thu May 04 00:23:09 2017 +0530
> @@ -381,7 +381,7 @@
>              return r
>          m.matchfn = lfmatchfn
>  
> -        ui.debug('updated patterns: %s\n' % sorted(pats))
> +        ui.debug(u'updated patterns: %s\n' % sorted(pats))

You can't print a unicode by ui.debug(). Here we'll have to format pats
by ourselves.


More information about the Mercurial-devel mailing list