##// END OF EJS Templates
unionrepo: use pathutil.normasprefix to ensure os.sep at the end of cwd...
unionrepo: use pathutil.normasprefix to ensure os.sep at the end of cwd Since Python 2.7.9, "os.path.join(path, '')" doesn't add "os.sep" at the end of UNC path (see issue4557 for detail). This makes unionrepo incorrectly work, if: 1. cwd is the root of UNC share (e.g. "\host\share"), and 2. mainreporoot is near cwd (e.g. "\host\sharefoo\repo") - host of UNC path is same as one of cwd - share of UNC path starts with one of cwd 3. "repopath" isn't specified in URI (e.g. "union:path/to/repo2") For example: $ hg --cwd \host\share -R \host\sharefoo\repo incoming union:path\to\repo2 In this case: - os.path.join(r"\host\share", "") returns r"\host\share", - r"\host\sharefoo\repo".startswith(r"\host\share") returns True, then - r"foo\repo" is treated as repopath of unionrepo instead of r"\host\sharefoo\repo" This causes failure of combining "\host\sharefoo\repo" and another repository: in addition to it, "\host\share\foo\repo" may be combined with another repository, if it accidentally exists. This patch uses "pathutil.normasprefix()" to ensure "os.sep" at the end of cwd safely, even with some problematic encodings, which use 0x5c (= "os.sep" on Windows) as the tail byte of some multi-byte characters. BTW, normalization before "pathutil.normasprefix()" isn't needed in this case, because "os.getcwd()" always returns normalized one.
FUJIWARA Katsunori -
r24835:e4f75c93 stable
Show More
Name Size Modified Last Commit Author
/ mercurial
default.d
help
hgweb
httpclient
pure
templates
__init__.py Loading ...
ancestor.py Loading ...
archival.py Loading ...
base85.c Loading ...
bdiff.c Loading ...
bookmarks.py Loading ...
branchmap.py Loading ...
bundle2.py Loading ...
bundlerepo.py Loading ...
byterange.py Loading ...
changegroup.py Loading ...
changelog.py Loading ...
cmdutil.py Loading ...
commands.py Loading ...
commandserver.py Loading ...
config.py Loading ...
context.py Loading ...
copies.py Loading ...
crecord.py Loading ...
dagparser.py Loading ...
dagutil.py Loading ...
demandimport.py Loading ...
diffhelpers.c Loading ...
dirs.c Loading ...
dirstate.py Loading ...
discovery.py Loading ...
dispatch.py Loading ...
dummycert.pem Loading ...
encoding.py Loading ...
error.py Loading ...
exchange.py Loading ...
exewrapper.c Loading ...
extensions.py Loading ...
fancyopts.py Loading ...
filelog.py Loading ...
filemerge.py Loading ...
fileset.py Loading ...
formatter.py Loading ...
graphmod.py Loading ...
hbisect.py Loading ...
help.py Loading ...
hg.py Loading ...
hook.py Loading ...
httpconnection.py Loading ...
httppeer.py Loading ...
i18n.py Loading ...
ignore.py Loading ...
keepalive.py Loading ...
localrepo.py Loading ...
lock.py Loading ...
lsprof.py Loading ...
lsprofcalltree.py Loading ...
mail.py Loading ...
manifest.c Loading ...
manifest.py Loading ...
match.py Loading ...
mdiff.py Loading ...
merge.py Loading ...
minirst.py Loading ...
mpatch.c Loading ...
namespaces.py Loading ...
node.py Loading ...
obsolete.py Loading ...
osutil.c Loading ...
parser.py Loading ...
parsers.c Loading ...
patch.py Loading ...
pathencode.c Loading ...
pathutil.py Loading ...
peer.py Loading ...
phases.py Loading ...
posix.py Loading ...
pushkey.py Loading ...
pvec.py Loading ...
py3kcompat.py Loading ...
repair.py Loading ...
repoview.py Loading ...
revlog.py Loading ...
revset.py Loading ...
scmposix.py Loading ...
scmutil.py Loading ...
scmwindows.py Loading ...
setdiscovery.py Loading ...
similar.py Loading ...
simplemerge.py Loading ...
sshpeer.py Loading ...
sshserver.py Loading ...
sslutil.py Loading ...
statichttprepo.py Loading ...
store.py Loading ...
strutil.py Loading ...
subrepo.py Loading ...
tagmerge.py Loading ...
tags.py Loading ...
templatefilters.py Loading ...
templatekw.py Loading ...
templater.py Loading ...
transaction.py Loading ...
treediscovery.py Loading ...
ui.py Loading ...
unionrepo.py Loading ...
url.py Loading ...
util.h Loading ...
util.py Loading ...
verify.py Loading ...
win32.py Loading ...
windows.py Loading ...
wireproto.py Loading ...
worker.py Loading ...