##// END OF EJS Templates
localrepo: factor out requirement application and write
Sune Foldager -
r12295:3388ab21 default
parent child Browse files
Show More
@@ -21,7 +21,8 b' propertycache = util.propertycache'
21 21
22 22 class localrepository(repo.repository):
23 23 capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey'))
24 supported = set('revlogv1 store fncache shared parentdelta'.split())
24 supportedformats = set(('revlogv1', 'parentdelta'))
25 supported = supportedformats | set(('store', 'fncache', 'shared'))
25 26
26 27 def __init__(self, baseui, path=None, create=0):
27 28 repo.repository.__init__(self)
@@ -58,10 +59,6 b' class localrepository(repo.repository):'
58 59 )
59 60 if self.ui.configbool('format', 'parentdelta', False):
60 61 requirements.append("parentdelta")
61 reqfile = self.opener("requires", "w")
62 for r in requirements:
63 reqfile.write("%s\n" % r)
64 reqfile.close()
65 62 else:
66 63 raise error.RepoError(_("repository %s not found") % path)
67 64 elif create:
@@ -93,9 +90,9 b' class localrepository(repo.repository):'
93 90 self.sopener = self.store.opener
94 91 self.sjoin = self.store.join
95 92 self.opener.createmode = self.store.createmode
96 self.sopener.options = {}
97 if 'parentdelta' in requirements:
98 self.sopener.options['parentdelta'] = 1
93 self._applyrequirements(requirements)
94 if create:
95 self._writerequirements()
99 96
100 97 # These two define the set of tags for this repository. _tags
101 98 # maps tag name to node; _tagtypes maps tag name to 'global' or
@@ -112,6 +109,18 b' class localrepository(repo.repository):'
112 109 self._datafilters = {}
113 110 self._transref = self._lockref = self._wlockref = None
114 111
112 def _applyrequirements(self, requirements):
113 self.requirements = requirements
114 self.sopener.options = {}
115 if 'parentdelta' in requirements:
116 self.sopener.options['parentdelta'] = 1
117
118 def _writerequirements(self):
119 reqfile = self.opener("requires", "w")
120 for r in self.requirements:
121 reqfile.write("%s\n" % r)
122 reqfile.close()
123
115 124 def _checknested(self, path):
116 125 """Determine if path is a legal nested repository."""
117 126 if not path.startswith(self.root):
General Comments 0
You need to be logged in to leave comments. Login now