Mercurial > hg-stable
changeset 7514:e54cf540c6ca
store: don't create dirs ending in period or space for hashed paths (issue1417)
Windows won't create directories with names ending in period or space, so
we replace the last period/space character in truncated directory names of
hashed paths with some other character (underbar).
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Sat, 13 Dec 2008 17:39:56 +0100 |
parents | fed8f75f29ce |
children | ee5aba886108 |
files | mercurial/store.py tests/test-hybridencode.py tests/test-hybridencode.py.out |
diffstat | 3 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/store.py Thu Dec 11 13:33:35 2008 +0000 +++ b/mercurial/store.py Sat Dec 13 17:39:56 2008 +0100 @@ -111,6 +111,9 @@ sdirs = [] for p in parts[:-1]: d = p[:DIR_PREFIX_LEN] + if d[-1] in '. ': + # Windows can't access dirs ending in period or space + d = d[:-1] + '_' t = '/'.join(sdirs) + '/' + d if len(t) > _MAX_SHORTENED_DIRS_LEN: break
--- a/tests/test-hybridencode.py Thu Dec 11 13:33:35 2008 +0000 +++ b/tests/test-hybridencode.py Sat Dec 13 17:39:56 2008 +0100 @@ -14,3 +14,5 @@ show('data/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT.i') show('data/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider.i') show('data/AUX.THE-QUICK-BROWN-FOX-JU:MPS-OVER-THE-LAZY-DOG-THE-QUICK-BROWN-FOX-JUMPS-OVER-THE-LAZY-DOG.TXT.i') +show('data/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt') +show('data/Project.Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
--- a/tests/test-hybridencode.py.out Thu Dec 11 13:33:35 2008 +0000 +++ b/tests/test-hybridencode.py.out Sat Dec 13 17:39:56 2008 +0100 @@ -10,3 +10,9 @@ A = 'data/AUX.THE-QUICK-BROWN-FOX-JU:MPS-OVER-THE-LAZY-DOG-THE-QUICK-BROWN-FOX-JUMPS-OVER-THE-LAZY-DOG.TXT.i' B = 'dh/au~78.the-quick-brown-fox-ju~3amps-over-the-lazy-dog-the-quick-brown-fox-jud4dcadd033000ab2b26eb66bae1906bcb15d4a70.i' +A = 'data/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt' +B = 'dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilenaf93030515d9849cfdca52937c2204d19f83913e5.txt' + +A = 'data/Project.Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt' +B = 'dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilena0fd7c506f5c9d58204444fc67e9499006bd2d445.txt' +