Fix compatibility with Python < 2.7
Review Request #6207 — Created Aug. 7, 2014 and submitted
My change for handling alternate casing in svn:keywords only worked with Python
2.7 (prior versions don't have a `flags` argument to `re.sub()`).This change makes it so we compile the regex first using re.IGNORECASE, and
then call the substitution method on the regex object.Testing done: Ran tests under python 2.6
Ran tests under python 2.6
-
Tool: Pyflakes Processed Files: reviewboard/scmtools/tests.py reviewboard/scmtools/svn.py Tool: PEP8 Style Checker Processed Files: reviewboard/scmtools/tests.py reviewboard/scmtools/svn.py
-
Instead of all this, you can just put
(?i)
at the very beginning of the regex string, and it'll activate the right flag.
- Description:
-
My change for handling alternate casing in svn:keywords only worked with Python
~ 2.7 (prior versions don't have a flags
argument tore.sub()
). After doing~ some investigation, I've decided that we don't actually need to do the regex ~ sub with re.IGNORECASE
, because the match is based on the particular contents~ of the svn:keywords property for the given file, and not on our keywords list ~ (which is used for substitutions). ~ 2.7 (prior versions don't have a `flags` argument to `re.sub()`). ~ ~ This change makes it so we compile the regex first using re.IGNORECASE, and
~ then call the substitution method on the regex object. ~ + Testing done: Ran tests under python 2.6
- Commit:
-
e4df0ece6b21a8a3c47e30a6c3be33c7b6ed85eee0cef2be1d2a53b637a2dbeac11d746e1fc391f2