Skip to content

Commit

Permalink
[WPT Export] Favor Change-Id over Commit-Position when finding PRs
Browse files Browse the repository at this point in the history
From time to time the exporter is unable to find and merge an upstream PR
once its been landed. This is caused by the exporter first searching by
Commit-Position, which in the case of a landed commit does not correspond
to what's on the PR. However, this can lead to false positives where the
Commit-Position in a commit points to another, unrelated upstream PR. This
change fixes that problem by first looking for PRs by Change-Id, which never
changes.

Bug: 745880
Change-Id: I36b12a486fcfce9190ef8d2a9320b723b359ba9b
Reviewed-on: https://chromium-review.googlesource.com/575785
Commit-Queue: Jeff Carpenter <jeffcarp@chromium.org>
Reviewed-by: Quinten Yearsley <qyearsley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487646}
  • Loading branch information
jeffcarp authored and Commit Bot committed Jul 18, 2017
1 parent cc90898 commit 7faa001
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 5 additions & 5 deletions third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ def corresponding_pull_request_for_commit(self, exportable_commit):
Returns the pull_request if found, else returns None.
"""
# Check for PRs created by commits on master.
pull_request = self.wpt_github.pr_with_position(exportable_commit.position)
if pull_request:
return pull_request

# Check for PRs created by open Gerrit CLs.
change_id = exportable_commit.change_id()
if change_id:
return self.wpt_github.pr_with_change_id(change_id)

# Check for PRs created by commits on master.
pull_request = self.wpt_github.pr_with_position(exportable_commit.position)
if pull_request:
return pull_request

return None
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,12 @@ def mock_command(args):
'pr_with_change_id',
'pr_with_change_id',
'pr_with_change_id',
'pr_with_position',
'pr_with_change_id',
'create_pr',
'add_label "chromium-export"',
'pr_with_position',
'pr_with_change_id',
'create_pr',
'add_label "chromium-export"',
'pr_with_position',
'pr_with_change_id',
'create_pr',
'add_label "chromium-export"',
Expand Down Expand Up @@ -294,7 +291,6 @@ def mock_command(args):
test_exporter.run()

self.assertEqual(test_exporter.wpt_github.calls, [
'pr_with_position',
'pr_with_change_id',
'remove_label "do not merge yet"',
'get_pr_branch',
Expand Down

0 comments on commit 7faa001

Please sign in to comment.