Extend git-cl-owners to show all owners for a file

Change-Id: Ie1109c3da9c687a9543c0cfb91f8660c29fb36c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1664391
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index cb1f087..2ad008f 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -5367,6 +5367,12 @@
       '--batch',
       action='store_true',
       help='Do not run interactively, just suggest some')
+  # TODO: Consider moving this to another command, since other
+  #       git-cl owners commands deal with owners for a given CL.
+  parser.add_option(
+      '--show-all',
+      action='store_true',
+      help='Show all owners for a particular file')
   auth.add_auth_options(parser)
   options, args = parser.parse_args(args)
   auth_config = auth.extract_auth_config_from_options(options)
@@ -5375,6 +5381,17 @@
 
   cl = Changelist(auth_config=auth_config)
 
+  if options.show_all:
+    for arg in args:
+      base_branch = cl.GetCommonAncestorWithUpstream()
+      change = cl.GetChange(base_branch, None)
+      database = owners.Database(change.RepositoryRoot(), file, os.path)
+      database.load_data_needed_for([arg])
+      print('Owners for %s:' % arg)
+      for owner in sorted(database.all_possible_owners([arg], None)):
+        print(' - %s' % owner)
+    return 0
+
   if args:
     if len(args) > 1:
       parser.error('Unknown args')