Commit b7f759f6 authored by Edward Lemur's avatar Edward Lemur Committed by LUCI CQ

git-cl: Use open instead of file.

file does not exist on Python 3.

Change-Id: I9392fd797b730784cff4d1144c5a3ab1027c7dd8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2086493Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
parent 1a83da1f
...@@ -2781,7 +2781,7 @@ class ChangeDescription(object): ...@@ -2781,7 +2781,7 @@ class ChangeDescription(object):
# Next, maybe fill in OWNERS coverage gaps to either tbrs/reviewers. # Next, maybe fill in OWNERS coverage gaps to either tbrs/reviewers.
if add_owners_to: if add_owners_to:
owners_db = owners.Database(change.RepositoryRoot(), owners_db = owners.Database(change.RepositoryRoot(),
fopen=file, os_path=os.path) fopen=open, os_path=os.path)
missing_files = owners_db.files_not_covered_by(change.LocalPaths(), missing_files = owners_db.files_not_covered_by(change.LocalPaths(),
(tbrs | reviewers)) (tbrs | reviewers))
LOOKUP[add_owners_to].update( LOOKUP[add_owners_to].update(
...@@ -4944,7 +4944,7 @@ def CMDowners(parser, args): ...@@ -4944,7 +4944,7 @@ def CMDowners(parser, args):
if options.show_all: if options.show_all:
for arg in args: for arg in args:
base_branch = cl.GetCommonAncestorWithUpstream() base_branch = cl.GetCommonAncestorWithUpstream()
database = owners.Database(settings.GetRoot(), file, os.path) database = owners.Database(settings.GetRoot(), open, os.path)
database.load_data_needed_for([arg]) database.load_data_needed_for([arg])
print('Owners for %s:' % arg) print('Owners for %s:' % arg)
for owner in sorted(database.all_possible_owners([arg], None)): for owner in sorted(database.all_possible_owners([arg], None)):
...@@ -4963,7 +4963,7 @@ def CMDowners(parser, args): ...@@ -4963,7 +4963,7 @@ def CMDowners(parser, args):
affected_files = [f.LocalPath() for f in change.AffectedFiles()] affected_files = [f.LocalPath() for f in change.AffectedFiles()]
if options.batch: if options.batch:
db = owners.Database(change.RepositoryRoot(), file, os.path) db = owners.Database(change.RepositoryRoot(), open, os.path)
print('\n'.join(db.reviewers_for(affected_files, author))) print('\n'.join(db.reviewers_for(affected_files, author)))
return 0 return 0
...@@ -4972,7 +4972,7 @@ def CMDowners(parser, args): ...@@ -4972,7 +4972,7 @@ def CMDowners(parser, args):
change.RepositoryRoot(), change.RepositoryRoot(),
author, author,
[] if options.ignore_current else cl.GetReviewers(), [] if options.ignore_current else cl.GetReviewers(),
fopen=file, os_path=os.path, fopen=open, os_path=os.path,
disable_color=options.no_color, disable_color=options.no_color,
override_files=change.OriginalOwnersFiles(), override_files=change.OriginalOwnersFiles(),
ignore_author=options.ignore_self).run() ignore_author=options.ignore_self).run()
......
...@@ -208,7 +208,7 @@ def SplitCl(description_file, comment_file, changelist, cmd_upload, dry_run, ...@@ -208,7 +208,7 @@ def SplitCl(description_file, comment_file, changelist, cmd_upload, dry_run,
assert refactor_branch_upstream, \ assert refactor_branch_upstream, \
"Branch %s must have an upstream." % refactor_branch "Branch %s must have an upstream." % refactor_branch
owners_database = owners.Database(change.RepositoryRoot(), file, os.path) owners_database = owners.Database(change.RepositoryRoot(), open, os.path)
owners_database.load_data_needed_for([f.LocalPath() for f in files]) owners_database.load_data_needed_for([f.LocalPath() for f in files])
files_split_by_owners = GetFilesSplitByOwners(owners_database, files) files_split_by_owners = GetFilesSplitByOwners(owners_database, files)
......
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