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}
diff --git a/tools_webrtc/version_updater/update_version.py b/tools_webrtc/version_updater/update_version.py
index d5a72b8..3c2be3f 100644
--- a/tools_webrtc/version_updater/update_version.py
+++ b/tools_webrtc/version_updater/update_version.py
@@ -42,6 +42,14 @@
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 @@
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...')