Avoid two consecutive version updates.

No-Presubmit: True
Bug: webrtc:12159
Change-Id: Iad9e4f1e6b971241cb8ddce8e36f1b8e8d8a39f8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212021
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#33474}
This commit is contained in:
Mirko Bonadei
2021-03-15 20:41:34 +01:00
committed by Commit Bot
parent 9d1e07063e
commit a776f5198f

View File

@ -42,6 +42,14 @@ def _RemovePreviousUpdateBranch():
logging.info('No branch to remove')
def _GetLastAuthor():
"""Returns a string with the author of the last commit."""
author = subprocess.check_output(['git', 'log',
'-1',
'--pretty=format:"%an"']).splitlines()
return author
def _GetBranches():
"""Returns a tuple (active, branches).
@ -142,11 +150,15 @@ def main():
if opts.clean:
_RemovePreviousUpdateBranch()
if _GetLastAuthor() == 'webrtc-version-updater':
logging.info('Last commit is a version change, skipping CL.')
return 0
version_filename = os.path.join(CHECKOUT_SRC_DIR, 'call', 'version.cc')
_CreateUpdateBranch()
_UpdateWebRTCVersion(version_filename)
if _IsTreeClean():
logging.info("No WebRTC version change detected, skipping CL.")
logging.info('No WebRTC version change detected, skipping CL.')
else:
_LocalCommit()
logging.info('Uploading CL...')