13 map from a changeset hash to its hash in the source repository. |
13 map from a changeset hash to its hash in the source repository. |
14 ''' |
14 ''' |
15 |
15 |
16 from mercurial.i18n import _ |
16 from mercurial.i18n import _ |
17 import os, tempfile |
17 import os, tempfile |
18 from mercurial import bundlerepo, changegroup, cmdutil, hg, merge, match |
18 from mercurial import bundlerepo, cmdutil, hg, merge, match |
19 from mercurial import patch, revlog, util, error, discovery |
19 from mercurial import patch, revlog, util, error |
20 from mercurial import revset, help |
20 from mercurial import revset, help |
21 |
21 |
22 class transplantentry(object): |
22 class transplantentry(object): |
23 def __init__(self, lnode, rnode): |
23 def __init__(self, lnode, rnode): |
24 self.lnode = lnode |
24 self.lnode = lnode |
482 |
482 |
483 If a changeset application fails, you can fix the merge by hand |
483 If a changeset application fails, you can fix the merge by hand |
484 and then resume where you left off by calling :hg:`transplant |
484 and then resume where you left off by calling :hg:`transplant |
485 --continue/-c`. |
485 --continue/-c`. |
486 ''' |
486 ''' |
487 def getremotechanges(repo, url): |
|
488 sourcerepo = ui.expandpath(url) |
|
489 source = hg.repository(ui, sourcerepo) |
|
490 tmp = discovery.findcommonincoming(repo, source, force=True) |
|
491 common, incoming, rheads = tmp |
|
492 if not incoming: |
|
493 return (source, None, None) |
|
494 |
|
495 bundle = None |
|
496 if not source.local(): |
|
497 if source.capable('changegroupsubset'): |
|
498 cg = source.changegroupsubset(incoming, rheads, 'incoming') |
|
499 else: |
|
500 cg = source.changegroup(incoming, 'incoming') |
|
501 bundle = changegroup.writebundle(cg, None, 'HG10UN') |
|
502 source = bundlerepo.bundlerepository(ui, repo.root, bundle) |
|
503 |
|
504 return (source, incoming, bundle) |
|
505 |
|
506 def incwalk(repo, incoming, branches, match=util.always): |
487 def incwalk(repo, incoming, branches, match=util.always): |
507 if not branches: |
488 if not branches: |
508 branches = None |
489 branches = None |
509 for node in repo.changelog.nodesbetween(incoming, branches)[0]: |
490 for node in repo.changelog.nodesbetween(incoming, branches)[0]: |
510 if match(node): |
491 if match(node): |
557 raise util.Abort(_('outstanding local changes')) |
538 raise util.Abort(_('outstanding local changes')) |
558 |
539 |
559 bundle = None |
540 bundle = None |
560 source = opts.get('source') |
541 source = opts.get('source') |
561 if source: |
542 if source: |
562 (source, incoming, bundle) = getremotechanges(repo, source) |
543 sourcerepo = ui.expandpath(source) |
|
544 source = hg.repository(ui, sourcerepo) |
|
545 source, incoming, bundle = bundlerepo.getremotechanges(ui, repo, source, |
|
546 force=True) |
563 else: |
547 else: |
564 source = repo |
548 source = repo |
565 |
549 |
566 try: |
550 try: |
567 if opts.get('continue'): |
551 if opts.get('continue'): |