| OLD | NEW |
| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 raise PatchApplicationFailed( | 336 raise PatchApplicationFailed( |
| 337 p, | 337 p, |
| 338 'File has a source filename specified but is not new') | 338 'File has a source filename specified but is not new') |
| 339 # Copy the file first. | 339 # Copy the file first. |
| 340 if os.path.isfile(filepath): | 340 if os.path.isfile(filepath): |
| 341 raise PatchApplicationFailed( | 341 raise PatchApplicationFailed( |
| 342 p, 'File exist but was about to be overwriten') | 342 p, 'File exist but was about to be overwriten') |
| 343 self._check_output_svn( | 343 self._check_output_svn( |
| 344 ['copy', p.source_filename, p.filename]) | 344 ['copy', p.source_filename, p.filename]) |
| 345 if p.diff_hunks: | 345 if p.diff_hunks: |
| 346 cmd = ['patch', '-p%s' % p.patchlevel, '--forward', '--force'] | 346 cmd = [ |
| 347 'patch', |
| 348 '-p%s' % p.patchlevel, |
| 349 '--forward', |
| 350 '--force', |
| 351 '--no-backup-if-mismatch', |
| 352 ] |
| 347 stdout += subprocess2.check_output( | 353 stdout += subprocess2.check_output( |
| 348 cmd, stdin=p.get(False), cwd=self.project_path) | 354 cmd, stdin=p.get(False), cwd=self.project_path) |
| 349 elif p.is_new and not os.path.exists(filepath): | 355 elif p.is_new and not os.path.exists(filepath): |
| 350 # There is only a header. Just create the file if it doesn't | 356 # There is only a header. Just create the file if it doesn't |
| 351 # exist. | 357 # exist. |
| 352 open(filepath, 'w').close() | 358 open(filepath, 'w').close() |
| 353 if p.is_new and not p.source_filename: | 359 if p.is_new and not p.source_filename: |
| 354 # Do not run it if p.source_filename is defined, since svn copy was | 360 # Do not run it if p.source_filename is defined, since svn copy was |
| 355 # using above. | 361 # using above. |
| 356 stdout += self._check_output_svn( | 362 stdout += self._check_output_svn( |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 def revisions(self, rev1, rev2): | 655 def revisions(self, rev1, rev2): |
| 650 return self.checkout.revisions(rev1, rev2) | 656 return self.checkout.revisions(rev1, rev2) |
| 651 | 657 |
| 652 @property | 658 @property |
| 653 def project_name(self): | 659 def project_name(self): |
| 654 return self.checkout.project_name | 660 return self.checkout.project_name |
| 655 | 661 |
| 656 @property | 662 @property |
| 657 def project_path(self): | 663 def project_path(self): |
| 658 return self.checkout.project_path | 664 return self.checkout.project_path |
| OLD | NEW |