##// END OF EJS Templates
pull: move `heads` argument into pull object...
Pierre-Yves David -
r20474:c9bceafc default
parent child Browse files
Show More
@@ -382,14 +382,16 b' class pulloperation(object):'
382 382 afterward.
383 383 """
384 384
385 def __init__(self, repo, remote):
385 def __init__(self, repo, remote, heads=None):
386 386 # repo we pull from
387 387 self.repo = repo
388 388 # repo we pull to
389 389 self.remote = remote
390 # revision we try to pull (None is "all")
391 self.heads = heads
390 392
391 393 def pull(repo, remote, heads=None, force=False):
392 pullop = pulloperation(repo, remote)
394 pullop = pulloperation(repo, remote, heads)
393 395 if pullop.remote.local():
394 396 missing = set(pullop.remote.requirements) - pullop.repo.supported
395 397 if missing:
@@ -406,43 +408,46 b' def pull(repo, remote, heads=None, force'
406 408 try:
407 409 tmp = discovery.findcommonincoming(pullop.repo.unfiltered(),
408 410 pullop.remote,
409 heads=heads, force=force)
411 heads=pullop.heads,
412 force=force)
410 413 common, fetch, rheads = tmp
411 414 if not fetch:
412 415 pullop.repo.ui.status(_("no changes found\n"))
413 416 result = 0
414 417 else:
415 418 tr = pullop.repo.transaction(trname)
416 if heads is None and list(common) == [nullid]:
419 if pullop.heads is None and list(common) == [nullid]:
417 420 pullop.repo.ui.status(_("requesting all changes\n"))
418 elif heads is None and pullop.remote.capable('changegroupsubset'):
421 elif (pullop.heads is None
422 and pullop.remote.capable('changegroupsubset')):
419 423 # issue1320, avoid a race if remote changed after discovery
420 heads = rheads
424 pullop.heads = rheads
421 425
422 426 if pullop.remote.capable('getbundle'):
423 427 # TODO: get bundlecaps from remote
424 428 cg = pullop.remote.getbundle('pull', common=common,
425 heads=heads or rheads)
426 elif heads is None:
429 heads=pullop.heads or rheads)
430 elif pullop.heads is None:
427 431 cg = pullop.remote.changegroup(fetch, 'pull')
428 432 elif not pullop.remote.capable('changegroupsubset'):
429 433 raise util.Abort(_("partial pull cannot be done because "
430 434 "other repository doesn't support "
431 435 "changegroupsubset."))
432 436 else:
433 cg = pullop.remote.changegroupsubset(fetch, heads, 'pull')
437 cg = pullop.remote.changegroupsubset(fetch, pullop.heads,
438 'pull')
434 439 result = pullop.repo.addchangegroup(cg, 'pull',
435 440 pullop.remote.url())
436 441
437 442 # compute target subset
438 if heads is None:
443 if pullop.heads is None:
439 444 # We pulled every thing possible
440 445 # sync on everything common
441 446 subset = common + rheads
442 447 else:
443 448 # We pulled a specific subset
444 449 # sync on this subset
445 subset = heads
450 subset = pullop.heads
446 451
447 452 # Get remote phases data from remote
448 453 remotephases = pullop.remote.listkeys('phases')
General Comments 0
You need to be logged in to leave comments. Login now