##// END OF EJS Templates
pull: make pulled subset a propertycache of the pull object...
Pierre-Yves David -
r20487:f715cc0b default
parent child Browse files
Show More
@@ -395,8 +395,23 b' class pulloperation(object):'
395 self._trname = 'pull\n' + util.hidepassword(remote.url())
395 self._trname = 'pull\n' + util.hidepassword(remote.url())
396 # hold the transaction once created
396 # hold the transaction once created
397 self._tr = None
397 self._tr = None
398 # heads of the set of changeset target by the pull
398 # set of common changeset between local and remote before pull
399 self.pulledsubset = None
399 self.common = None
400 # set of pulled head
401 self.rheads = None
402
403 @util.propertycache
404 def pulledsubset(self):
405 """heads of the set of changeset target by the pull"""
406 # compute target subset
407 if self.heads is None:
408 # We pulled every thing possible
409 # sync on everything common
410 return self.common + self.rheads
411 else:
412 # We pulled a specific subset
413 # sync on this subset
414 return self.heads
400
415
401 def gettransaction(self):
416 def gettransaction(self):
402 """get appropriate pull transaction, creating it if needed"""
417 """get appropriate pull transaction, creating it if needed"""
@@ -430,7 +445,7 b' def pull(repo, remote, heads=None, force'
430 pullop.remote,
445 pullop.remote,
431 heads=pullop.heads,
446 heads=pullop.heads,
432 force=force)
447 force=force)
433 common, fetch, rheads = tmp
448 pullop.common, fetch, pullop.rheads = tmp
434 if not fetch:
449 if not fetch:
435 pullop.repo.ui.status(_("no changes found\n"))
450 pullop.repo.ui.status(_("no changes found\n"))
436 result = 0
451 result = 0
@@ -439,17 +454,19 b' def pull(repo, remote, heads=None, force'
439 # don't open transaction for nothing or you break future useful
454 # don't open transaction for nothing or you break future useful
440 # rollback call
455 # rollback call
441 pullop.gettransaction()
456 pullop.gettransaction()
442 if pullop.heads is None and list(common) == [nullid]:
457 if pullop.heads is None and list(pullop.common) == [nullid]:
443 pullop.repo.ui.status(_("requesting all changes\n"))
458 pullop.repo.ui.status(_("requesting all changes\n"))
444 elif (pullop.heads is None
459 elif (pullop.heads is None
445 and pullop.remote.capable('changegroupsubset')):
460 and pullop.remote.capable('changegroupsubset')):
446 # issue1320, avoid a race if remote changed after discovery
461 # issue1320, avoid a race if remote changed after discovery
447 pullop.heads = rheads
462 pullop.heads = pullop.rheads
448
463
449 if pullop.remote.capable('getbundle'):
464 if pullop.remote.capable('getbundle'):
450 # TODO: get bundlecaps from remote
465 # TODO: get bundlecaps from remote
451 cg = pullop.remote.getbundle('pull', common=common,
466 cg = pullop.remote.getbundle('pull',
452 heads=pullop.heads or rheads)
467 common=pullop.common,
468 heads=(pullop.heads
469 or pullop.rheads))
453 elif pullop.heads is None:
470 elif pullop.heads is None:
454 cg = pullop.remote.changegroup(fetch, 'pull')
471 cg = pullop.remote.changegroup(fetch, 'pull')
455 elif not pullop.remote.capable('changegroupsubset'):
472 elif not pullop.remote.capable('changegroupsubset'):
@@ -462,17 +479,6 b' def pull(repo, remote, heads=None, force'
462 result = pullop.repo.addchangegroup(cg, 'pull',
479 result = pullop.repo.addchangegroup(cg, 'pull',
463 pullop.remote.url())
480 pullop.remote.url())
464
481
465 # compute target subset
466 if pullop.heads is None:
467 # We pulled every thing possible
468 # sync on everything common
469 subset = common + rheads
470 else:
471 # We pulled a specific subset
472 # sync on this subset
473 subset = pullop.heads
474 pullop.pulledsubset = subset
475
476 _pullphase(pullop)
482 _pullphase(pullop)
477 _pullobsolete(pullop)
483 _pullobsolete(pullop)
478 pullop.closetransaction()
484 pullop.closetransaction()
General Comments 0
You need to be logged in to leave comments. Login now