( )⚙ D6042 py3: convert filtername to str if it's None

This is an archive of the discontinued Mercurial Phabricator instance.

py3: convert filtername to str if it's None
ClosedPublic

Authored by pulkit on Mar 1 2019, 7:13 PM.

Details

Summary

I have not called pycompat.bytestr() and rather converted the value there
because I am starting to get concerned about the function call overhead of all
this bytes to str or vice versa convert functions.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.Mar 1 2019, 7:13 PM
yuja added a subscriber: yuja.Mar 1 2019, 8:36 PM

+ filtername = repo.filtername
+ if filtername is None:
+ filtername = 'None'

repo.ui.log('branchcache', 'updated %s branch cache in %.4f seconds\n',
  • repo.filtername, duration)

+ filtername, duration)

Perhaps, we can use %r instead. It's just logging, we wouldn't care the output
format. Or simply, repo.filtername or b'None'.

pulkit edited the summary of this revision. (Show Details)Mar 3 2019, 4:02 PM
pulkit updated this revision to Diff 14320.
pulkit updated this revision to Diff 14321.Mar 3 2019, 4:07 PM
This revision was automatically updated to reflect the committed changes.