# HG changeset patch # User Patrick Mezard # Date 2010-10-23 17:22:42 # Node ID f13acb96b2a73bf3603fb5b664cd16e6364bcc1f # Parent 165079e564f01e0481a4fc5bc4358b2ae7730e94 Fix and unify transplant and bookmarks revsets doc registration diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py --- a/hgext/bookmarks.py +++ b/hgext/bookmarks.py @@ -538,6 +538,9 @@ def updatecurbookmark(orig, ui, repo, *a return res def bmrevset(repo, subset, x): + """``bookmark([name])`` + The named bookmark or all bookmarks. + """ args = revset.getargs(x, 0, 1, _('bookmark takes one or no arguments')) if args: bm = revset.getstring(args[0], @@ -548,14 +551,9 @@ def bmrevset(repo, subset, x): return [r for r in subset if r == bmrev] bms = set([repo.changelog.rev(bin(r)) for r in listbookmarks(repo).values()]) return [r for r in subset if r in bms] -revset.symbols['bookmark'] = bmrevset -def revsetdoc(): - doc = help.loaddoc('revsets')() - doc += _('\nAdded by the bookmarks extension:\n\n' - '``bookmark([name])``\n' - ' The named bookmark or all bookmarks.\n') - return doc +def extsetup(ui): + revset.symbols['bookmark'] = bmrevset cmdtable = { "bookmarks": diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -17,7 +17,7 @@ from mercurial.i18n import _ import os, tempfile from mercurial import bundlerepo, cmdutil, hg, merge, match from mercurial import patch, revlog, util, error -from mercurial import revset, help +from mercurial import revset class transplantentry(object): def __init__(self, lnode, rnode): @@ -589,6 +589,9 @@ def transplant(ui, repo, *revs, **opts): os.unlink(bundle) def revsettransplanted(repo, subset, x): + """``transplanted(set)`` + Transplanted changesets in set. + """ if x: s = revset.getset(repo, subset, x) else: @@ -599,17 +602,7 @@ def revsettransplanted(repo, subset, x): cs.add(r) return [r for r in s if r in cs] -def revsetdoc(): - doc = help.loaddoc('revsets')() - doc += _('\nAdded by the transplant extension:\n\n' - '``transplanted(set)``\n' - ' Transplanted changesets in set.\n') - return doc - -def uisetup(ui): - 'Add the transplanted revset predicate' - for i in (i for i, x in enumerate(help.helptable) if x[0] == ['revsets']): - help.helptable[i] = (['revsets'], _("Specifying Revision Sets"), revsetdoc) +def extsetup(ui): revset.symbols['transplanted'] = revsettransplanted cmdtable = { diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -83,6 +83,8 @@ bookmarks revset date: Thu Jan 01 00:00:00 1970 +0000 summary: 1 + $ hg help revsets | grep 'bookmark(' + "bookmark([name])" bookmarks X and X2 moved to rev 1, Y at rev -1