##// END OF EJS Templates
transplant: clarify what --branch do - it has nothing to do with branches...
Mads Kiilerich -
r19027:3f5fac4b default
parent child Browse files
Show More
@@ -493,9 +493,8 b' def browserevs(ui, repo, nodes, opts):'
493
493
494 @command('transplant',
494 @command('transplant',
495 [('s', 'source', '', _('pull patches from REPO'), _('REPO')),
495 [('s', 'source', '', _('pull patches from REPO'), _('REPO')),
496 ('b', 'branch', [],
496 ('b', 'branch', [], _('use this source changeset as head'), _('REV')),
497 _('pull patches from branch BRANCH'), _('BRANCH')),
497 ('a', 'all', None, _('pull all changesets up to the --branch revisions')),
498 ('a', 'all', None, _('pull all changesets up to BRANCH')),
499 ('p', 'prune', [], _('skip over REV'), _('REV')),
498 ('p', 'prune', [], _('skip over REV'), _('REV')),
500 ('m', 'merge', [], _('merge at REV'), _('REV')),
499 ('m', 'merge', [], _('merge at REV'), _('REV')),
501 ('', 'parent', '',
500 ('', 'parent', '',
@@ -527,15 +526,18 b' def transplant(ui, repo, *revs, **opts):'
527 $1 and the patch as $2.
526 $1 and the patch as $2.
528
527
529 If --source/-s is specified, selects changesets from the named
528 If --source/-s is specified, selects changesets from the named
530 repository. If --branch/-b is specified, selects changesets from
529 repository.
531 the branch holding the named revision, up to that revision. If
530 If --branch/-b is specified, these revisions will be used as
532 --all/-a is specified, all changesets on the branch will be
531 heads when deciding which changsets to transplant, just as if only
533 transplanted, otherwise you will be prompted to select the
532 these revisions had been pulled.
534 changesets you want.
533 If --all/-a is specified, all the revisions up to the heads specified
534 with --branch will be transplanted.
535
535
536 :hg:`transplant --branch REV --all` will transplant the
536 Example:
537 selected branch (up to the named revision) onto your current
537
538 working directory.
538 - transplant all changes up to REV on top of your current revision::
539
540 hg transplant --branch REV --all
539
541
540 You can optionally mark selected transplanted changesets as merge
542 You can optionally mark selected transplanted changesets as merge
541 changesets. You will not be prompted to transplant any ancestors
543 changesets. You will not be prompted to transplant any ancestors
@@ -557,13 +559,16 b' def transplant(ui, repo, *revs, **opts):'
557 if match(node):
559 if match(node):
558 yield node
560 yield node
559
561
560 def transplantwalk(repo, root, branches, match=util.always):
562 def transplantwalk(repo, dest, heads, match=util.always):
561 if not branches:
563 '''Yield all nodes that are ancestors of a head but not ancestors
562 branches = repo.heads()
564 of dest.
565 If no heads are specified, the heads of repo will be used.'''
566 if not heads:
567 heads = repo.heads()
563 ancestors = []
568 ancestors = []
564 for branch in branches:
569 for head in heads:
565 ancestors.append(repo.changelog.ancestor(root, branch))
570 ancestors.append(repo.changelog.ancestor(dest, head))
566 for node in repo.changelog.nodesbetween(ancestors, branches)[0]:
571 for node in repo.changelog.nodesbetween(ancestors, heads)[0]:
567 if match(node):
572 if match(node):
568 yield node
573 yield node
569
574
@@ -575,7 +580,7 b' def transplant(ui, repo, *revs, **opts):'
575 return
580 return
576 if not (opts.get('source') or revs or
581 if not (opts.get('source') or revs or
577 opts.get('merge') or opts.get('branch')):
582 opts.get('merge') or opts.get('branch')):
578 raise util.Abort(_('no source URL, branch tag or revision '
583 raise util.Abort(_('no source URL, branch revision or revision '
579 'list provided'))
584 'list provided'))
580 if opts.get('all'):
585 if opts.get('all'):
581 if not opts.get('branch'):
586 if not opts.get('branch'):
@@ -608,12 +613,12 b' def transplant(ui, repo, *revs, **opts):'
608 sourcerepo = opts.get('source')
613 sourcerepo = opts.get('source')
609 if sourcerepo:
614 if sourcerepo:
610 peer = hg.peer(repo, opts, ui.expandpath(sourcerepo))
615 peer = hg.peer(repo, opts, ui.expandpath(sourcerepo))
611 branches = map(peer.lookup, opts.get('branch', ()))
616 heads = map(peer.lookup, opts.get('branch', ()))
612 source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer,
617 source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer,
613 onlyheads=branches, force=True)
618 onlyheads=heads, force=True)
614 else:
619 else:
615 source = repo
620 source = repo
616 branches = map(source.lookup, opts.get('branch', ()))
621 heads = map(source.lookup, opts.get('branch', ()))
617 cleanupfn = None
622 cleanupfn = None
618
623
619 try:
624 try:
@@ -637,7 +642,7 b' def transplant(ui, repo, *revs, **opts):'
637 if source != repo:
642 if source != repo:
638 alltransplants = incwalk(source, csets, match=matchfn)
643 alltransplants = incwalk(source, csets, match=matchfn)
639 else:
644 else:
640 alltransplants = transplantwalk(source, p1, branches,
645 alltransplants = transplantwalk(source, p1, heads,
641 match=matchfn)
646 match=matchfn)
642 if opts.get('all'):
647 if opts.get('all'):
643 revs = alltransplants
648 revs = alltransplants
General Comments 0
You need to be logged in to leave comments. Login now