Show More
@@ -382,14 +382,16 b' class pulloperation(object):' | |||||
382 | afterward. |
|
382 | afterward. | |
383 | """ |
|
383 | """ | |
384 |
|
384 | |||
385 | def __init__(self, repo): |
|
385 | def __init__(self, repo, remote): | |
386 | # repo we pull from |
|
386 | # repo we pull from | |
387 | self.repo = repo |
|
387 | self.repo = repo | |
|
388 | # repo we pull to | |||
|
389 | self.remote = remote | |||
388 |
|
390 | |||
389 | def pull(repo, remote, heads=None, force=False): |
|
391 | def pull(repo, remote, heads=None, force=False): | |
390 | pullop = pulloperation(repo) |
|
392 | pullop = pulloperation(repo, remote) | |
391 | if remote.local(): |
|
393 | if pullop.remote.local(): | |
392 | missing = set(remote.requirements) - pullop.repo.supported |
|
394 | missing = set(pullop.remote.requirements) - pullop.repo.supported | |
393 | if missing: |
|
395 | if missing: | |
394 | msg = _("required features are not" |
|
396 | msg = _("required features are not" | |
395 | " supported in the destination:" |
|
397 | " supported in the destination:" | |
@@ -399,10 +401,11 b' def pull(repo, remote, heads=None, force' | |||||
399 | # don't open transaction for nothing or you break future useful |
|
401 | # don't open transaction for nothing or you break future useful | |
400 | # rollback call |
|
402 | # rollback call | |
401 | tr = None |
|
403 | tr = None | |
402 | trname = 'pull\n' + util.hidepassword(remote.url()) |
|
404 | trname = 'pull\n' + util.hidepassword(pullop.remote.url()) | |
403 | lock = pullop.repo.lock() |
|
405 | lock = pullop.repo.lock() | |
404 | try: |
|
406 | try: | |
405 |
tmp = discovery.findcommonincoming(pullop.repo.unfiltered(), |
|
407 | tmp = discovery.findcommonincoming(pullop.repo.unfiltered(), | |
|
408 | pullop.remote, | |||
406 | heads=heads, force=force) |
|
409 | heads=heads, force=force) | |
407 | common, fetch, rheads = tmp |
|
410 | common, fetch, rheads = tmp | |
408 | if not fetch: |
|
411 | if not fetch: | |
@@ -412,23 +415,24 b' def pull(repo, remote, heads=None, force' | |||||
412 | tr = pullop.repo.transaction(trname) |
|
415 | tr = pullop.repo.transaction(trname) | |
413 | if heads is None and list(common) == [nullid]: |
|
416 | if heads is None and list(common) == [nullid]: | |
414 | pullop.repo.ui.status(_("requesting all changes\n")) |
|
417 | pullop.repo.ui.status(_("requesting all changes\n")) | |
415 | elif heads is None and remote.capable('changegroupsubset'): |
|
418 | elif heads is None and pullop.remote.capable('changegroupsubset'): | |
416 | # issue1320, avoid a race if remote changed after discovery |
|
419 | # issue1320, avoid a race if remote changed after discovery | |
417 | heads = rheads |
|
420 | heads = rheads | |
418 |
|
421 | |||
419 | if remote.capable('getbundle'): |
|
422 | if pullop.remote.capable('getbundle'): | |
420 | # TODO: get bundlecaps from remote |
|
423 | # TODO: get bundlecaps from remote | |
421 | cg = remote.getbundle('pull', common=common, |
|
424 | cg = pullop.remote.getbundle('pull', common=common, | |
422 | heads=heads or rheads) |
|
425 | heads=heads or rheads) | |
423 | elif heads is None: |
|
426 | elif heads is None: | |
424 | cg = remote.changegroup(fetch, 'pull') |
|
427 | cg = pullop.remote.changegroup(fetch, 'pull') | |
425 | elif not remote.capable('changegroupsubset'): |
|
428 | elif not pullop.remote.capable('changegroupsubset'): | |
426 | raise util.Abort(_("partial pull cannot be done because " |
|
429 | raise util.Abort(_("partial pull cannot be done because " | |
427 | "other repository doesn't support " |
|
430 | "other repository doesn't support " | |
428 | "changegroupsubset.")) |
|
431 | "changegroupsubset.")) | |
429 | else: |
|
432 | else: | |
430 | cg = remote.changegroupsubset(fetch, heads, 'pull') |
|
433 | cg = pullop.remote.changegroupsubset(fetch, heads, 'pull') | |
431 |
result = pullop.repo.addchangegroup(cg, 'pull', |
|
434 | result = pullop.repo.addchangegroup(cg, 'pull', | |
|
435 | pullop.remote.url()) | |||
432 |
|
436 | |||
433 | # compute target subset |
|
437 | # compute target subset | |
434 | if heads is None: |
|
438 | if heads is None: | |
@@ -441,7 +445,7 b' def pull(repo, remote, heads=None, force' | |||||
441 | subset = heads |
|
445 | subset = heads | |
442 |
|
446 | |||
443 | # Get remote phases data from remote |
|
447 | # Get remote phases data from remote | |
444 | remotephases = remote.listkeys('phases') |
|
448 | remotephases = pullop.remote.listkeys('phases') | |
445 | publishing = bool(remotephases.get('publishing', False)) |
|
449 | publishing = bool(remotephases.get('publishing', False)) | |
446 | if remotephases and not publishing: |
|
450 | if remotephases and not publishing: | |
447 | # remote is new and unpublishing |
|
451 | # remote is new and unpublishing | |
@@ -459,7 +463,7 b' def pull(repo, remote, heads=None, force' | |||||
459 | return pullop.repo.transaction(trname) |
|
463 | return pullop.repo.transaction(trname) | |
460 | return tr |
|
464 | return tr | |
461 |
|
465 | |||
462 | obstr = obsolete.syncpull(pullop.repo, remote, gettransaction) |
|
466 | obstr = obsolete.syncpull(pullop.repo, pullop.remote, gettransaction) | |
463 | if obstr is not None: |
|
467 | if obstr is not None: | |
464 | tr = obstr |
|
468 | tr = obstr | |
465 |
|
469 |
General Comments 0
You need to be logged in to leave comments.
Login now