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

Side by Side Diff: checkout.py

Issue 18664004: Create a temporary dir for patch to do its work. (Closed) Base URL: http://src.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 7 years, 5 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 cmd = ['add', p.filename] 613 cmd = ['add', p.filename]
614 if verbose: 614 if verbose:
615 cmd.append('--verbose') 615 cmd.append('--verbose')
616 stdout.append(self._check_output_git(cmd)) 616 stdout.append(self._check_output_git(cmd))
617 else: 617 else:
618 # No need to do anything special with p.is_new or if not 618 # No need to do anything special with p.is_new or if not
619 # p.diff_hunks. git apply manages all that already. 619 # p.diff_hunks. git apply manages all that already.
620 cmd = ['apply', '--index', '-p%s' % p.patchlevel] 620 cmd = ['apply', '--index', '-p%s' % p.patchlevel]
621 if verbose: 621 if verbose:
622 cmd.append('--verbose') 622 cmd.append('--verbose')
623 new_tmpdir = tempfile.mkdtemp('pfix')
624 old_tmpdir = os.environ['TMPDIR']
Isaac (away) 2013/07/12 04:03:42 are you sure this environment variable exists?
groby-ooo-7-16 2013/07/12 04:16:16 Doesn't matter if it exists - according to the pat
625 os.environ['TMPDIR'] = new_tmpdir
623 stdout.append(self._check_output_git(cmd, stdin=p.get(True))) 626 stdout.append(self._check_output_git(cmd, stdin=p.get(True)))
627 os.environ['TMPDIR'] = old_tmpdir
628 shutil.rmtree(new_tmpdir)
Isaac (away) 2013/07/12 04:03:42 this should be a try finally (with rmtree in the f
groby-ooo-7-16 2013/07/12 04:16:16 Done.
624 for name, value in p.svn_properties: 629 for name, value in p.svn_properties:
625 # Ignore some known auto-props flags through .subversion/config, 630 # Ignore some known auto-props flags through .subversion/config,
626 # bails out on the other ones. 631 # bails out on the other ones.
627 # TODO(maruel): Read ~/.subversion/config and detect the rules that 632 # TODO(maruel): Read ~/.subversion/config and detect the rules that
628 # applies here to figure out if the property will be correctly 633 # applies here to figure out if the property will be correctly
629 # handled. 634 # handled.
630 stdout.append('Property %s=%s' % (name, value)) 635 stdout.append('Property %s=%s' % (name, value))
631 if not name in ( 636 if not name in (
632 'svn:eol-style', 'svn:executable', 'svn:mime-type'): 637 'svn:eol-style', 'svn:executable', 'svn:mime-type'):
633 raise patch.UnsupportedPatchFormat( 638 raise patch.UnsupportedPatchFormat(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 def revisions(self, rev1, rev2): 756 def revisions(self, rev1, rev2):
752 return self.checkout.revisions(rev1, rev2) 757 return self.checkout.revisions(rev1, rev2)
753 758
754 @property 759 @property
755 def project_name(self): 760 def project_name(self):
756 return self.checkout.project_name 761 return self.checkout.project_name
757 762
758 @property 763 @property
759 def project_path(self): 764 def project_path(self):
760 return self.checkout.project_path 765 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