Show More
@@ -279,151 +279,149 b' class cg1unpacker(object):' | |||
|
279 | 279 | changesets = files = revisions = 0 |
|
280 | 280 | |
|
281 | 281 | try: |
|
282 | if True: | |
|
283 | # The transaction may already carry source information. In this | |
|
284 |
|
|
|
285 | # because we need to use the top level value (if they exist) | |
|
286 | # in this function. | |
|
287 |
|
|
|
288 | url = tr.hookargs.setdefault('url', url) | |
|
289 | repo.hook('prechangegroup', throw=True, **tr.hookargs) | |
|
282 | # The transaction may already carry source information. In this | |
|
283 | # case we use the top level data. We overwrite the argument | |
|
284 | # because we need to use the top level value (if they exist) | |
|
285 | # in this function. | |
|
286 | srctype = tr.hookargs.setdefault('source', srctype) | |
|
287 | url = tr.hookargs.setdefault('url', url) | |
|
288 | repo.hook('prechangegroup', throw=True, **tr.hookargs) | |
|
290 | 289 | |
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
|
|
|
290 | # write changelog data to temp files so concurrent readers | |
|
291 | # will not see an inconsistent view | |
|
292 | cl = repo.changelog | |
|
293 | cl.delayupdate(tr) | |
|
294 | oldheads = set(cl.heads()) | |
|
296 | 295 | |
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
|
296 | trp = weakref.proxy(tr) | |
|
297 | # pull off the changeset group | |
|
298 | repo.ui.status(_("adding changesets\n")) | |
|
299 | clstart = len(cl) | |
|
300 | class prog(object): | |
|
301 | def __init__(self, step, total): | |
|
302 | self._step = step | |
|
303 | self._total = total | |
|
304 | self._count = 1 | |
|
305 | def __call__(self): | |
|
306 | repo.ui.progress(self._step, self._count, unit=_('chunks'), | |
|
307 | total=self._total) | |
|
308 | self._count += 1 | |
|
309 | self.callback = prog(_('changesets'), expectedtotal) | |
|
311 | 310 | |
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
311 | efiles = set() | |
|
312 | def onchangelog(cl, node): | |
|
313 | efiles.update(cl.readfiles(node)) | |
|
315 | 314 | |
|
316 |
|
|
|
317 |
|
|
|
318 | addrevisioncb=onchangelog) | |
|
319 | efiles = len(efiles) | |
|
315 | self.changelogheader() | |
|
316 | cgnodes = cl.addgroup(self, csmap, trp, addrevisioncb=onchangelog) | |
|
317 | efiles = len(efiles) | |
|
320 | 318 | |
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
|
319 | if not (cgnodes or emptyok): | |
|
320 | raise error.Abort(_("received changelog group is empty")) | |
|
321 | clend = len(cl) | |
|
322 | changesets = clend - clstart | |
|
323 | repo.ui.progress(_('changesets'), None) | |
|
324 | self.callback = None | |
|
327 | 325 | |
|
328 |
|
|
|
329 |
|
|
|
330 |
|
|
|
326 | # pull off the manifest group | |
|
327 | repo.ui.status(_("adding manifests\n")) | |
|
328 | self._unpackmanifests(repo, revmap, trp, prog, changesets) | |
|
331 | 329 | |
|
332 |
|
|
|
333 |
|
|
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
|
339 |
|
|
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
|
330 | needfiles = {} | |
|
331 | if repo.ui.configbool('server', 'validate', default=False): | |
|
332 | cl = repo.changelog | |
|
333 | ml = repo.manifestlog | |
|
334 | # validate incoming csets have their manifests | |
|
335 | for cset in xrange(clstart, clend): | |
|
336 | mfnode = cl.changelogrevision(cset).manifest | |
|
337 | mfest = ml[mfnode].readdelta() | |
|
338 | # store file cgnodes we must see | |
|
339 | for f, n in mfest.iteritems(): | |
|
340 | needfiles.setdefault(f, set()).add(n) | |
|
343 | 341 | |
|
344 |
|
|
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
|
342 | # process the files | |
|
343 | repo.ui.status(_("adding file changes\n")) | |
|
344 | newrevs, newfiles = _addchangegroupfiles( | |
|
345 | repo, self, revmap, trp, efiles, needfiles) | |
|
346 | revisions += newrevs | |
|
347 | files += newfiles | |
|
350 | 348 | |
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
|
360 |
|
|
|
349 | deltaheads = 0 | |
|
350 | if oldheads: | |
|
351 | heads = cl.heads() | |
|
352 | deltaheads = len(heads) - len(oldheads) | |
|
353 | for h in heads: | |
|
354 | if h not in oldheads and repo[h].closesbranch(): | |
|
355 | deltaheads -= 1 | |
|
356 | htext = "" | |
|
357 | if deltaheads: | |
|
358 | htext = _(" (%+d heads)") % deltaheads | |
|
361 | 359 | |
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
|
360 | repo.ui.status(_("added %d changesets" | |
|
361 | " with %d changes to %d files%s\n") | |
|
362 | % (changesets, revisions, files, htext)) | |
|
363 | repo.invalidatevolatilesets() | |
|
366 | 364 | |
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
|
365 | if changesets > 0: | |
|
366 | if 'node' not in tr.hookargs: | |
|
367 | tr.hookargs['node'] = hex(cl.node(clstart)) | |
|
368 | tr.hookargs['node_last'] = hex(cl.node(clend - 1)) | |
|
369 | hookargs = dict(tr.hookargs) | |
|
370 | else: | |
|
371 | hookargs = dict(tr.hookargs) | |
|
372 | hookargs['node'] = hex(cl.node(clstart)) | |
|
373 | hookargs['node_last'] = hex(cl.node(clend - 1)) | |
|
374 | repo.hook('pretxnchangegroup', throw=True, **hookargs) | |
|
377 | 375 | |
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
|
391 |
|
|
|
392 |
|
|
|
393 |
|
|
|
394 |
|
|
|
395 |
|
|
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
|
376 | added = [cl.node(r) for r in xrange(clstart, clend)] | |
|
377 | if srctype in ('push', 'serve'): | |
|
378 | # Old servers can not push the boundary themselves. | |
|
379 | # New servers won't push the boundary if changeset already | |
|
380 | # exists locally as secret | |
|
381 | # | |
|
382 | # We should not use added here but the list of all change in | |
|
383 | # the bundle | |
|
384 | if repo.publishing(): | |
|
385 | phases.advanceboundary(repo, tr, phases.public, cgnodes) | |
|
386 | else: | |
|
387 | # Those changesets have been pushed from the | |
|
388 | # outside, their phases are going to be pushed | |
|
389 | # alongside. Therefor `targetphase` is | |
|
390 | # ignored. | |
|
391 | phases.advanceboundary(repo, tr, phases.draft, cgnodes) | |
|
392 | phases.retractboundary(repo, tr, phases.draft, added) | |
|
393 | elif srctype != 'strip': | |
|
394 | # publishing only alter behavior during push | |
|
395 | # | |
|
396 | # strip should not touch boundary at all | |
|
397 | phases.retractboundary(repo, tr, targetphase, added) | |
|
400 | 398 | |
|
401 |
|
|
|
399 | if changesets > 0: | |
|
402 | 400 | |
|
403 |
|
|
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
|
401 | def runhooks(): | |
|
402 | # These hooks run when the lock releases, not when the | |
|
403 | # transaction closes. So it's possible for the changelog | |
|
404 | # to have changed since we last saw it. | |
|
405 | if clstart >= len(repo): | |
|
406 | return | |
|
409 | 407 | |
|
410 |
|
|
|
408 | repo.hook("changegroup", **hookargs) | |
|
411 | 409 | |
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
|
410 | for n in added: | |
|
411 | args = hookargs.copy() | |
|
412 | args['node'] = hex(n) | |
|
413 | del args['node_last'] | |
|
414 | repo.hook("incoming", **args) | |
|
417 | 415 | |
|
418 |
|
|
|
419 |
|
|
|
420 |
|
|
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
|
416 | newheads = [h for h in repo.heads() | |
|
417 | if h not in oldheads] | |
|
418 | repo.ui.log("incoming", | |
|
419 | "%s incoming changes - new heads: %s\n", | |
|
420 | len(added), | |
|
421 | ', '.join([hex(c[:6]) for c in newheads])) | |
|
424 | 422 | |
|
425 |
|
|
|
426 |
|
|
|
423 | tr.addpostclose('changegroup-runhooks-%020i' % clstart, | |
|
424 | lambda tr: repo._afterlock(runhooks)) | |
|
427 | 425 | finally: |
|
428 | 426 | repo.ui.flush() |
|
429 | 427 | # never return 0 here: |
General Comments 0
You need to be logged in to leave comments.
Login now