Don't prompt unsignificant external changes
Description changes shouldn't prompt. Changes like these that don't
change code or the merge base won't get overriden anyway.
Bug: 1382528
Change-Id: Ie1947a28ea97a8383a791e76738a2ad20c349878
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4033329
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
diff --git a/git_cl.py b/git_cl.py
index 6e07ff8..4b26d5e 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1913,6 +1913,23 @@
self.SetPatchset(patchset)
return patchset
+ def _IsPatchsetRangeSignificant(self, lower, upper):
+ """Returns True if the inclusive range of patchsets contains any reworks or
+ rebases."""
+ if not self.GetIssue():
+ return False
+
+ data = self._GetChangeDetail(['ALL_REVISIONS'])
+ ps_kind = {}
+ for rev_info in data.get('revisions', {}).values():
+ ps_kind[rev_info['_number']] = rev_info.get('kind', '')
+
+ for ps in range(lower, upper + 1):
+ assert ps in ps_kind, 'expected patchset %d in change detail' % ps
+ if ps_kind[ps] not in ('NO_CHANGE', 'NO_CODE_CHANGE'):
+ return True
+ return False
+
def GetMostRecentDryRunPatchset(self):
"""Get patchsets equivalent to the most recent patchset and return
the patchset with the latest dry run. If none have been dry run, return
@@ -2739,7 +2756,8 @@
return
external_ps = self.GetMostRecentPatchset(update=False)
- if external_ps is None or local_ps == external_ps:
+ if external_ps is None or local_ps == external_ps or \
+ not self._IsPatchsetRangeSignificant(local_ps + 1, external_ps):
return
num_changes = external_ps - local_ps