comparison mercurial/commands.py @ 1295:abcdf14449ea

Make contract with extensions optional.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 21 Sep 2005 14:22:16 -0700
parents 1546c2aa6b30
children 3b717f27ffea
comparison
equal deleted inserted replaced
1294:372971e1c40d 1295:abcdf14449ea
2051 mod = getattr(mod, comp) 2051 mod = getattr(mod, comp)
2052 return mod 2052 return mod
2053 mod = importh(x[0]) 2053 mod = importh(x[0])
2054 external.append(mod) 2054 external.append(mod)
2055 for x in external: 2055 for x in external:
2056 for t in x.cmdtable: 2056 cmdtable = getattr(x, 'cmdtable', {})
2057 for t in cmdtable:
2057 if t in table: 2058 if t in table:
2058 u.warn("module %s override %s\n" % (x.__name__, t)) 2059 u.warn("module %s overrides %s\n" % (x.__name__, t))
2059 table.update(x.cmdtable) 2060 table.update(cmdtable)
2060 2061
2061 try: 2062 try:
2062 cmd, func, args, options, cmdoptions = parse(args) 2063 cmd, func, args, options, cmdoptions = parse(args)
2063 except ParseError, inst: 2064 except ParseError, inst:
2064 if inst.args[0]: 2065 if inst.args[0]:
2114 2115
2115 if cmd not in norepo.split(): 2116 if cmd not in norepo.split():
2116 path = options["repository"] or "" 2117 path = options["repository"] or ""
2117 repo = hg.repository(ui=u, path=path) 2118 repo = hg.repository(ui=u, path=path)
2118 for x in external: 2119 for x in external:
2119 x.reposetup(u, repo) 2120 if hasattr(x, 'reposetup'): x.reposetup(u, repo)
2120 d = lambda: func(u, repo, *args, **cmdoptions) 2121 d = lambda: func(u, repo, *args, **cmdoptions)
2121 else: 2122 else:
2122 d = lambda: func(u, *args, **cmdoptions) 2123 d = lambda: func(u, *args, **cmdoptions)
2123 2124
2124 if options['profile']: 2125 if options['profile']: