[cig-commits] commit: Make findcmd compatible with 18a9fbb5cd78
Mercurial
hg at geodynamics.org
Mon Nov 24 11:27:07 PST 2008
changeset: 55:146cb75364c0
user: Christian Ebert <blacktrash at gmx.net>
date: Sat Aug 18 10:17:17 2007 +0200
files: forest.py
description:
Make findcmd compatible with 18a9fbb5cd78
Consistently use try blocks for backwards compatibility.
Rename findcmd to _findcmd internally.
diff -r ccfac5e72669 -r 146cb75364c0 forest.py
--- a/forest.py Mon Jul 16 11:44:42 2007 -0400
+++ b/forest.py Sat Aug 18 10:17:17 2007 +0200
@@ -51,10 +51,11 @@ from mercurial import commands, hg, node
from mercurial import commands, hg, node, util
from mercurial import localrepo, sshrepo, sshserver, httprepo, statichttprepo
from mercurial.hgweb import hgweb_mod
-if not hasattr(commands, "findcmd"):
- from mercurial.cmdutil import findcmd
-else:
- findcmd = commands.findcmd
+try:
+ _findcmd = commands.findcmd
+except AttributeError:
+ from mercurial import cmdutil
+ _findcmd = cmdutil.findcmd
from mercurial.i18n import gettext as _
from mercurial.repo import RepoError
@@ -64,7 +65,10 @@ commands.norepo += " fclone fseed"
def cmd_options(ui, cmd, remove=None):
- aliases, spec = findcmd(ui, cmd)
+ try:
+ aliases, spec = _findcmd(ui, cmd, commands.table)
+ except TypeError:
+ aliases, spec = _findcmd(ui, cmd)
res = list(spec[1])
if remove is not None:
res = [opt for opt in res if opt[0] not in remove]
More information about the CIG-COMMITS
mailing list