changeset 12822:f13acb96b2a7 stable

Fix and unify transplant and bookmarks revsets doc registration
author Patrick Mezard <pmezard@gmail.com>
date Sat, 23 Oct 2010 19:22:42 +0200
parents 165079e564f0
children 80deae3bc5ea
files hgext/bookmarks.py hgext/transplant.py tests/test-bookmarks.t
diffstat 3 files changed, 12 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Sat Oct 23 19:21:51 2010 +0200
+++ b/hgext/bookmarks.py	Sat Oct 23 19:22:42 2010 +0200
@@ -538,6 +538,9 @@
     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 @@
         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":
--- a/hgext/transplant.py	Sat Oct 23 19:21:51 2010 +0200
+++ b/hgext/transplant.py	Sat Oct 23 19:22:42 2010 +0200
@@ -17,7 +17,7 @@
 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 @@
             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 @@
         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 = {
--- a/tests/test-bookmarks.t	Sat Oct 23 19:21:51 2010 +0200
+++ b/tests/test-bookmarks.t	Sat Oct 23 19:22:42 2010 +0200
@@ -83,6 +83,8 @@
   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