# HG changeset patch # User Jeff Hammel # Date 1316397128 25200 # Node ID 0b534c8881de614b6ba48c994c977ce6978ede98 # Parent f8575a78ec064b3d14b7a4277841de586ce2aaea make fetchers a dict keyed on class name diff -r f8575a78ec06 -r 0b534c8881de fetch/main.py --- a/fetch/main.py Sun Sep 18 18:47:39 2011 -0700 +++ b/fetch/main.py Sun Sep 18 18:52:08 2011 -0700 @@ -74,21 +74,20 @@ ### VCS fetchers using executable if which('hg'): - pass # TODO: wrap HgFetcher -class HgFetcher(Fetcher): - """checkout a mercurial repository""" + class HgFetcher(Fetcher): + """checkout a mercurial repository""" + type = 'hg' - type = 'hg' + fetchers.append(HgFetcher) class GitFetcher(Fetcher): """checkout a git repository""" - type = 'git' -fetcher_names = [cls.__name__ for cls in fetchers] -__all__ += fetcher_names +fetchers = dict([(i.__name__, i) for i in fetchers]) +__all__ += fetchers.keys() class Fetch(object): @@ -195,7 +194,7 @@ options, args = parser.parse_args(args) if options.list_fetchers: - for name in fetcher_names: + for name in sorted(fetchers.keys()): print name parser.exit() @@ -204,7 +203,7 @@ parser.exit() items = read_manifests(*args) - fetch = Fetch(fetchers, strict=options.strict) + fetch = Fetch(fetchers.values(), strict=options.strict) # download the files fetch.fetch(*items)