mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
85d651396d
Before this patch, "reporelpath()" uses "rstrip(os.sep)" to trim "os.sep" at the end of "parent.root" path. But it doesn't work correctly with some problematic encodings on Windows, because some multi-byte characters in such encodings contain '\\' (0x5c) as the tail byte of them. In such cases, "reporelpath()" leaves unexpected '\\' at the beginning of the path returned to callers. "lcalrepository.root" seems not to have tail "os.sep", because it is always normalized by "os.path.realpath()" in "vfs.__init__()", but in fact it has tail "os.sep", if it is a root (of the drive): path normalization trims tail "os.sep" off "/foo/bar/", but doesn't trim one off "/". So, just avoiding "rstrip(os.sep)" in "reporelpath()" causes regression around issue3033 fixed by e3dfde137fa5. This patch introduces "pathutil.normasprefix" to normalize specified path in the specific way for problematic encodings without regression around issue3033.
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
# this is hack to make sure no escape characters are inserted into the output
|
|
import os, sys
|
|
if 'TERM' in os.environ:
|
|
del os.environ['TERM']
|
|
import doctest
|
|
|
|
def testmod(name, optionflags=0, testtarget=None):
|
|
__import__(name)
|
|
mod = sys.modules[name]
|
|
if testtarget is not None:
|
|
mod = getattr(mod, testtarget)
|
|
doctest.testmod(mod, optionflags=optionflags)
|
|
|
|
testmod('mercurial.changelog')
|
|
testmod('mercurial.dagparser', optionflags=doctest.NORMALIZE_WHITESPACE)
|
|
testmod('mercurial.dispatch')
|
|
testmod('mercurial.encoding')
|
|
testmod('mercurial.hg')
|
|
testmod('mercurial.hgweb.hgwebdir_mod')
|
|
testmod('mercurial.match')
|
|
testmod('mercurial.minirst')
|
|
testmod('mercurial.pathutil')
|
|
testmod('mercurial.revset')
|
|
testmod('mercurial.store')
|
|
testmod('mercurial.subrepo')
|
|
testmod('mercurial.templatefilters')
|
|
testmod('mercurial.ui')
|
|
testmod('mercurial.url')
|
|
testmod('mercurial.util')
|
|
testmod('mercurial.util', testtarget='platform')
|
|
testmod('hgext.convert.cvsps')
|
|
testmod('hgext.convert.filemap')
|
|
testmod('hgext.convert.subversion')
|