##// END OF EJS Templates
changegroup: move changegroup file adding to a separate function...
Durham Goode -
r19291:93635f69 default
parent child Browse files
Show More
@@ -2143,41 +2143,10 class localrepository(object):
2143 2143 pr.total = efiles
2144 2144 source.callback = None
2145 2145
2146 while True:
2147 chunkdata = source.filelogheader()
2148 if not chunkdata:
2149 break
2150 f = chunkdata["filename"]
2151 self.ui.debug("adding %s revisions\n" % f)
2152 pr()
2153 fl = self.file(f)
2154 o = len(fl)
2155 if not fl.addgroup(source, revmap, trp):
2156 raise util.Abort(_("received file revlog group is empty"))
2157 revisions += len(fl) - o
2158 files += 1
2159 if f in needfiles:
2160 needs = needfiles[f]
2161 for new in xrange(o, len(fl)):
2162 n = fl.node(new)
2163 if n in needs:
2164 needs.remove(n)
2165 else:
2166 raise util.Abort(
2167 _("received spurious file revlog entry"))
2168 if not needs:
2169 del needfiles[f]
2170 self.ui.progress(_('files'), None)
2171
2172 for f, needs in needfiles.iteritems():
2173 fl = self.file(f)
2174 for n in needs:
2175 try:
2176 fl.rev(n)
2177 except error.LookupError:
2178 raise util.Abort(
2179 _('missing file data for %s:%s - run hg verify') %
2180 (f, hex(n)))
2146 newrevs, newfiles = self.addchangegroupfiles(source, revmap, trp,
2147 pr, needfiles)
2148 revisions += newrevs
2149 files += newfiles
2181 2150
2182 2151 dh = 0
2183 2152 if oldheads:
@@ -2257,6 +2226,47 class localrepository(object):
2257 2226 else:
2258 2227 return dh + 1
2259 2228
2229 def addchangegroupfiles(self, source, revmap, trp, pr, needfiles):
2230 revisions = 0
2231 files = 0
2232 while True:
2233 chunkdata = source.filelogheader()
2234 if not chunkdata:
2235 break
2236 f = chunkdata["filename"]
2237 self.ui.debug("adding %s revisions\n" % f)
2238 pr()
2239 fl = self.file(f)
2240 o = len(fl)
2241 if not fl.addgroup(source, revmap, trp):
2242 raise util.Abort(_("received file revlog group is empty"))
2243 revisions += len(fl) - o
2244 files += 1
2245 if f in needfiles:
2246 needs = needfiles[f]
2247 for new in xrange(o, len(fl)):
2248 n = fl.node(new)
2249 if n in needs:
2250 needs.remove(n)
2251 else:
2252 raise util.Abort(
2253 _("received spurious file revlog entry"))
2254 if not needs:
2255 del needfiles[f]
2256 self.ui.progress(_('files'), None)
2257
2258 for f, needs in needfiles.iteritems():
2259 fl = self.file(f)
2260 for n in needs:
2261 try:
2262 fl.rev(n)
2263 except error.LookupError:
2264 raise util.Abort(
2265 _('missing file data for %s:%s - run hg verify') %
2266 (f, hex(n)))
2267
2268 return revisions, files
2269
2260 2270 def stream_in(self, remote, requirements):
2261 2271 lock = self.lock()
2262 2272 try:
General Comments 0
You need to be logged in to leave comments. Login now