Chromium Code Reviews| Index: scripts/slave/bot_update.py |
| diff --git a/scripts/slave/bot_update.py b/scripts/slave/bot_update.py |
| index 1df92f1b25a03ee57db1711f48a6da22a00cab65..906dd6664d06710763e63e8497090b19034a3e33 100755 |
| --- a/scripts/slave/bot_update.py |
| +++ b/scripts/slave/bot_update.py |
| @@ -603,15 +603,6 @@ def get_git_hash(revision, dir_name): |
| revision) |
| -def get_revision_mapping(root, addl_rev_map): |
| - result = {} |
| - if root in GOT_REVISION_MAPPINGS: |
| - result.update(GOT_REVISION_MAPPINGS[root]) |
| - if addl_rev_map: |
| - result.update(json.loads(addl_rev_map)) |
| - return result |
| - |
| - |
| def _last_commit_for_file(filename, repo_base): |
| cmd = ['log', '--format=%H', '--max-count=1', '--', filename] |
| return git(*cmd, cwd=repo_base).strip() |
| @@ -850,7 +841,7 @@ def apply_issue_svn(root, patch_url): |
| stdin_data=patch_data, cwd=root) |
| -def apply_issue_rietveld(issue, patchset, root, server, rev_map, revision): |
| +def apply_issue_rietveld(issue, patchset, root, server, _rev_map, revision): |
| apply_issue_bin = ('apply_issue.bat' if sys.platform.startswith('win') |
| else 'apply_issue') |
| call(apply_issue_bin, |
| @@ -1038,8 +1029,13 @@ def parse_args(): |
| parse.add_option('-f', '--force', action='store_true', |
| help='Bypass check to see if we want to be run. ' |
| 'Should ONLY be used locally.') |
| - parse.add_option('--revision_mapping') |
| - parse.add_option('--revision-mapping') # Backwards compatability. |
| + parse.add_option('--revision_mapping', |
| + help='{"path/to/repo/": "property_name"}') |
| + parse.add_option('--revision_mapping_file', |
| + help=('Same as revision_mapping, except its a path to a json' |
| + ' file containing that format.')) |
| + parse.add_option('--revision-mapping', # Backwards compatability. |
| + help='DEPRECATED, use "revision_mapping" instead') |
| # TODO(hinoka): Support root@revision format. |
| parse.add_option('--revision', |
| help='Revision to check out. Can be an SVN revision number, ' |
| @@ -1062,7 +1058,24 @@ def parse_args(): |
| help='Output JSON information into a specified file') |
| - return parse.parse_args() |
| + options, args = parse.parse_args() |
| + |
| + try: |
| + if options.revision_mapping_file is not None: |
|
hinoka
2014/05/09 23:08:13
"if options.revision_mapping_file" should be suffi
iannucci
2014/05/11 03:48:45
Done.
|
| + if options.revision_mapping is not None: |
| + print ('WARNING: revision_mapping_file was set at the same ' |
| + 'time as revision_mapping?') |
|
hinoka
2014/05/09 23:08:13
nit: Add "Ignoring revision_mapping" to warning.
iannucci
2014/05/11 03:48:45
Done.
|
| + with open(options.revision_mapping_file, 'r') as f: |
| + options.revision_mapping = json.load(f) |
| + elif options.revision_mapping is not None: |
| + options.revision_mapping = json.loads(options.revision_mapping) |
| + except Exception as e: |
| + print ( |
| + 'WARNING: Caught execption while parsing revision_mapping*: %s' |
| + % (str(e),) |
| + ) |
| + |
| + return options, args |
| def main(): |
| @@ -1183,7 +1196,10 @@ def main(): |
| # Revision is an svn revision, unless its a git master or past flag day. |
| use_svn_rev = master not in GIT_MASTERS and not FLAG_DAY |
| # Take care of got_revisions outputs. |
| - revision_mapping = get_revision_mapping(svn_root, options.revision_mapping) |
| + revision_mapping = GOT_REVISION_MAPPINGS.get(svn_root, {}) |
| + if options.revision_mapping: |
| + revision_mapping.update(options.revision_mapping) |
| + |
| got_revisions = parse_got_revision(gclient_output, revision_mapping, |
| use_svn_rev) |