Commit cfb9a236 authored by Mun Yong Jang's avatar Mun Yong Jang Committed by Commit Bot

[presubmit] Add logging for CheckChangedLUCIConfig

Add logging for location prefix

Bug: 761488
Change-Id: I2e742fced588111feacf94877487a6c65fffc78e
Reviewed-on: https://chromium-review.googlesource.com/833087
Commit-Queue: Mun Yong Jang <myjang@google.com>
Reviewed-by: 's avatarNodir Turakulov <nodir@chromium.org>
parent 47d74649
......@@ -1235,6 +1235,7 @@ def CheckChangedLUCIConfigs(input_api, output_api):
import collections
import base64
import json
import logging
import urllib2
import auth
......@@ -1286,16 +1287,19 @@ def CheckChangedLUCIConfigs(input_api, output_api):
if not config_sets:
return [output_api.PresubmitWarning('No config_sets were returned')]
loc_pref = '%s/+/%s/' % (remote_host_url, remote_branch)
logging.debug('Derived location prefix: %s', loc_pref)
dir_to_config_set = {
'%s/' % cs['location'][len(loc_pref):].rstrip('/'): cs['config_set']
for cs in config_sets
if cs['location'].startswith(loc_pref) or
('%s/' % cs['location']) == loc_pref
}
logging.debug('dir_to_config_set: %s', dir_to_config_set)
cs_to_files = collections.defaultdict(list)
for f in input_api.AffectedFiles():
# windows
file_path = f.LocalPath().replace(_os.sep, '/')
logging.debug('Affected file path: %s', file_path)
for dr, cs in dir_to_config_set.iteritems():
if dr == '/' or file_path.startswith(dr):
cs_to_files[cs].append({
......@@ -1303,6 +1307,7 @@ def CheckChangedLUCIConfigs(input_api, output_api):
'content': base64.b64encode(
'\n'.join(f.NewContents()).encode('utf-8'))
})
logging.debug('cs_to_files: %s', cs_to_files)
outputs = []
for cs, f in cs_to_files.iteritems():
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment