Mercurial > hg > fetch
comparison fetch.py @ 42:6e978ddf5135
self._export vs self.export, the function
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Tue, 15 Nov 2011 14:24:51 -0800 |
| parents | e103ae19c2a0 |
| children | 9e6c0f9725e3 |
comparison
equal
deleted
inserted
replaced
| 41:0facc5466dbe | 42:6e978ddf5135 |
|---|---|
| 116 except ImportErorr: | 116 except ImportErorr: |
| 117 raise # we need check_call, kinda | 117 raise # we need check_call, kinda |
| 118 | 118 |
| 119 class VCSFetcher(Fetcher): | 119 class VCSFetcher(Fetcher): |
| 120 | 120 |
| 121 command = None | 121 command = None # name of the VCS command (currently unused) |
| 122 | |
| 123 def __init__(self, url, export=True): | |
| 124 """ | |
| 125 - export : whether to strip the versioning information | |
| 126 """ | |
| 127 Fetcher.__init__(self, url) | |
| 128 self._export = export | |
| 129 self.prog = self.type # name of app program | |
| 130 self.vcs_dir = '.' + self.type # subdirectory for version control | |
| 122 | 131 |
| 123 def call(*args, **kwargs): | 132 def call(*args, **kwargs): |
| 124 assert command is not None, "Abstract base class" | 133 assert command is not None, "Abstract base class" |
| 125 call([self.command] + list(args), **kwargs) | 134 call([self.command] + list(args), **kwargs) |
| 126 | 135 |
| 127 def __init__(self, url, export=True): | |
| 128 """ | |
| 129 - export : whether to strip the versioning information | |
| 130 """ | |
| 131 Fetcher.__init__(self, url) | |
| 132 self.export = export | |
| 133 self.prog = self.type # name of app program | |
| 134 self.vcs_dir = '.' + self.type # subdirectory for version control | |
| 135 | |
| 136 def __call__(self, dest): | 136 def __call__(self, dest): |
| 137 | 137 |
| 138 if self.subpath or self.export: | 138 if self.subpath or self._export: |
| 139 # can only export with a subpath | 139 # can only export with a subpath |
| 140 self.export(dest, subpath=self.subpath) | 140 self.export(dest, subpath=self.subpath) |
| 141 return | 141 return |
| 142 | 142 |
| 143 if os.path.exists(dest): | 143 if os.path.exists(dest): |
