This is an archive of the discontinued Mercurial Phabricator instance.

py3: replace str() with pycompat.bytestr() or ('%d' % int)
ClosedPublic

Authored by pulkit on Nov 23 2018, 2:35 PM.

Details

Summary

After this patch, test-fastannotate-diffopts.t is about to pass. There are some
extra newlines in the output.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Nov 23 2018, 2:35 PM
yuja added a subscriber: yuja.Nov 23 2018, 10:20 PM
  • revenc = lambda x: wrev if x is None else str(x) + wrevpad
  • csetenc = lambda x: wnode if x is None else str(x) + ' '

+ revenc = lambda x: wrev if x is None else ('%d' % x) + wrevpad
+ csetenc = lambda x: wnode if x is None else pycompat.bytestr(x) + ' '

check-code complains that the line is too long. Maybe rewrite as a function?

In D5300#78881, @yuja wrote:
  • revenc = lambda x: wrev if x is None else str(x) + wrevpad
  • csetenc = lambda x: wnode if x is None else str(x) + ' '

+ revenc = lambda x: wrev if x is None else ('%d' % x) + wrevpad
+ csetenc = lambda x: wnode if x is None else pycompat.bytestr(x) + ' '

check-code complains that the line is too long. Maybe rewrite as a function?

Ah, looks like I forgot to run tests. Sorry about that.

pulkit updated this revision to Diff 12594.Nov 26 2018, 6:46 AM
This revision was automatically updated to reflect the committed changes.