changeset 12:5af4dc9d62bf

mercurial.commands.findcmd() now takes a 'ui' in argument
author Robin Farine <robin.farine@terminus.org>
date Mon, 23 Oct 2006 19:58:33 +0200
parents 67b5de922489
children a02bfecb4905
files forest.py
diffstat 1 files changed, 37 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/forest.py	Mon Oct 23 19:55:17 2006 +0200
+++ b/forest.py	Mon Oct 23 19:58:33 2006 +0200
@@ -24,7 +24,7 @@
 forest or to pull/push changes.
 """
 
-version = "0.9.1"
+version = "crew c3345b0f2fcd 20061023"
 
 import ConfigParser
 import os
@@ -33,11 +33,13 @@
 from mercurial.i18n import gettext as _
 from mercurial.repo import RepoError
 
+cmdtable = None
+
 commands.norepo += " fclone"
 
 
-def cmd_options(cmd, remove=None):
-    aliases, spec = commands.findcmd(cmd)
+def cmd_options(ui, cmd, remove=None):
+    aliases, spec = commands.findcmd(ui, cmd)
     res = list(spec[1])
     if remove is not None:
         res = [opt for opt in res if opt[0] not in remove]
@@ -336,33 +338,35 @@
         ui.write(root + '\n')
 
 
-cmdtable = {
-    "fclone" :
-        (clone,
-         cmd_options('clone', remove=('r',)),
-         _('hg fclone [OPTIONS] SOURCE DESTINATION')),
-    "fpull" :
-        (pull,
-         cmd_options('pull', remove=('f', 'r')),
-         _('hg fpull [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')),
-    "fpush" :
-        (push,
-         cmd_options('push', remove=('f', 'r')),
-         _('hg fpush [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')),
-    "fseed" :
-        (seed,
-         [('', 'tip', None,
-           _("use tip instead of revisions stored in the snapshot file"))] +
-         cmd_options('clone', remove=('r',)),
-         _('hg fseed [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')),
-    "fsnap" :
-        (snapshot, [],
-         'hg fsnap [SNAPSHOT-FILE]'),
-    "fstatus" :
-        (status,
-         cmd_options('status'),
-         _('hg fstatus [OPTIONS]')),
-    "ftrees" :
-        (trees, [],
-         'hg ftrees'),
-}
+def uisetup(ui):
+    global cmdtable
+    cmdtable = {
+        "fclone" :
+            (clone,
+             cmd_options(ui, 'clone', remove=('r',)),
+             _('hg fclone [OPTIONS] SOURCE DESTINATION')),
+        "fpull" :
+            (pull,
+             cmd_options(ui, 'pull', remove=('f', 'r')),
+             _('hg fpull [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')),
+        "fpush" :
+            (push,
+             cmd_options(ui, 'push', remove=('f', 'r')),
+             _('hg fpush [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')),
+        "fseed" :
+            (seed,
+             [('', 'tip', None,
+               _("use tip instead of revisions stored in the snapshot file"))] +
+             cmd_options(ui, 'clone', remove=('r',)),
+             _('hg fseed [OPTIONS] SNAPSHOT-FILE PATH-ALIAS')),
+        "fsnap" :
+            (snapshot, [],
+             'hg fsnap [SNAPSHOT-FILE]'),
+        "fstatus" :
+            (status,
+             cmd_options(ui, 'status'),
+             _('hg fstatus [OPTIONS]')),
+        "ftrees" :
+            (trees, [],
+             'hg ftrees'),
+        }