Mercurial > hg-stable
comparison hgext/patchbomb.py @ 32662:c2fe2b00db53
patchbomb: add -B option to select a bookmark
Add the -B/--bookmark option to select a bookmark whose changesets
and its ancestors will be selected unless a new bookmark/head is
found.
This is inspired by hg strip -B option.
author | David Demelier <demelier.david@gmail.com> |
---|---|
date | Fri, 03 Feb 2017 15:02:27 +0100 |
parents | 04baab18d60a |
children | 0841382d114a |
comparison
equal
deleted
inserted
replaced
32661:4f6645ec6bb2 | 32662:c2fe2b00db53 |
---|---|
88 hg, | 88 hg, |
89 mail, | 89 mail, |
90 node as nodemod, | 90 node as nodemod, |
91 patch, | 91 patch, |
92 registrar, | 92 registrar, |
93 repair, | |
93 scmutil, | 94 scmutil, |
94 templater, | 95 templater, |
95 util, | 96 util, |
96 ) | 97 ) |
97 stringio = util.stringio | 98 stringio = util.stringio |
440 [('g', 'git', None, _('use git extended diff format')), | 441 [('g', 'git', None, _('use git extended diff format')), |
441 ('', 'plain', None, _('omit hg patch header')), | 442 ('', 'plain', None, _('omit hg patch header')), |
442 ('o', 'outgoing', None, | 443 ('o', 'outgoing', None, |
443 _('send changes not found in the target repository')), | 444 _('send changes not found in the target repository')), |
444 ('b', 'bundle', None, _('send changes not in target as a binary bundle')), | 445 ('b', 'bundle', None, _('send changes not in target as a binary bundle')), |
446 ('B', 'bookmark', '', _('send changes only reachable by given bookmark')), | |
445 ('', 'bundlename', 'bundle', | 447 ('', 'bundlename', 'bundle', |
446 _('name of the bundle attachment file'), _('NAME')), | 448 _('name of the bundle attachment file'), _('NAME')), |
447 ('r', 'rev', [], _('a revision to send'), _('REV')), | 449 ('r', 'rev', [], _('a revision to send'), _('REV')), |
448 ('', 'force', None, _('run even when remote repository is unrelated ' | 450 ('', 'force', None, _('run even when remote repository is unrelated ' |
449 '(with -b/--bundle)')), | 451 '(with -b/--bundle)')), |
478 an attachment for the patch. With -i/--inline an inline attachment | 480 an attachment for the patch. With -i/--inline an inline attachment |
479 will be created. You can include a patch both as text in the email | 481 will be created. You can include a patch both as text in the email |
480 body and as a regular or an inline attachment by combining the | 482 body and as a regular or an inline attachment by combining the |
481 -a/--attach or -i/--inline with the --body option. | 483 -a/--attach or -i/--inline with the --body option. |
482 | 484 |
485 With -B/--bookmark changesets reachable by the given bookmark are | |
486 selected. | |
487 | |
483 With -o/--outgoing, emails will be generated for patches not found | 488 With -o/--outgoing, emails will be generated for patches not found |
484 in the destination repository (or only those which are ancestors | 489 in the destination repository (or only those which are ancestors |
485 of the specified revisions if any are provided) | 490 of the specified revisions if any are provided) |
486 | 491 |
487 With -b/--bundle, changesets are selected as for --outgoing, but a | 492 With -b/--bundle, changesets are selected as for --outgoing, but a |
516 hg email -o # send all patches not in default | 521 hg email -o # send all patches not in default |
517 hg email -o DEST # send all patches not in DEST | 522 hg email -o DEST # send all patches not in DEST |
518 hg email -o -r 3000 # send all ancestors of 3000 not in default | 523 hg email -o -r 3000 # send all ancestors of 3000 not in default |
519 hg email -o -r 3000 DEST # send all ancestors of 3000 not in DEST | 524 hg email -o -r 3000 DEST # send all ancestors of 3000 not in DEST |
520 | 525 |
526 hg email -B feature # send all ancestors of feature bookmark | |
527 | |
521 hg email -b # send bundle of all patches not in default | 528 hg email -b # send bundle of all patches not in default |
522 hg email -b DEST # send bundle of all patches not in DEST | 529 hg email -b DEST # send bundle of all patches not in DEST |
523 hg email -b -r 3000 # bundle of all ancestors of 3000 not in default | 530 hg email -b -r 3000 # bundle of all ancestors of 3000 not in default |
524 hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST | 531 hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST |
525 | 532 |
538 bundle = opts.get('bundle') | 545 bundle = opts.get('bundle') |
539 date = opts.get('date') | 546 date = opts.get('date') |
540 mbox = opts.get('mbox') | 547 mbox = opts.get('mbox') |
541 outgoing = opts.get('outgoing') | 548 outgoing = opts.get('outgoing') |
542 rev = opts.get('rev') | 549 rev = opts.get('rev') |
550 bookmark = opts.get('bookmark') | |
543 | 551 |
544 if not (opts.get('test') or mbox): | 552 if not (opts.get('test') or mbox): |
545 # really sending | 553 # really sending |
546 mail.validateconfig(ui) | 554 mail.validateconfig(ui) |
547 | 555 |
548 if not (revs or rev or outgoing or bundle): | 556 if not (revs or rev or outgoing or bundle or bookmark): |
549 raise error.Abort(_('specify at least one changeset with -r or -o')) | 557 raise error.Abort(_('specify at least one changeset with -B, -r or -o')) |
550 | 558 |
551 if outgoing and bundle: | 559 if outgoing and bundle: |
552 raise error.Abort(_("--outgoing mode always on with --bundle;" | 560 raise error.Abort(_("--outgoing mode always on with --bundle;" |
553 " do not re-specify --outgoing")) | 561 " do not re-specify --outgoing")) |
554 | 562 |
563 | 571 |
564 if rev: | 572 if rev: |
565 if revs: | 573 if revs: |
566 raise error.Abort(_('use only one form to specify the revision')) | 574 raise error.Abort(_('use only one form to specify the revision')) |
567 revs = rev | 575 revs = rev |
576 elif bookmark: | |
577 if bookmark not in repo._bookmarks: | |
578 raise error.Abort(_("bookmark '%s' not found") % bookmark) | |
579 revs = repair.stripbmrevset(repo, bookmark) | |
568 | 580 |
569 revs = scmutil.revrange(repo, revs) | 581 revs = scmutil.revrange(repo, revs) |
570 if outgoing: | 582 if outgoing: |
571 revs = _getoutgoing(repo, dest, revs) | 583 revs = _getoutgoing(repo, dest, revs) |
572 if bundle: | 584 if bundle: |