Commit 83d51197 authored by Robert Ma's avatar Robert Ma Committed by Commit Bot

[blinkpy] Remove all mentions of Rietveld

The only remaining match was a dead link in common/net/file_uploader.py,
which has been replaced with a permalink (pinned to the correct line &
revision) to GitHub.

Bug: 770329
Change-Id: I89d15897882c8e5b0d73ff61ff401c7f47ff6924
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1863072
Commit-Queue: Robert Ma <robertma@chromium.org>
Auto-Submit: Robert Ma <robertma@chromium.org>
Reviewed-by: default avatarLuke Z <lpz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706192}
parent 80cd5a54
...@@ -48,7 +48,7 @@ def _encode_multipart_form_data(fields, files): ...@@ -48,7 +48,7 @@ def _encode_multipart_form_data(fields, files):
(content_type, body) ready for httplib.HTTP instance. (content_type, body) ready for httplib.HTTP instance.
Source: Source:
http://code.google.com/p/rietveld/source/browse/trunk/upload.py https://github.com/rietveld-codereview/rietveld/blob/1be266f92fbd6e01732e1bde10589bc408d65633/upload.py#L964
""" """
BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-' BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
CRLF = '\r\n' CRLF = '\r\n'
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
"""An interface to git-cl. """An interface to git-cl.
The git-cl tool is responsible for communicating with Rietveld, Gerrit, The git-cl tool is responsible for communicating with Gerrit and Buildbucket to
and Buildbucket to manage changelists and try jobs associated with them. manage changelists and try jobs associated with them.
""" """
import collections import collections
......
...@@ -348,16 +348,9 @@ class WPTGitHub(object): ...@@ -348,16 +348,9 @@ class WPTGitHub(object):
def pr_for_chromium_commit(self, chromium_commit): def pr_for_chromium_commit(self, chromium_commit):
"""Returns a PR corresponding to the given ChromiumCommit, or None.""" """Returns a PR corresponding to the given ChromiumCommit, or None."""
pull_request = self.pr_with_change_id(chromium_commit.change_id()) # We rely on Change-Id because Gerrit returns ToT+1 as the commit
if pull_request: # positions for in-flight CLs, whereas Change-Id is permanent.
return pull_request return self.pr_with_change_id(chromium_commit.change_id())
# The Change ID can't be used for commits made via Rietveld,
# so we fall back to trying to use commit position here.
# Note that Gerrit returns ToT+1 as the commit positions for in-flight
# CLs, but they are scrubbed from the PR description and hence would
# not be mismatched to random Chromium commits in the fallback.
# TODO(robertma): Remove this fallback after Rietveld becomes read-only.
return self.pr_with_position(chromium_commit.position)
def pr_with_change_id(self, target_change_id): def pr_with_change_id(self, target_change_id):
for pull_request in self.all_pull_requests(): for pull_request in self.all_pull_requests():
...@@ -368,14 +361,6 @@ class WPTGitHub(object): ...@@ -368,14 +361,6 @@ class WPTGitHub(object):
return pull_request return pull_request
return None return None
def pr_with_position(self, position):
for pull_request in self.all_pull_requests():
# Same as above, search all 'Cr-Commit-Position's.
pr_commit_positions = self.extract_metadata('Cr-Commit-Position: ', pull_request.body, all_matches=True)
if position in pr_commit_positions:
return pull_request
return None
@staticmethod @staticmethod
def extract_metadata(tag, commit_body, all_matches=False): def extract_metadata(tag, commit_body, all_matches=False):
values = [] values = []
......
...@@ -86,13 +86,6 @@ class MockWPTGitHub(object): ...@@ -86,13 +86,6 @@ class MockWPTGitHub(object):
return pr return pr
return None return None
def pr_with_position(self, position):
self.calls.append('pr_with_position')
for pr in self.pull_requests:
if position in pr.body:
return pr
return None
def pr_with_change_id(self, change_id): def pr_with_change_id(self, change_id):
self.calls.append('pr_with_change_id') self.calls.append('pr_with_change_id')
for pr in self.pull_requests: for pr in self.pull_requests:
......
...@@ -199,16 +199,6 @@ class WPTGitHubTest(unittest.TestCase): ...@@ -199,16 +199,6 @@ class WPTGitHubTest(unittest.TestCase):
pull_request = self.wpt_github.pr_for_chromium_commit(chromium_commit) pull_request = self.wpt_github.pr_for_chromium_commit(chromium_commit)
self.assertEqual(pull_request.number, 2) self.assertEqual(pull_request.number, 2)
def test_pr_for_chromium_commit_falls_back_to_commit_position(self):
self.wpt_github.all_pull_requests = lambda: [
PullRequest('PR1', 1, 'body\nChange-Id: I00c0ffee\nCr-Commit-Position: refs/heads/master@{#10}', 'open', []),
PullRequest('PR2', 2, 'body\nChange-Id: I00decade\nCr-Commit-Position: refs/heads/master@{#33}', 'open', []),
]
chromium_commit = MockChromiumCommit(
MockHost(), position='refs/heads/master@{#10}')
pull_request = self.wpt_github.pr_for_chromium_commit(chromium_commit)
self.assertEqual(pull_request.number, 1)
def test_pr_for_chromium_commit_multiple_change_ids(self): def test_pr_for_chromium_commit_multiple_change_ids(self):
self.wpt_github.all_pull_requests = lambda: [ self.wpt_github.all_pull_requests = lambda: [
PullRequest('PR1', 1, 'body\nChange-Id: I00c0ffee\nChange-Id: I00decade', 'open', []), PullRequest('PR1', 1, 'body\nChange-Id: I00c0ffee\nChange-Id: I00decade', 'open', []),
...@@ -223,19 +213,3 @@ class WPTGitHubTest(unittest.TestCase): ...@@ -223,19 +213,3 @@ class WPTGitHubTest(unittest.TestCase):
MockHost(), change_id='I00decade', position='refs/heads/master@{#33}') MockHost(), change_id='I00decade', position='refs/heads/master@{#33}')
pull_request = self.wpt_github.pr_for_chromium_commit(chromium_commit) pull_request = self.wpt_github.pr_for_chromium_commit(chromium_commit)
self.assertEqual(pull_request.number, 1) self.assertEqual(pull_request.number, 1)
def test_pr_for_chromium_commit_multiple_commit_positions(self):
self.wpt_github.all_pull_requests = lambda: [
PullRequest('PR1', 1, 'body\nCr-Commit-Position: refs/heads/master@{#10}\n'
'Cr-Commit-Position: refs/heads/master@{#33}', 'open', []),
]
chromium_commit = MockChromiumCommit(
MockHost(), position='refs/heads/master@{#10}')
pull_request = self.wpt_github.pr_for_chromium_commit(chromium_commit)
self.assertEqual(pull_request.number, 1)
chromium_commit = MockChromiumCommit(
MockHost(), position='refs/heads/master@{#33}')
pull_request = self.wpt_github.pr_for_chromium_commit(chromium_commit)
self.assertEqual(pull_request.number, 1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment