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

Side by Side Diff: Tools/Scripts/webkitpy/common/checkout/checkout.py

Issue 27055003: Remove a bunch of unused webkitpy code from tool/, common/checkout/ and common/config/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
OLDNEW
(Empty)
1 # Copyright (c) 2010 Google Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
12 # distribution.
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 import StringIO
30
31 from webkitpy.common.config import urls
32 from webkitpy.common.checkout.scm import CommitMessage
33 from webkitpy.common.checkout.deps import DEPS
34 from webkitpy.common.memoized import memoized
35 from webkitpy.common.system.executive import ScriptError
36
37
38 # This class represents the WebKit-specific parts of the checkout.
39 # NOTE: All paths returned from this class should be absolute.
40 class Checkout(object):
41 def __init__(self, scm, executive=None, filesystem=None):
42 self._scm = scm
43 # FIXME: We shouldn't be grabbing at private members on scm.
44 self._executive = executive or self._scm._executive
45 self._filesystem = filesystem or self._scm._filesystem
46
47 def _modified_files_matching_predicate(self, git_commit, predicate, changed_ files=None):
48 # SCM returns paths relative to scm.checkout_root
49 # Callers (especially those using the ChangeLog class) may
50 # expect absolute paths, so this method returns absolute paths.
51 if not changed_files:
52 changed_files = self._scm.changed_files(git_commit)
53 return filter(predicate, map(self._scm.absolute_path, changed_files))
54
55 def recent_commit_infos_for_files(self, paths):
56 revisions = set(sum(map(self._scm.revisions_changing_file, paths), []))
57 return set(map(self.commit_info_for_revision, revisions))
58
59 def apply_patch(self, patch):
60 # It's possible that the patch was not made from the root directory.
61 # We should detect and handle that case.
62 # FIXME: Move _scm.script_path here once we get rid of all the dependenc ies.
63 # --force (continue after errors) is the common case, so we always use i t.
64 args = [self._scm.script_path('svn-apply'), "--force"]
65 if patch.reviewer():
66 args += ['--reviewer', patch.reviewer().full_name]
67 self._executive.run_command(args, input=patch.contents(), cwd=self._scm. checkout_root)
68
69 def apply_reverse_diff(self, revision):
70 self._scm.apply_reverse_diff(revision)
71
72 conflicts = self._scm.conflicted_files()
73 if len(conflicts):
74 raise ScriptError(message="Failed to apply reverse diff for revision %s because of the following conflicts:\n%s" % (revision, "\n".join(conflicts)))
75
76 def apply_reverse_diffs(self, revision_list):
77 for revision in sorted(revision_list, reverse=True):
78 self.apply_reverse_diff(revision)
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/common/checkout/__init__.py ('k') | Tools/Scripts/webkitpy/common/checkout/checkout_mock.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698