| OLD | NEW |
| 1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 import logging | 32 import logging |
| 33 import optparse | 33 import optparse |
| 34 import re | 34 import re |
| 35 import sys | 35 import sys |
| 36 import time | 36 import time |
| 37 import traceback | 37 import traceback |
| 38 import urllib2 | 38 import urllib2 |
| 39 | 39 |
| 40 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer | 40 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer |
| 41 from webkitpy.common.memoized import memoized | 41 from webkitpy.common.memoized import memoized |
| 42 from webkitpy.common.net.buildbot import Build |
| 42 from webkitpy.common.system.executive import ScriptError | 43 from webkitpy.common.system.executive import ScriptError |
| 43 from webkitpy.layout_tests.controllers.test_result_writer import baseline_name | 44 from webkitpy.layout_tests.controllers.test_result_writer import baseline_name |
| 44 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS
ELINE_SUFFIX_LIST, SKIP | 45 from webkitpy.layout_tests.models.test_expectations import TestExpectations, BAS
ELINE_SUFFIX_LIST, SKIP |
| 45 from webkitpy.layout_tests.port import factory | 46 from webkitpy.layout_tests.port import factory |
| 46 from webkitpy.tool.commands.command import Command | 47 from webkitpy.tool.commands.command import Command |
| 47 | 48 |
| 48 | 49 |
| 49 _log = logging.getLogger(__name__) | 50 _log = logging.getLogger(__name__) |
| 50 | 51 |
| 51 | 52 |
| 52 class Build(object): | |
| 53 """Represents a combination of builder and build number. | |
| 54 | |
| 55 If build number is None, this represents the latest build | |
| 56 for a given builder. | |
| 57 | |
| 58 TODO(qyearsley): Move this somewhere else; note it's very similar to TryJob, | |
| 59 and it seems like it might belong in the buildbot module. | |
| 60 TODO(qyearsley): Make this a subclass of namedtuple so that __hash__, | |
| 61 __eq__ and __cmp__ don't need to be explicitly added. | |
| 62 """ | |
| 63 def __init__(self, builder_name, build_number=None): | |
| 64 self.builder_name = builder_name | |
| 65 self.build_number = build_number | |
| 66 | |
| 67 # Having __hash__ and __eq__ allow instances of this class to be used | |
| 68 # as keys in dictionaries. | |
| 69 def __hash__(self): | |
| 70 return hash((self.builder_name, self.build_number)) | |
| 71 | |
| 72 def __eq__(self, other): | |
| 73 return (self.builder_name, self.build_number) == (other.builder_name, ot
her.build_number) | |
| 74 | |
| 75 def __cmp__(self, other): | |
| 76 return cmp((self.builder_name, self.build_number), (other.builder_name,
other.build_number)) | |
| 77 | |
| 78 | |
| 79 class AbstractRebaseliningCommand(Command): | 53 class AbstractRebaseliningCommand(Command): |
| 80 """Base class for rebaseline-related commands.""" | 54 """Base class for rebaseline-related commands.""" |
| 81 # Not overriding execute() - pylint: disable=abstract-method | 55 # Not overriding execute() - pylint: disable=abstract-method |
| 82 | 56 |
| 83 no_optimize_option = optparse.make_option('--no-optimize', dest='optimize',
action='store_false', default=True, | 57 no_optimize_option = optparse.make_option('--no-optimize', dest='optimize',
action='store_false', default=True, |
| 84 help=('Do not optimize/de-dup the
expectations after rebaselining (default is to de-dup automatically). ' | 58 help=('Do not optimize/de-dup the
expectations after rebaselining (default is to de-dup automatically). ' |
| 85 'You can use "webkit-patch o
ptimize-baselines" to optimize separately.')) | 59 'You can use "webkit-patch o
ptimize-baselines" to optimize separately.')) |
| 86 | 60 |
| 87 platform_options = factory.platform_options(use_globs=True) | 61 platform_options = factory.platform_options(use_globs=True) |
| 88 | 62 |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 issue_already_closed = tool.executive.run_command( | 949 issue_already_closed = tool.executive.run_command( |
| 976 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], | 950 ['git', 'config', 'branch.%s.rietveldissue' % rebaseline
_branch_name], |
| 977 return_exit_code=True) | 951 return_exit_code=True) |
| 978 if not issue_already_closed: | 952 if not issue_already_closed: |
| 979 self._run_git_cl_command(options, ['set_close']) | 953 self._run_git_cl_command(options, ['set_close']) |
| 980 | 954 |
| 981 tool.scm().ensure_cleanly_tracking_remote_master() | 955 tool.scm().ensure_cleanly_tracking_remote_master() |
| 982 if old_branch_name_or_ref: | 956 if old_branch_name_or_ref: |
| 983 tool.scm().checkout_branch(old_branch_name_or_ref) | 957 tool.scm().checkout_branch(old_branch_name_or_ref) |
| 984 tool.scm().delete_branch(rebaseline_branch_name) | 958 tool.scm().delete_branch(rebaseline_branch_name) |
| OLD | NEW |