Print overview of external changes

This gives users an idea of what changes they are applying.

Bug:1382528, 1405491
Change-Id: Icb1e94f193b9cba3d80cc918c2abb11c2527ad3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4082289
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
diff --git a/git_cl.py b/git_cl.py
index 869ea23..0e2793f 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2761,10 +2761,29 @@
       return
 
     num_changes = external_ps - local_ps
-    print('\n%d external change(s) have been published to %s. '
-          'Uploading as-is will override them.' %
-          (num_changes, self.GetIssueURL(short=True)))
-    if not ask_for_explicit_yes('Get the latest changes and apply?'):
+    if num_changes > 1:
+      change_words = 'changes were'
+    else:
+      change_words = 'change was'
+    print('\n%d external %s published to %s:\n' %
+          (num_changes, change_words, self.GetIssueURL(short=True)))
+
+    # Print an overview of external changes.
+    ps_to_commit = {}
+    ps_to_info = {}
+    revisions = self._GetChangeDetail(['ALL_REVISIONS'])
+    for commit_id, revision_info in revisions.get('revisions', {}).items():
+      ps_num = revision_info['_number']
+      ps_to_commit[ps_num] = commit_id
+      ps_to_info[ps_num] = revision_info
+
+    for ps in range(external_ps, local_ps, -1):
+      commit = ps_to_commit[ps][:8]
+      desc = ps_to_info[ps].get('description', '')
+      print('Patchset %d [%s] %s' % (ps, commit, desc))
+
+    if not ask_for_explicit_yes('\nUploading as-is will override them. '
+                                'Get the latest changes and apply?'):
       return
 
     # Get latest Gerrit merge base. Use the first parent even if multiple exist.