Show More
@@ -17,6 +17,7 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, changegroup, cmdutil, hg, merge, match | |
19 | from mercurial import patch, revlog, util, error, discovery |
|
19 | from mercurial import patch, revlog, util, error, discovery | |
|
20 | from mercurial import revset, help | |||
20 |
|
21 | |||
21 | class transplantentry(object): |
|
22 | class transplantentry(object): | |
22 | def __init__(self, lnode, rnode): |
|
23 | def __init__(self, lnode, rnode): | |
@@ -603,6 +604,30 def transplant(ui, repo, *revs, **opts): | |||||
603 | source.close() |
|
604 | source.close() | |
604 | os.unlink(bundle) |
|
605 | os.unlink(bundle) | |
605 |
|
606 | |||
|
607 | def revsettransplanted(repo, subset, x): | |||
|
608 | if x: | |||
|
609 | s = revset.getset(repo, subset, x) | |||
|
610 | else: | |||
|
611 | s = subset | |||
|
612 | cs = set() | |||
|
613 | for r in xrange(0, len(repo)): | |||
|
614 | if repo[r].extra().get('transplant_source'): | |||
|
615 | cs.add(r) | |||
|
616 | return [r for r in s if r in cs] | |||
|
617 | ||||
|
618 | def revsetdoc(): | |||
|
619 | doc = help.loaddoc('revsets')() | |||
|
620 | doc += _('\nAdded by the transplant extension:\n\n' | |||
|
621 | '``transplanted(set)``\n' | |||
|
622 | ' Transplanted changesets in set.\n') | |||
|
623 | return doc | |||
|
624 | ||||
|
625 | def uisetup(ui): | |||
|
626 | 'Add the transplanted revset predicate' | |||
|
627 | for i in (i for i, x in enumerate(help.helptable) if x[0] == ['revsets']): | |||
|
628 | help.helptable[i] = (['revsets'], _("Specifying Revision Sets"), revsetdoc) | |||
|
629 | revset.symbols['transplanted'] = revsettransplanted | |||
|
630 | ||||
606 | cmdtable = { |
|
631 | cmdtable = { | |
607 | "transplant": |
|
632 | "transplant": | |
608 | (transplant, |
|
633 | (transplant, |
General Comments 0
You need to be logged in to leave comments.
Login now