# HG changeset patch # User Bryan O'Sullivan # Date 1127337736 25200 # Node ID abcdf14449ea121f4c317ab7f5faf1fb87564f0f # Parent 372971e1c40d88455c22647cf246920eb8f6485b Make contract with extensions optional. diff -r 372971e1c40d -r abcdf14449ea mercurial/commands.py --- a/mercurial/commands.py Wed Sep 21 13:33:24 2005 -0700 +++ b/mercurial/commands.py Wed Sep 21 14:22:16 2005 -0700 @@ -2053,10 +2053,11 @@ mod = importh(x[0]) external.append(mod) for x in external: - for t in x.cmdtable: + cmdtable = getattr(x, 'cmdtable', {}) + for t in cmdtable: if t in table: - u.warn("module %s override %s\n" % (x.__name__, t)) - table.update(x.cmdtable) + u.warn("module %s overrides %s\n" % (x.__name__, t)) + table.update(cmdtable) try: cmd, func, args, options, cmdoptions = parse(args) @@ -2116,7 +2117,7 @@ path = options["repository"] or "" repo = hg.repository(ui=u, path=path) for x in external: - x.reposetup(u, repo) + if hasattr(x, 'reposetup'): x.reposetup(u, repo) d = lambda: func(u, repo, *args, **cmdoptions) else: d = lambda: func(u, *args, **cmdoptions)