##// END OF EJS Templates
merge with crew
Matt Mackall -
r12297:a424fa60 merge 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):
@@ -1775,7 +1784,7 b' class localrepository(repo.repository):'
1775 1784 return newheads - oldheads + 1
1776 1785
1777 1786
1778 def stream_in(self, remote):
1787 def stream_in(self, remote, requirements):
1779 1788 fp = remote.stream_out()
1780 1789 l = fp.readline()
1781 1790 try:
@@ -1820,6 +1829,13 b' class localrepository(repo.repository):'
1820 1829 self.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') %
1821 1830 (util.bytecount(total_bytes), elapsed,
1822 1831 util.bytecount(total_bytes / elapsed)))
1832
1833 # new requirements = old non-format requirements + new format-related
1834 # requirements from the streamed-in repository
1835 requirements.update(set(self.requirements) - self.supportedformats)
1836 self._applyrequirements(requirements)
1837 self._writerequirements()
1838
1823 1839 self.invalidate()
1824 1840 return len(self.heads()) + 1
1825 1841
@@ -1838,8 +1854,17 b' class localrepository(repo.repository):'
1838 1854 # and format flags on "stream" capability, and use
1839 1855 # uncompressed only if compatible.
1840 1856
1841 if stream and not heads and remote.capable('stream'):
1842 return self.stream_in(remote)
1857 if stream and not heads:
1858 # 'stream' means remote revlog format is revlogv1 only
1859 if remote.capable('stream'):
1860 return self.stream_in(remote, set(('revlogv1',)))
1861 # otherwise, 'streamreqs' contains the remote revlog format
1862 streamreqs = remote.capable('streamreqs')
1863 if streamreqs:
1864 streamreqs = set(streamreqs.split(','))
1865 # if we support it, stream in and adjust our requirements
1866 if not streamreqs - self.supportedformats:
1867 return self.stream_in(remote, streamreqs)
1843 1868 return self.pull(remote, heads)
1844 1869
1845 1870 def pushkey(self, namespace, key, old, new):
@@ -172,7 +172,13 b' def branches(repo, proto, nodes):'
172 172 def capabilities(repo, proto):
173 173 caps = 'lookup changegroupsubset branchmap pushkey'.split()
174 174 if _allowstream(repo.ui):
175 caps.append('stream=%d' % repo.changelog.version)
175 requiredformats = repo.requirements & repo.supportedformats
176 # if our local revlogs are just revlogv1, add 'stream' cap
177 if not requiredformats - set(('revlogv1',)):
178 caps.append('stream')
179 # otherwise, add 'streamreqs' detailing our local revlog format
180 else:
181 caps.append('streamreqs=%s' % ','.join(requiredformats))
176 182 caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
177 183 return ' '.join(caps)
178 184
General Comments 0
You need to be logged in to leave comments. Login now