comparison mercurial/exchange.py @ 20488:76e66654f74e

pull: move `fetch` subset into the object Tree discovey use a `fetch` variable to know what is being pulled. We move this information in the `pulloperation` object. This make it possible to extract the changeset pulling logic into its own function.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 11 Feb 2014 14:51:38 -0800
parents f715cc0b5107
children 7b5ec1c7e8e2
comparison
equal deleted inserted replaced
20487:f715cc0b5107 20488:76e66654f74e
397 self._tr = None 397 self._tr = None
398 # set of common changeset between local and remote before pull 398 # set of common changeset between local and remote before pull
399 self.common = None 399 self.common = None
400 # set of pulled head 400 # set of pulled head
401 self.rheads = None 401 self.rheads = None
402 # list of missing changeset to fetch remotly
403 self.fetch = None
402 404
403 @util.propertycache 405 @util.propertycache
404 def pulledsubset(self): 406 def pulledsubset(self):
405 """heads of the set of changeset target by the pull""" 407 """heads of the set of changeset target by the pull"""
406 # compute target subset 408 # compute target subset
443 try: 445 try:
444 tmp = discovery.findcommonincoming(pullop.repo.unfiltered(), 446 tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
445 pullop.remote, 447 pullop.remote,
446 heads=pullop.heads, 448 heads=pullop.heads,
447 force=force) 449 force=force)
448 pullop.common, fetch, pullop.rheads = tmp 450 pullop.common, pullop.fetch, pullop.rheads = tmp
449 if not fetch: 451 if not pullop.fetch:
450 pullop.repo.ui.status(_("no changes found\n")) 452 pullop.repo.ui.status(_("no changes found\n"))
451 result = 0 453 result = 0
452 else: 454 else:
453 # We delay the open of the transaction as late as possible so we 455 # We delay the open of the transaction as late as possible so we
454 # don't open transaction for nothing or you break future useful 456 # don't open transaction for nothing or you break future useful
466 cg = pullop.remote.getbundle('pull', 468 cg = pullop.remote.getbundle('pull',
467 common=pullop.common, 469 common=pullop.common,
468 heads=(pullop.heads 470 heads=(pullop.heads
469 or pullop.rheads)) 471 or pullop.rheads))
470 elif pullop.heads is None: 472 elif pullop.heads is None:
471 cg = pullop.remote.changegroup(fetch, 'pull') 473 cg = pullop.remote.changegroup(pullop.fetch, 'pull')
472 elif not pullop.remote.capable('changegroupsubset'): 474 elif not pullop.remote.capable('changegroupsubset'):
473 raise util.Abort(_("partial pull cannot be done because " 475 raise util.Abort(_("partial pull cannot be done because "
474 "other repository doesn't support " 476 "other repository doesn't support "
475 "changegroupsubset.")) 477 "changegroupsubset."))
476 else: 478 else:
477 cg = pullop.remote.changegroupsubset(fetch, pullop.heads, 479 cg = pullop.remote.changegroupsubset(pullop.fetch,
480 pullop.heads,
478 'pull') 481 'pull')
479 result = pullop.repo.addchangegroup(cg, 'pull', 482 result = pullop.repo.addchangegroup(cg, 'pull',
480 pullop.remote.url()) 483 pullop.remote.url())
481 484
482 _pullphase(pullop) 485 _pullphase(pullop)