This is an archive of the discontinued Mercurial Phabricator instance.

cleanup: remove pointless r-prefixes on double-quoted strings
ClosedPublic

Authored by durin42 on Nov 7 2019, 2:36 PM.

Details

Summary

This is only double-quoted strings. I'll do single-quoted strings as a
second step. These had existed because our source transformer didn't
turn r"" into b"", so we had tagged some strings as r-strings to get
"native" strings on both Pythons. Now that the transformer is gone, we
can dispense with this nonsense.

Methodology:

I ran

hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$'  | xargs egrep --color=never -n  -- \[\^a-z\]r\"\[\^\"\\\\\]\*\"\[\^\"\]

in an emacs grep-mode buffer, and then used a keyboard macro to
iterate over the results and remove the r prefix as needed.

  1. skip-blame removing unneeded r prefixes left over from Python 3 migration.

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

durin42 created this revision.Nov 7 2019, 2:36 PM
indygreg accepted this revision.Nov 8 2019, 11:58 AM
indygreg added a subscriber: indygreg.

Thank you so much for doing this! The presence of raw literals since removing the source transformer has been bothering me too. In the ideal world, we ban the use of raw literals except in literals containing backslashes or newlines.

This revision is now accepted and ready to land.Nov 8 2019, 11:58 AM