|
13 | 13 | import argparse
|
14 | 14 | import json
|
15 | 15 | import os
|
| 16 | +import platform |
16 | 17 | import re
|
17 | 18 | import sys
|
18 | 19 | import traceback
|
@@ -131,8 +132,8 @@ def update_single_repository(args):
|
131 | 132 | # If we were asked to reset to the specified branch, do the hard
|
132 | 133 | # reset and return.
|
133 | 134 | if checkout_target and reset_to_remote and not cross_repo:
|
134 |
| - shell.run(['git', 'reset', '--hard', |
135 |
| - "origin/%s" % checkout_target], echo=True) |
| 135 | + full_target = full_target_name('origin', checkout_target) |
| 136 | + shell.run(['git', 'reset', '--hard', full_target], echo=True) |
136 | 137 | return
|
137 | 138 |
|
138 | 139 | # Query whether we have a "detached HEAD", which will mean that
|
@@ -371,6 +372,37 @@ def validate_config(config):
|
371 | 372 | 'aliases?!')
|
372 | 373 |
|
373 | 374 |
|
| 375 | +def full_target_name(repository, target): |
| 376 | + tag = shell.capture(["git", "tag", "-l", target], echo=True).strip() |
| 377 | + if tag == target: |
| 378 | + return tag |
| 379 | + |
| 380 | + branch = shell.capture(["git", "branch", "--list", target], |
| 381 | + echo=True).strip().replace("* ", "") |
| 382 | + if branch == target: |
| 383 | + name = "%s/%s" % (repository, target) |
| 384 | + return name |
| 385 | + |
| 386 | + raise RuntimeError('Cannot determine if %s is a branch or a tag' % target) |
| 387 | + |
| 388 | + |
| 389 | +def skip_list_for_platform(config): |
| 390 | + # If there is a platforms key only include the repo if the |
| 391 | + # plaform is in the list |
| 392 | + skip_list = [] |
| 393 | + platform_name = platform.system() |
| 394 | + |
| 395 | + for repo_name, repo_info in config['repos'].items(): |
| 396 | + if 'platforms' in repo_info: |
| 397 | + if platform_name not in repo_info['platforms']: |
| 398 | + print("Skipping", repo_name, "on", platform_name) |
| 399 | + skip_list.append(repo_name) |
| 400 | + else: |
| 401 | + print("Including", repo_name, "on", platform_name) |
| 402 | + |
| 403 | + return skip_list |
| 404 | + |
| 405 | + |
374 | 406 | def main():
|
375 | 407 | freeze_support()
|
376 | 408 | parser = argparse.ArgumentParser(
|
@@ -494,7 +526,8 @@ def main():
|
494 | 526 | if scheme is None:
|
495 | 527 | scheme = config['default-branch-scheme']
|
496 | 528 |
|
497 |
| - skip_repo_list = args.skip_repository_list |
| 529 | + skip_repo_list = skip_list_for_platform(config) |
| 530 | + skip_repo_list.extend(args.skip_repository_list) |
498 | 531 | clone_results = obtain_all_additional_swift_sources(args, config,
|
499 | 532 | clone_with_ssh,
|
500 | 533 | scheme,
|
|
0 commit comments