comparison mercurial/localrepo.py @ 12687:34d8247a4595

store: encode first period or space in filenames (issue1713) - Mac OS X has problems with filenames starting with '._' (e.g. '.FOO' -> '._f_o_o' is now encoded as '~2e_f_o_o') - Explorer of Windows Vista and Windows 7 strip leading spaces of path elements of filenames when copying trees Above problems are avoided by encoding the first space (as '~20') or period (as '~2e') of all path elements. This introduces a new entry 'dotencode' in .hg/requires, that is, a new repository filename layout (inside .hg/store). Newly created repositories require 'dotencode' by default. Specifying [format] dotencode = False in a config file will use the old format instead. Prior Mercurial versions will abort with the message abort: requirement 'dotencode' not supported! when trying to access a local repository that requires 'dotencode'. New 'dotencode' repositories can be converted to the previous repository format with hg --config format.dotencode=0 clone --pull repoA repoB
author Adrian Buehlmann <adrian@cadifra.com>
date Sat, 09 Oct 2010 21:54:50 +0200
parents 01b6f058021b
children 9ca08fbb750a
comparison
equal deleted inserted replaced
12686:fe31f834a9ff 12687:34d8247a4595
20 propertycache = util.propertycache 20 propertycache = util.propertycache
21 21
22 class localrepository(repo.repository): 22 class localrepository(repo.repository):
23 capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey')) 23 capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey'))
24 supportedformats = set(('revlogv1', 'parentdelta')) 24 supportedformats = set(('revlogv1', 'parentdelta'))
25 supported = supportedformats | set(('store', 'fncache', 'shared')) 25 supported = supportedformats | set(('store', 'fncache', 'shared',
26 'dotencode'))
26 27
27 def __init__(self, baseui, path=None, create=0): 28 def __init__(self, baseui, path=None, create=0):
28 repo.repository.__init__(self) 29 repo.repository.__init__(self)
29 self.root = os.path.realpath(util.expandpath(path)) 30 self.root = os.path.realpath(util.expandpath(path))
30 self.path = os.path.join(self.root, ".hg") 31 self.path = os.path.join(self.root, ".hg")
50 if self.ui.configbool('format', 'usestore', True): 51 if self.ui.configbool('format', 'usestore', True):
51 os.mkdir(os.path.join(self.path, "store")) 52 os.mkdir(os.path.join(self.path, "store"))
52 requirements.append("store") 53 requirements.append("store")
53 if self.ui.configbool('format', 'usefncache', True): 54 if self.ui.configbool('format', 'usefncache', True):
54 requirements.append("fncache") 55 requirements.append("fncache")
56 if self.ui.configbool('format', 'dotencode', True):
57 requirements.append('dotencode')
55 # create an invalid changelog 58 # create an invalid changelog
56 self.opener("00changelog.i", "a").write( 59 self.opener("00changelog.i", "a").write(
57 '\0\0\0\2' # represents revlogv2 60 '\0\0\0\2' # represents revlogv2
58 ' dummy changelog to prevent using the old repo layout' 61 ' dummy changelog to prevent using the old repo layout'
59 ) 62 )