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>
changes/29/4033329/5
Gavin Mak 2 years ago committed by LUCI CQ
parent be242dbeac
commit f35a9ebe8a

@ -1913,6 +1913,23 @@ class Changelist(object):
self.SetPatchset(patchset) self.SetPatchset(patchset)
return 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): def GetMostRecentDryRunPatchset(self):
"""Get patchsets equivalent to the most recent patchset and return """Get patchsets equivalent to the most recent patchset and return
the patchset with the latest dry run. If none have been dry run, return the patchset with the latest dry run. If none have been dry run, return
@ -2739,7 +2756,8 @@ class Changelist(object):
return return
external_ps = self.GetMostRecentPatchset(update=False) 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 return
num_changes = external_ps - local_ps num_changes = external_ps - local_ps

Loading…
Cancel
Save