comparison mercurial/localrepo.py @ 11932:01778673aab7

localrepo: add parentdelta to requires only if enabled in config file
author Pradeepkumar Gayam <in3xes@gmail.com>
date Tue, 10 Aug 2010 22:28:08 +0530
parents eb07fbc21e9c
children ff1044230bca
comparison
equal deleted inserted replaced
11931:6051db1327f8 11932:01778673aab7
19 import weakref, errno, os, time, inspect 19 import weakref, errno, os, time, inspect
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 supported = set('revlogv1 store fncache shared'.split()) 24 supported = set('revlogv1 store fncache shared parentdelta'.split())
25 25
26 def __init__(self, baseui, path=None, create=0): 26 def __init__(self, baseui, path=None, create=0):
27 repo.repository.__init__(self) 27 repo.repository.__init__(self)
28 self.root = os.path.realpath(util.expandpath(path)) 28 self.root = os.path.realpath(util.expandpath(path))
29 self.path = os.path.join(self.root, ".hg") 29 self.path = os.path.join(self.root, ".hg")
53 # create an invalid changelog 53 # create an invalid changelog
54 self.opener("00changelog.i", "a").write( 54 self.opener("00changelog.i", "a").write(
55 '\0\0\0\2' # represents revlogv2 55 '\0\0\0\2' # represents revlogv2
56 ' dummy changelog to prevent using the old repo layout' 56 ' dummy changelog to prevent using the old repo layout'
57 ) 57 )
58 if self.ui.configbool('format', 'parentdelta', False):
59 requirements.append("parentdelta")
58 reqfile = self.opener("requires", "w") 60 reqfile = self.opener("requires", "w")
59 for r in requirements: 61 for r in requirements:
60 reqfile.write("%s\n" % r) 62 reqfile.write("%s\n" % r)
61 reqfile.close() 63 reqfile.close()
62 else: 64 else:
89 self.spath = self.store.path 91 self.spath = self.store.path
90 self.sopener = self.store.opener 92 self.sopener = self.store.opener
91 self.sjoin = self.store.join 93 self.sjoin = self.store.join
92 self.opener.createmode = self.store.createmode 94 self.opener.createmode = self.store.createmode
93 self.sopener.options = {} 95 self.sopener.options = {}
96 if 'parentdelta' in requirements:
97 self.sopener.options['parentdelta'] = 1
94 98
95 # These two define the set of tags for this repository. _tags 99 # These two define the set of tags for this repository. _tags
96 # maps tag name to node; _tagtypes maps tag name to 'global' or 100 # maps tag name to node; _tagtypes maps tag name to 'global' or
97 # 'local'. (Global tags are defined by .hgtags across all 101 # 'local'. (Global tags are defined by .hgtags across all
98 # heads, and local tags are defined in .hg/localtags.) They 102 # heads, and local tags are defined in .hg/localtags.) They