diff options
Diffstat (limited to 'project.py')
| -rwxr-xr-x | project.py | 51 |
1 files changed, 28 insertions, 23 deletions
| @@ -2235,16 +2235,6 @@ class Project(object): | |||
| 2235 | cmd.append('--update-head-ok') | 2235 | cmd.append('--update-head-ok') |
| 2236 | cmd.append(name) | 2236 | cmd.append(name) |
| 2237 | 2237 | ||
| 2238 | spec = [] | ||
| 2239 | |||
| 2240 | # If using depth then we should not get all the tags since they may | ||
| 2241 | # be outside of the depth. | ||
| 2242 | if no_tags or depth: | ||
| 2243 | cmd.append('--no-tags') | ||
| 2244 | else: | ||
| 2245 | cmd.append('--tags') | ||
| 2246 | spec.append(str((u'+refs/tags/*:') + remote.ToLocal('refs/tags/*'))) | ||
| 2247 | |||
| 2248 | if force_sync: | 2238 | if force_sync: |
| 2249 | cmd.append('--force') | 2239 | cmd.append('--force') |
| 2250 | 2240 | ||
| @@ -2254,6 +2244,7 @@ class Project(object): | |||
| 2254 | if submodules: | 2244 | if submodules: |
| 2255 | cmd.append('--recurse-submodules=on-demand') | 2245 | cmd.append('--recurse-submodules=on-demand') |
| 2256 | 2246 | ||
| 2247 | spec = [] | ||
| 2257 | if not current_branch_only: | 2248 | if not current_branch_only: |
| 2258 | # Fetch whole repo | 2249 | # Fetch whole repo |
| 2259 | spec.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) | 2250 | spec.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) |
| @@ -2261,19 +2252,33 @@ class Project(object): | |||
| 2261 | spec.append('tag') | 2252 | spec.append('tag') |
| 2262 | spec.append(tag_name) | 2253 | spec.append(tag_name) |
| 2263 | 2254 | ||
| 2264 | if not self.manifest.IsMirror: | 2255 | branch = self.revisionExpr |
| 2265 | branch = self.revisionExpr | 2256 | if (not self.manifest.IsMirror and is_sha1 and depth |
| 2266 | if is_sha1 and depth and git_require((1, 8, 3)): | 2257 | and git_require((1, 8, 3))): |
| 2267 | # Shallow checkout of a specific commit, fetch from that commit and not | 2258 | # Shallow checkout of a specific commit, fetch from that commit and not |
| 2268 | # the heads only as the commit might be deeper in the history. | 2259 | # the heads only as the commit might be deeper in the history. |
| 2269 | spec.append(branch) | 2260 | spec.append(branch) |
| 2270 | else: | 2261 | else: |
| 2271 | if is_sha1: | 2262 | if is_sha1: |
| 2272 | branch = self.upstream | 2263 | branch = self.upstream |
| 2273 | if branch is not None and branch.strip(): | 2264 | if branch is not None and branch.strip(): |
| 2274 | if not branch.startswith('refs/'): | 2265 | if not branch.startswith('refs/'): |
| 2275 | branch = R_HEADS + branch | 2266 | branch = R_HEADS + branch |
| 2276 | spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) | 2267 | spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) |
| 2268 | |||
| 2269 | # If mirroring repo and we cannot deduce the tag or branch to fetch, fetch | ||
| 2270 | # whole repo. | ||
| 2271 | if self.manifest.IsMirror and not spec: | ||
| 2272 | spec.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) | ||
| 2273 | |||
| 2274 | # If using depth then we should not get all the tags since they may | ||
| 2275 | # be outside of the depth. | ||
| 2276 | if no_tags or depth: | ||
| 2277 | cmd.append('--no-tags') | ||
| 2278 | else: | ||
| 2279 | cmd.append('--tags') | ||
| 2280 | spec.append(str((u'+refs/tags/*:') + remote.ToLocal('refs/tags/*'))) | ||
| 2281 | |||
| 2277 | cmd.extend(spec) | 2282 | cmd.extend(spec) |
| 2278 | 2283 | ||
| 2279 | ok = False | 2284 | ok = False |
