tests/test-hybridencode.py
author Adrian Buehlmann <adrian@cadifra.com>
Sat, 13 Dec 2008 18:32:29 +0100
changeset 7515 ee5aba886108
parent 7514 e54cf540c6ca
child 8659 1a6d702e059d
permissions -rwxr-xr-x
store: encode trailing period and space on directory names (issue1417) Windows won't create directories with names ending in period or space, so we encode the last period/space character in directory names of non-hashed paths in the store using reversible ~xx encoding (' ' -> '~20', '.' -> '~2e'). With this change it is possible to remove a directory ending in period or space that was inadvertantly checked in on a linux system while still being able to clone such a repository with its full history to Windows (see also issue793).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7275
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     1
#!/usr/bin/env python
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     2
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     3
from mercurial import store
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     4
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     5
enc = store.hybridencode # used for fncache repo format
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     6
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     7
def show(s):
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     8
    print "A = '%s'" % s
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
     9
    print "B = '%s'" % enc(s)
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    10
    print
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    11
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    12
show('data/aux.bla/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c.i')
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    13
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    14
show('data/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT.i')
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    15
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')
c00cdac22d3c add new test-hybridencode.py
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
    16
show('data/AUX.THE-QUICK-BROWN-FOX-JU:MPS-OVER-THE-LAZY-DOG-THE-QUICK-BROWN-FOX-JUMPS-OVER-THE-LAZY-DOG.TXT.i')
7514
e54cf540c6ca store: don't create dirs ending in period or space for hashed paths (issue1417)
Adrian Buehlmann <adrian@cadifra.com>
parents: 7275
diff changeset
    17
show('data/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
e54cf540c6ca store: don't create dirs ending in period or space for hashed paths (issue1417)
Adrian Buehlmann <adrian@cadifra.com>
parents: 7275
diff changeset
    18
show('data/Project.Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt')
7515
ee5aba886108 store: encode trailing period and space on directory names (issue1417)
Adrian Buehlmann <adrian@cadifra.com>
parents: 7514
diff changeset
    19
show('data/foo.../foo   / /a./_. /__/.x../    bla/something.i')