##// END OF EJS Templates
pull: move changeset pulling in its own function...
Pierre-Yves David -
r20489:7b5ec1c7 default
parent child Browse files
Show More
@@ -452,35 +452,7 b' def pull(repo, remote, heads=None, force'
452 pullop.repo.ui.status(_("no changes found\n"))
452 pullop.repo.ui.status(_("no changes found\n"))
453 result = 0
453 result = 0
454 else:
454 else:
455 # We delay the open of the transaction as late as possible so we
455 result = _pullchangeset(pullop)
456 # don't open transaction for nothing or you break future useful
457 # rollback call
458 pullop.gettransaction()
459 if pullop.heads is None and list(pullop.common) == [nullid]:
460 pullop.repo.ui.status(_("requesting all changes\n"))
461 elif (pullop.heads is None
462 and pullop.remote.capable('changegroupsubset')):
463 # issue1320, avoid a race if remote changed after discovery
464 pullop.heads = pullop.rheads
465
466 if pullop.remote.capable('getbundle'):
467 # TODO: get bundlecaps from remote
468 cg = pullop.remote.getbundle('pull',
469 common=pullop.common,
470 heads=(pullop.heads
471 or pullop.rheads))
472 elif pullop.heads is None:
473 cg = pullop.remote.changegroup(pullop.fetch, 'pull')
474 elif not pullop.remote.capable('changegroupsubset'):
475 raise util.Abort(_("partial pull cannot be done because "
476 "other repository doesn't support "
477 "changegroupsubset."))
478 else:
479 cg = pullop.remote.changegroupsubset(pullop.fetch,
480 pullop.heads,
481 'pull')
482 result = pullop.repo.addchangegroup(cg, 'pull',
483 pullop.remote.url())
484
456
485 _pullphase(pullop)
457 _pullphase(pullop)
486 _pullobsolete(pullop)
458 _pullobsolete(pullop)
@@ -491,6 +463,32 b' def pull(repo, remote, heads=None, force'
491
463
492 return result
464 return result
493
465
466 def _pullchangeset(pullop):
467 """pull changeset from unbundle into the local repo"""
468 # We delay the open of the transaction as late as possible so we
469 # don't open transaction for nothing or you break future useful
470 # rollback call
471 pullop.gettransaction()
472 if pullop.heads is None and list(pullop.common) == [nullid]:
473 pullop.repo.ui.status(_("requesting all changes\n"))
474 elif pullop.heads is None and pullop.remote.capable('changegroupsubset'):
475 # issue1320, avoid a race if remote changed after discovery
476 pullop.heads = pullop.rheads
477
478 if pullop.remote.capable('getbundle'):
479 # TODO: get bundlecaps from remote
480 cg = pullop.remote.getbundle('pull', common=pullop.common,
481 heads=pullop.heads or pullop.rheads)
482 elif pullop.heads is None:
483 cg = pullop.remote.changegroup(pullop.fetch, 'pull')
484 elif not pullop.remote.capable('changegroupsubset'):
485 raise util.Abort(_("partial pull cannot be done because "
486 "other repository doesn't support "
487 "changegroupsubset."))
488 else:
489 cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
490 return pullop.repo.addchangegroup(cg, 'pull', pullop.remote.url())
491
494 def _pullphase(pullop):
492 def _pullphase(pullop):
495 # Get remote phases data from remote
493 # Get remote phases data from remote
496 remotephases = pullop.remote.listkeys('phases')
494 remotephases = pullop.remote.listkeys('phases')
General Comments 0
You need to be logged in to leave comments. Login now