mq: use fallback patch name if no alpha-numeric in summary line (
issue5025)
Before this patch, "hg qimport -r REV" fails, if the summary line of
description of REV doesn't contain any alpha-numeric bytes.
In this case, all bytes in the summary line 'title' are dropped from
'namebase' by the code path below.
namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_')
'makepatchname()' immediately returns this empty string as valid patch
name, because patch name conflicting against empty string never
exists.
Then, "hg qimport -r REV" is aborted at creation of patch file with
empty filename.
This situation isn't so rare. For example, ordinary texts in Japanese
often consist of non alpha-numeric bytes in UTF-8.
This patch makes 'makepatchname()' use fallback patch name if the
summary line of imported revision doesn't contain any alpha-numeric
bytes.
check-seclevel: pass a ui to the extension loader
Without this, if an import error occurs (as with pypy), the attempt to
report it fails since ui is None.
check-seclevel: add a --debug option
This will make it possible to get semi-meaningful tracebacks if an import
error occurs.
Why care? Trying to run this script under pypy currently fails, but the
true error is obscured.
test-run-tests: glob away a --debug run difference on Windows
This internal test is piped through 'grep -v pwd' to eliminate the pwd alias set
when running with MSYS. Unfortunately, the '.' from the successful run of the
prior internal test precedes the pwd alias for the next test on the same line,
so grep filters out '.' too, except for the final test.
It also looks like there may be a bug with --debug: the output of the internal
test that had this diff says 2 ran, 0 failed (one test being test-failure.t),
but if --debug is omitted from the internal test, then it says 2 ran, 1 failed.
With this longstanding issue fixed, the test suite finally runs cleanly on
Windows (except subrepo merge documented in issue 4988), with 88 skips. \o/
import-checker: force 'ctype.util' to stdlib module
Not having this caused warnings on Windows:
mercurial/pure/osutil.py:12: stdlib import follows local import: os
mercurial/pure/osutil.py:13: stdlib import follows local import: socket
mercurial/pure/osutil.py:14: stdlib import follows local import: stat
mercurial/pure/osutil.py:15: stdlib import follows local import: sys