Submitter | Pulkit Goyal |
---|---|
Date | May 6, 2017, 3:01 a.m. |
Message ID | <72a79c82aa8913f1661a.1494039673@pulkit-goyal> |
Download | mbox | patch |
Permalink | /patch/20469/ |
State | Accepted |
Headers | show |
Comments
On Sat, 06 May 2017 08:31: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 72a79c82aa8913f1661af3d7dc3b14d856679bd9 > # Parent e4a4ebfd9d8ee96412ee5909b1e4d97694fd55c2 > py3: explicitly convert a list to str and then 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. So this patch first convert that list to str and > then to bytes to pass into ui.debug(). > > diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py > --- a/hgext/largefiles/overrides.py > +++ b/hgext/largefiles/overrides.py > @@ -17,6 +17,7 @@ > from mercurial import ( > archival, > cmdutil, > + encoding, > error, > hg, > match as matchmod, > @@ -380,8 +381,8 @@ > r = origmatchfn(f) > return r > m.matchfn = lfmatchfn > - > - ui.debug('updated patterns: %s\n' % sorted(pats)) > + bytespats = encoding.unitolocal(r'%s' % sorted(pats)) > + ui.debug('updated patterns: %s\n' % bytespats) No. '%s' % sorted(paths) is bytes on Python 2, and pats[n] is bytes on both Pythons. We need to format the list by e.g. ', '.join(sorted(paths)).
On Sat, 06 May 2017 08:31: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 72a79c82aa8913f1661af3d7dc3b14d856679bd9 > # Parent e4a4ebfd9d8ee96412ee5909b1e4d97694fd55c2 > py3: explicitly convert a list to str and then bytes to pass in ui.debug Queued 3 and 4, thanks. I'll revisit 6- later.
Patch
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -17,6 +17,7 @@ from mercurial import ( archival, cmdutil, + encoding, error, hg, match as matchmod, @@ -380,8 +381,8 @@ r = origmatchfn(f) return r m.matchfn = lfmatchfn - - ui.debug('updated patterns: %s\n' % sorted(pats)) + bytespats = encoding.unitolocal(r'%s' % 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: