[depot_tools] Use logging.warning
logging.warn is deprecated and should be replaced with logging.warning.
Bug:1097402
Change-Id: I55ce007bec47608eeafcf3cd9ac2b90f60073115
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2575621
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
diff --git a/git_cache.py b/git_cache.py
index beee6fe..c332520 100755
--- a/git_cache.py
+++ b/git_cache.py
@@ -360,10 +360,11 @@
for fetchspec in config_fetchspecs.splitlines():
self.fetch_specs.add(self.parse_fetch_spec(fetchspec))
except subprocess.CalledProcessError:
- logging.warn('Tried and failed to preserve remote.origin.fetch from the '
- 'existing cache directory. You may need to manually edit '
- '%s and "git cache fetch" again.'
- % os.path.join(self.mirror_path, 'config'))
+ logging.warning(
+ 'Tried and failed to preserve remote.origin.fetch from the '
+ 'existing cache directory. You may need to manually edit '
+ '%s and "git cache fetch" again.' %
+ os.path.join(self.mirror_path, 'config'))
def _ensure_bootstrapped(
self, depth, bootstrap, reset_fetch_config, force=False):
@@ -381,7 +382,7 @@
if not should_bootstrap:
if depth and os.path.exists(os.path.join(self.mirror_path, 'shallow')):
- logging.warn(
+ logging.warning(
'Shallow fetch requested, but repo cache already exists.')
return
@@ -408,10 +409,10 @@
self.RunGit(['init', '--bare'], cwd=self.mirror_path)
else:
# Bootstrap failed, previous cache exists; warn and continue.
- logging.warn(
+ logging.warning(
'Git cache has a lot of pack files (%d). Tried to re-bootstrap '
- 'but failed. Continuing with non-optimized repository.'
- % len(pack_files))
+ 'but failed. Continuing with non-optimized repository.' %
+ len(pack_files))
def _fetch(self,
rundir,
@@ -444,7 +445,7 @@
except subprocess.CalledProcessError:
if spec == '+refs/heads/*:refs/heads/*':
raise ClobberNeeded() # Corrupted cache.
- logging.warn('Fetch of %s failed' % spec)
+ logging.warning('Fetch of %s failed' % spec)
def populate(self,
depth=None,
@@ -565,9 +566,9 @@
f = os.path.join(pack_dir, f)
try:
os.remove(f)
- logging.warn('Deleted stale temporary pack file %s' % f)
+ logging.warning('Deleted stale temporary pack file %s' % f)
except OSError:
- logging.warn('Unable to delete temporary pack file %s' % f)
+ logging.warning('Unable to delete temporary pack file %s' % f)
@subcommand.usage('[url of repo to check for caching]')
@@ -772,7 +773,7 @@
if global_cache_dir and (
os.path.abspath(options.cache_dir) !=
os.path.abspath(global_cache_dir)):
- logging.warn('Overriding globally-configured cache directory.')
+ logging.warning('Overriding globally-configured cache directory.')
Mirror.SetCachePath(options.cache_dir)
return options, args