Treat refs/heads/main as trunk
Cr-Commit-Position will be updated in coming weeks to reflect actual branch name. This change adds support for both old and new default branch name. Bug: 1236756 Change-Id: Ia06acec3c8e0be58ffa9c5663e3b87694d4d731c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3072729 Reviewed-by: Sam Clegg <sbc@chromium.org> Commit-Queue: Josip Sokcevic <sokcevic@google.com> Cr-Commit-Position: refs/heads/master@{#908630}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
af01ca9f81
commit
90d36a28b2
@ -30,7 +30,7 @@ def ChromeVersion():
|
||||
'''
|
||||
info = FetchCommitPosition()
|
||||
_, ref, revision = ParseCommitPosition(info.revision)
|
||||
if ref == 'refs/heads/master':
|
||||
if ref in ['refs/heads/master', 'refs/heads/main']:
|
||||
return 'trunk.%s' % revision
|
||||
return ChromeVersionNoTrunk()
|
||||
|
||||
@ -75,7 +75,7 @@ def ChromeCommitPosition():
|
||||
|
||||
Returns:
|
||||
A value like:
|
||||
0178d4831bd36b5fb9ff477f03dc43b11626a6dc-refs/heads/master@{#292238}
|
||||
0178d4831bd36b5fb9ff477f03dc43b11626a6dc-refs/heads/main@{#292238}
|
||||
'''
|
||||
return FetchCommitPosition().revision
|
||||
|
||||
@ -125,9 +125,9 @@ def ParseCommitPosition(commit_position):
|
||||
'''Parse a Chrome commit position into its components.
|
||||
|
||||
Given a commit position like:
|
||||
0178d4831bd36b5fb9ff477f03dc43b11626a6dc-refs/heads/master@{#292238}
|
||||
0178d4831bd36b5fb9ff477f03dc43b11626a6dc-refs/heads/main@{#292238}
|
||||
Returns:
|
||||
("0178d4831bd36b5fb9ff477f03dc43b11626a6dc", "refs/heads/master", "292238")
|
||||
("0178d4831bd36b5fb9ff477f03dc43b11626a6dc", "refs/heads/main", "292238")
|
||||
'''
|
||||
m = re.match(r'([0-9a-fA-F]+)(?:-([^@]+)@{#(\d+)})?', commit_position)
|
||||
if m:
|
||||
|
Reference in New Issue
Block a user