All previous usages have been migrated. So let us add a check-code rules to
catch future usages.
We restrict it to mercurial/ and hgext/ because multiple other script never
depends on Mercurial modules.
( )
| Alphare |
| hg-reviewers |
All previous usages have been migrated. So let us add a check-code rules to
catch future usages.
We restrict it to mercurial/ and hgext/ because multiple other script never
depends on Mercurial modules.
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | contrib/check-code.py (23 lines) |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | Alphare | ||
| Closed | Alphare | ||
| Closed | Alphare | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | Alphare | ||
| Closed | marmoute | ||
| Abandoned | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | D11067 windows: use abspath in url | |
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | Alphare | ||
| Closed | Alphare |
| r"""(?msx)(?P<comment>\#.*?$)| | r"""(?msx)(?P<comment>\#.*?$)| | ||||
| ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) | ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) | ||||
| (?P<text>(([^\\]|\\.)*?)) | (?P<text>(([^\\]|\\.)*?)) | ||||
| (?P=quote))""", | (?P=quote))""", | ||||
| reppython, | reppython, | ||||
| ), | ), | ||||
| ] | ] | ||||
| # pattern only for mercurial and extensions | |||||
| core_py_pats = [ | |||||
| [ | |||||
| # Windows tend to get confused about capitalization of the drive letter | |||||
| # | |||||
| # see mercurial.windows.abspath for details | |||||
| ( | |||||
| r'os\.path\.abspath', | |||||
| "use util.abspath instead (windows)", | |||||
| r'#.*re-exports', | |||||
| ), | |||||
| ], | |||||
| # warnings | |||||
| [], | |||||
| ] | |||||
| # filters to convert normal *.py files | # filters to convert normal *.py files | ||||
| pyfilters = [] + commonpyfilters | pyfilters = [] + commonpyfilters | ||||
| # non-filter patterns | # non-filter patterns | ||||
| pynfpats = [ | pynfpats = [ | ||||
| [ | [ | ||||
| (r'pycompat\.osname\s*[=!]=\s*[\'"]nt[\'"]', "use pycompat.iswindows"), | (r'pycompat\.osname\s*[=!]=\s*[\'"]nt[\'"]', "use pycompat.iswindows"), | ||||
| (r'pycompat\.osname\s*[=!]=\s*[\'"]posix[\'"]', "use pycompat.isposix"), | (r'pycompat\.osname\s*[=!]=\s*[\'"]posix[\'"]', "use pycompat.isposix"), | ||||
| ('python', r'.*hgext.*\.py$', '', [], pyextnfpats), | ('python', r'.*hgext.*\.py$', '', [], pyextnfpats), | ||||
| ( | ( | ||||
| 'python 3', | 'python 3', | ||||
| r'.*(hgext|mercurial)/(?!demandimport|policy|pycompat).*\.py', | r'.*(hgext|mercurial)/(?!demandimport|policy|pycompat).*\.py', | ||||
| '', | '', | ||||
| pyfilters, | pyfilters, | ||||
| py3pats, | py3pats, | ||||
| ), | ), | ||||
| ( | |||||
| 'core files', | |||||
| r'.*(hgext|mercurial)/(?!demandimport|policy|pycompat).*\.py', | |||||
| '', | |||||
| pyfilters, | |||||
| core_py_pats, | |||||
| ), | |||||
| ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats), | ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats), | ||||
| ('c', r'.*\.[ch]$', '', cfilters, cpats), | ('c', r'.*\.[ch]$', '', cfilters, cpats), | ||||
| ('unified test', r'.*\.t$', '', utestfilters, utestpats), | ('unified test', r'.*\.t$', '', utestfilters, utestpats), | ||||
| ( | ( | ||||
| 'layering violation repo in revlog', | 'layering violation repo in revlog', | ||||
| r'mercurial/revlog\.py', | r'mercurial/revlog\.py', | ||||
| '', | '', | ||||
| pyfilters, | pyfilters, | ||||