##// END OF EJS Templates
with: use context manager for transaction in changegroup apply...
Bryan O'Sullivan -
r27867:7ced54eb default
parent child Browse files
Show More
@@ -323,8 +323,9 b' class cg1unpacker(object):'
323 323
324 324 changesets = files = revisions = 0
325 325
326 tr = repo.transaction("\n".join([srctype, util.hidepassword(url)]))
327 326 try:
327 with repo.transaction("\n".join([srctype,
328 util.hidepassword(url)])) as tr:
328 329 # The transaction could have been created before and already
329 330 # carries source information. In this case we use the top
330 331 # level data. We overwrite the argument because we need to use
@@ -349,8 +350,8 b' class cg1unpacker(object):'
349 350 self._total = total
350 351 self._count = 1
351 352 def __call__(self):
352 repo.ui.progress(self._step, self._count, unit=_('chunks'),
353 total=self._total)
353 repo.ui.progress(self._step, self._count,
354 unit=_('chunks'), total=self._total)
354 355 self._count += 1
355 356 self.callback = prog(_('changesets'), expectedtotal)
356 357
@@ -377,7 +378,8 b' class cg1unpacker(object):'
377 378 if repo.ui.configbool('server', 'validate', default=False):
378 379 # validate incoming csets have their manifests
379 380 for cset in xrange(clstart, clend):
380 mfnode = repo.changelog.read(repo.changelog.node(cset))[0]
381 mfnode = repo.changelog.read(
382 repo.changelog.node(cset))[0]
381 383 mfest = repo.manifest.readdelta(mfnode)
382 384 # store file nodes we must see
383 385 for f, n in mfest.iteritems():
@@ -429,12 +431,15 b' class cg1unpacker(object):'
429 431 # We should not use added here but the list of all change in
430 432 # the bundle
431 433 if publishing:
432 phases.advanceboundary(repo, tr, phases.public, srccontent)
434 phases.advanceboundary(repo, tr, phases.public,
435 srccontent)
433 436 else:
434 # Those changesets have been pushed from the outside, their
435 # phases are going to be pushed alongside. Therefor
436 # `targetphase` is ignored.
437 phases.advanceboundary(repo, tr, phases.draft, srccontent)
437 # Those changesets have been pushed from the
438 # outside, their phases are going to be pushed
439 # alongside. Therefor `targetphase` is
440 # ignored.
441 phases.advanceboundary(repo, tr, phases.draft,
442 srccontent)
438 443 phases.retractboundary(repo, tr, phases.draft, added)
439 444 elif srctype != 'strip':
440 445 # publishing only alter behavior during push
@@ -444,9 +449,10 b' class cg1unpacker(object):'
444 449
445 450 if changesets > 0:
446 451 if srctype != 'strip':
447 # During strip, branchcache is invalid but coming call to
448 # `destroyed` will repair it.
449 # In other case we can safely update cache on disk.
452 # During strip, branchcache is invalid but
453 # coming call to `destroyed` will repair it.
454 # In other case we can safely update cache on
455 # disk.
450 456 branchmap.updatecache(repo.filtered('served'))
451 457
452 458 def runhooks():
@@ -466,7 +472,8 b' class cg1unpacker(object):'
466 472 del args['node_last']
467 473 repo.hook("incoming", **args)
468 474
469 newheads = [h for h in repo.heads() if h not in oldheads]
475 newheads = [h for h in repo.heads()
476 if h not in oldheads]
470 477 repo.ui.log("incoming",
471 478 "%s incoming changes - new heads: %s\n",
472 479 len(added),
@@ -474,11 +481,7 b' class cg1unpacker(object):'
474 481
475 482 tr.addpostclose('changegroup-runhooks-%020i' % clstart,
476 483 lambda tr: repo._afterlock(runhooks))
477
478 tr.close()
479
480 484 finally:
481 tr.release()
482 485 repo.ui.flush()
483 486 # never return 0 here:
484 487 if dh < 0:
General Comments 0
You need to be logged in to leave comments. Login now