Mercurial > hg > fetch
comparison fetch.py @ 19:d69041957c0e
more stubbing
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 09 Nov 2011 17:06:02 -0800 |
parents | 64f89df1b966 |
children | 738d84b4de52 |
comparison
equal
deleted
inserted
replaced
18:64f89df1b966 | 19:d69041957c0e |
---|---|
82 fetchers = [FileFetcher, TarballFetcher] | 82 fetchers = [FileFetcher, TarballFetcher] |
83 | 83 |
84 ### VCS fetchers using executable | 84 ### VCS fetchers using executable |
85 | 85 |
86 import subprocess | 86 import subprocess |
87 try: | |
88 from subprocess import check_call as call | |
89 except ImportErorr: | |
90 raise # we need check_call, kinda | |
87 | 91 |
88 class VCSFetcher(Fetcher): | 92 class VCSFetcher(Fetcher): |
89 def __init__(self, url, export=True): | 93 def __init__(self, url, export=True): |
90 """ | 94 """ |
91 - export : whether to strip the versioning information | 95 - export : whether to strip the versioning information |
97 | 101 |
98 class HgFetcher(VCSFetcher): | 102 class HgFetcher(VCSFetcher): |
99 """checkout a mercurial repository""" | 103 """checkout a mercurial repository""" |
100 type = 'hg' | 104 type = 'hg' |
101 | 105 |
106 def __init__(self, url, export=True): | |
107 VCSFetcher.__init__(self, url, export=True) | |
108 self.hg = which('hg') | |
109 | |
102 def __call__(self, dest): | 110 def __call__(self, dest): |
103 if os.path.exits(dest): | 111 if os.path.exits(dest): |
104 assert os.path.isdir(dest) and os.path.exists(os.path.join(dest, '.hg')) | 112 assert os.path.isdir(dest) and os.path.exists(os.path.join(dest, '.hg')) |
113 call([self.hg, 'pull', self.url], cwd=dest) | |
114 call([self.hg, 'update'], cwd=dest) | |
115 else: | |
116 pass | |
105 raise NotImplementedError("TODO! Sorry!") | 117 raise NotImplementedError("TODO! Sorry!") |
106 | 118 |
107 fetchers.append(HgFetcher) | 119 fetchers.append(HgFetcher) |
108 | 120 |
109 if which('git'): | 121 if which('git'): |