Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Side by Side Diff: verification/project_base.py

Issue 6813044: Add relative path support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/commit-queue
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/project_base_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding=utf8 1 # coding=utf8
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 """Ignores issues not using the right project base url regex.""" 5 """Ignores issues not using the right project base url regex."""
6 6
7 import logging 7 import logging
8 import os
8 import re 9 import re
9 10
11 import find_depot_tools # pylint: disable=W0611
12 import breakpad
13
10 from verification import base 14 from verification import base
11 15
12 16
13 class ProjectBaseUrlVerifier(base.Verifier): 17 class ProjectBaseUrlVerifier(base.Verifier):
14 """Needs the project base url to match at least one regexp in self.regex.""" 18 """Needs the project base url to match at least one regexp in self.regex."""
15 name = 'project_bases' 19 name = 'project_bases'
16 20
17 def __init__(self, project_bases): 21 def __init__(self, project_bases):
18 super(ProjectBaseUrlVerifier, self).__init__() 22 super(ProjectBaseUrlVerifier, self).__init__()
19 self.project_bases = project_bases 23 self.project_bases = project_bases
20 24
21 def verify(self, pending, revision): 25 def verify(self, pending, revision):
22 if not any(re.match(r, pending.base_url) for r in self.project_bases): 26 matches = filter(
27 None, (re.match(r, pending.base_url) for r in self.project_bases))
28 if not matches:
23 logging.info('%s not in whitelist' % pending.base_url) 29 logging.info('%s not in whitelist' % pending.base_url)
24 state = base.IGNORED 30 state = base.IGNORED
25 else: 31 else:
32 if len(matches) != 1:
33 breakpad.SendStack(
34 Exception('pending.base_url triggered multiple matches'), '')
35 match = matches[0]
36 if match.lastindex:
37 pending.relpath = match.group(match.lastindex).lstrip('/').replace(
38 '/', os.sep)
26 state = base.SUCCEEDED 39 state = base.SUCCEEDED
27 pending.verifications[self.name] = base.SimpleStatus(state) 40 pending.verifications[self.name] = base.SimpleStatus(state)
28 41
29 def update_status(self, queue): 42 def update_status(self, queue):
30 pass 43 pass
OLDNEW
« no previous file with comments | « tests/project_base_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698