Mercurial > hg > fetch
comparison fetch.py @ 16:c77d29a10e08
get it working
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 09 Nov 2011 16:33:29 -0800 |
parents | bc7d6763357e |
children | e2af4bc5159c |
comparison
equal
deleted
inserted
replaced
15:bc7d6763357e | 16:c77d29a10e08 |
---|---|
89 if which('git'): | 89 if which('git'): |
90 class GitFetcher(Fetcher): | 90 class GitFetcher(Fetcher): |
91 """checkout a git repository""" | 91 """checkout a git repository""" |
92 type = 'git' | 92 type = 'git' |
93 | 93 |
94 fetchers = dict([(i.__name__, i) for i in fetchers]) | 94 __all__ += [i.__name__ for i in fetchers] |
95 __all__ += fetchers.keys() | |
96 | 95 |
97 class Fetch(object): | 96 class Fetch(object): |
98 | 97 |
99 def __init__(self, fetchers, relative_to=None, strict=True): | 98 def __init__(self, fetchers, relative_to=None, strict=True): |
100 self.fetchers = fetchers | 99 self.fetchers = fetchers |
192 action='store_true', default=False, | 191 action='store_true', default=False, |
193 help='list available fetchers and exit') | 192 help='list available fetchers and exit') |
194 options, args = parser.parse_args(args) | 193 options, args = parser.parse_args(args) |
195 | 194 |
196 if options.list_fetchers: | 195 if options.list_fetchers: |
196 | |
197 for name in sorted(fetchers.keys()): | 197 for name in sorted(fetchers.keys()): |
198 print name | 198 print name |
199 parser.exit() | 199 parser.exit() |
200 | 200 |
201 if not args: | 201 if not args: |
202 parser.print_help() | 202 parser.print_help() |
203 parser.exit() | 203 parser.exit() |
204 | 204 |
205 items = read_manifests(*args) | 205 items = read_manifests(*args) |
206 fetch = Fetch(fetchers.values(), strict=options.strict) | 206 fetch = Fetch(fetchers, strict=options.strict) |
207 | 207 |
208 # download the files | 208 # download the files |
209 fetch.fetch(*items) | 209 fetch.fetch(*items) |
210 | 210 |
211 if __name__ == '__main__': | 211 if __name__ == '__main__': |