Patchwork [V3] py3: explicitly convert a list to bytes to pass in ui.debug

login
register
mail settings
Submitter Pulkit Goyal
Date May 17, 2017, 8:47 p.m.
Message ID <1875fc152f23ee011b3c.1495054033@workspace>
Download mbox | patch
Permalink /patch/20663/
State Accepted
Headers show

Comments

Pulkit Goyal - May 17, 2017, 8:47 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1493837589 -19800
#      Thu May 04 00:23:09 2017 +0530
# Node ID 1875fc152f23ee011b3c704dfc847d765d169dab
# Parent  2d19664e257da7ad5cb97150d81838c25872fac7
py3: explicitly convert a list to bytes to pass in ui.debug

Here pats is a list obviously. Since we can't pass unicodes to ui.debug, we
have to pass this as bytes.
Yuya Nishihara - May 18, 2017, 12:36 p.m.
On Thu, 18 May 2017 02:17:13 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1493837589 -19800
> #      Thu May 04 00:23:09 2017 +0530
> # Node ID 1875fc152f23ee011b3c704dfc847d765d169dab
> # Parent  2d19664e257da7ad5cb97150d81838c25872fac7
> py3: explicitly convert a list to bytes to pass in ui.debug

Queued, thanks.

> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -379,7 +379,8 @@
>              return r
>          m.matchfn = lfmatchfn
>  
> -        ui.debug('updated patterns: %s\n' % sorted(pats))
> +        bytespats = ', '.join(sorted(pats))
> +        ui.debug('updated patterns: %s\n' % bytespats)

I've inlined it as the bytespats seems short enough.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -379,7 +379,8 @@ 
             return r
         m.matchfn = lfmatchfn
 
-        ui.debug('updated patterns: %s\n' % sorted(pats))
+        bytespats = ', '.join(sorted(pats))
+        ui.debug('updated patterns: %s\n' % bytespats)
         return m, pats
 
     # For hg log --patch, the match object is used in two different senses:
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -479,7 +479,7 @@ 
   summary:     anotherlarge
   
   $ hg --debug log -T '{rev}: {desc}\n' ../sub/anotherlarge
-  updated patterns: ['../.hglf/sub/../sub/anotherlarge', '../sub/anotherlarge']
+  updated patterns: ../.hglf/sub/../sub/anotherlarge, ../sub/anotherlarge
   1: anotherlarge
 
   $ hg log -G anotherlarge
@@ -498,18 +498,18 @@ 
   summary:     anotherlarge
   
   $ hg --debug log -T '{rev}: {desc}\n' -G glob:another*
-  updated patterns: ['glob:../.hglf/sub/another*', 'glob:another*']
+  updated patterns: glob:../.hglf/sub/another*, glob:another*
   @  1: anotherlarge
   |
   ~
 
 #if no-msys
   $ hg --debug log -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys
-  updated patterns: ['glob:../.hglf/sub/another*']
+  updated patterns: glob:../.hglf/sub/another*
   1: anotherlarge
 
   $ hg --debug log -G -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys
-  updated patterns: ['glob:../.hglf/sub/another*']
+  updated patterns: glob:../.hglf/sub/another*
   @  1: anotherlarge
   |
   ~
@@ -557,10 +557,10 @@ 
 
 Log from outer space
   $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/sub/anotherlarge'
-  updated patterns: ['addrm2/.hglf/sub/anotherlarge', 'addrm2/sub/anotherlarge']
+  updated patterns: addrm2/.hglf/sub/anotherlarge, addrm2/sub/anotherlarge
   1: anotherlarge
   $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/.hglf/sub/anotherlarge'
-  updated patterns: ['addrm2/.hglf/sub/anotherlarge']
+  updated patterns: addrm2/.hglf/sub/anotherlarge
   1: anotherlarge
 
 
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -47,7 +47,7 @@ 
 
 Make sure largefiles doesn't interfere with logging a regular file
   $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles=
-  updated patterns: ['.hglf/a', 'a']
+  updated patterns: .hglf/a, a
   0: a
   $ hg log a
   changeset:   0:9161b9aeaf16
@@ -67,7 +67,7 @@ 
   summary:     a
   
   $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles=
-  updated patterns: ['glob:.hglf/a*', 'glob:a*']
+  updated patterns: glob:.hglf/a*, glob:a*
   3: d
   0: a