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

Side by Side Diff: checkout.py

Issue 10909254: Fix svn copies for apply_issue (Closed) Base URL: https://git.chromium.org/chromium/tools/depot_tools.git@master
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Manages a project checkout. 5 """Manages a project checkout.
6 6
7 Includes support for svn, git-svn and git. 7 Includes support for svn, git-svn and git.
8 """ 8 """
9 9
10 import ConfigParser 10 import ConfigParser
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if p.source_filename: 332 if p.source_filename:
333 if not p.is_new: 333 if not p.is_new:
334 raise PatchApplicationFailed( 334 raise PatchApplicationFailed(
335 p, 335 p,
336 'File has a source filename specified but is not new') 336 'File has a source filename specified but is not new')
337 # Copy the file first. 337 # Copy the file first.
338 if os.path.isfile(filepath): 338 if os.path.isfile(filepath):
339 raise PatchApplicationFailed( 339 raise PatchApplicationFailed(
340 p, 'File exist but was about to be overwriten') 340 p, 'File exist but was about to be overwriten')
341 self._check_output_svn( 341 self._check_output_svn(
342 [ 342 ['copy', p.source_filename, p.filename])
343 'copy',
344 os.path.join(self.project_path, p.source_filename),
345 filepath
346 ])
347 if p.diff_hunks: 343 if p.diff_hunks:
348 cmd = ['patch', '-p%s' % p.patchlevel, '--forward', '--force'] 344 cmd = ['patch', '-p%s' % p.patchlevel, '--forward', '--force']
349 stdout += subprocess2.check_output( 345 stdout += subprocess2.check_output(
350 cmd, stdin=p.get(False), cwd=self.project_path) 346 cmd, stdin=p.get(False), cwd=self.project_path)
351 elif p.is_new and not os.path.exists(filepath): 347 elif p.is_new and not os.path.exists(filepath):
352 # There is only a header. Just create the file if it doesn't 348 # There is only a header. Just create the file if it doesn't
353 # exist. 349 # exist.
354 open(filepath, 'w').close() 350 open(filepath, 'w').close()
355 if p.is_new and not p.source_filename: 351 if p.is_new and not p.source_filename:
356 # Do not run it if p.source_filename is defined, since svn copy was 352 # Do not run it if p.source_filename is defined, since svn copy was
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 def revisions(self, rev1, rev2): 643 def revisions(self, rev1, rev2):
648 return self.checkout.revisions(rev1, rev2) 644 return self.checkout.revisions(rev1, rev2)
649 645
650 @property 646 @property
651 def project_name(self): 647 def project_name(self):
652 return self.checkout.project_name 648 return self.checkout.project_name
653 649
654 @property 650 @property
655 def project_path(self): 651 def project_path(self):
656 return self.checkout.project_path 652 return self.checkout.project_path
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698