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

Side by Side Diff: patch.py

Issue 6891003: Add post_process argument to Checkout.apply_patch(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: post_processor 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 | « checkout.py ('k') | tests/checkout_test.py » ('j') | 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 """Utility functions to handle patches.""" 5 """Utility functions to handle patches."""
6 6
7 import posixpath 7 import posixpath
8 import os 8 import os
9 import re 9 import re
10 10
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 # 'diff' header. That the only remaining invariant. 266 # 'diff' header. That the only remaining invariant.
267 if not self.filename in self.diff_header: 267 if not self.filename in self.diff_header:
268 self._fail('Diff seems corrupted.') 268 self._fail('Diff seems corrupted.')
269 269
270 270
271 class PatchSet(object): 271 class PatchSet(object):
272 """A list of FilePatch* objects.""" 272 """A list of FilePatch* objects."""
273 273
274 def __init__(self, patches): 274 def __init__(self, patches):
275 self.patches = patches 275 self.patches = patches
276 for p in self.patches:
277 assert isinstance(p, FilePatchBase)
276 278
277 def set_relpath(self, relpath): 279 def set_relpath(self, relpath):
278 """Used to offset the patch into a subdirectory.""" 280 """Used to offset the patch into a subdirectory."""
279 for patch in self.patches: 281 for patch in self.patches:
280 patch.set_relpath(relpath) 282 patch.set_relpath(relpath)
281 283
282 def __iter__(self): 284 def __iter__(self):
283 for patch in self.patches: 285 for patch in self.patches:
284 yield patch 286 yield patch
285 287
286 @property 288 @property
287 def filenames(self): 289 def filenames(self):
288 return [p.filename for p in self.patches] 290 return [p.filename for p in self.patches]
OLDNEW
« no previous file with comments | « checkout.py ('k') | tests/checkout_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698