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

Side by Side Diff: gclient_scm.py

Issue 1560029: Fix File() to work with SVN 1.4 by using svn export in place... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 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 | « no previous file | scm.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 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Gclient-specific SCM-specific operations.""" 5 """Gclient-specific SCM-specific operations."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import re 10 import re
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 return 742 return
743 743
744 command = ["update", checkout_path] 744 command = ["update", checkout_path]
745 if revision: 745 if revision:
746 command.extend(['--revision', str(revision)]) 746 command.extend(['--revision', str(revision)])
747 scm.SVN.RunAndGetFileList(options, command, self._root_dir, file_list) 747 scm.SVN.RunAndGetFileList(options, command, self._root_dir, file_list)
748 748
749 def updatesingle(self, options, args, file_list): 749 def updatesingle(self, options, args, file_list):
750 checkout_path = os.path.join(self._root_dir, self.relpath) 750 checkout_path = os.path.join(self._root_dir, self.relpath)
751 filename = args.pop() 751 filename = args.pop()
752 if not os.path.exists(checkout_path): 752 if scm.SVN.AssertVersion("1.5")[0]:
753 # Create an empty checkout and then update the one file we want. Future 753 if not os.path.exists(os.path.join(checkout_path, '.svn')):
754 # operations will only apply to the one file we checked out. 754 # Create an empty checkout and then update the one file we want. Future
755 command = ["checkout", "--depth", "empty", self.url, checkout_path] 755 # operations will only apply to the one file we checked out.
756 command = ["checkout", "--depth", "empty", self.url, checkout_path]
757 scm.SVN.Run(command, self._root_dir)
758 if os.path.exists(os.path.join(checkout_path, filename)):
759 os.remove(os.path.join(checkout_path, filename))
760 command = ["update", filename]
761 scm.SVN.RunAndGetFileList(options, command, checkout_path, file_list)
762 # After the initial checkout, we can use update as if it were any other
763 # dep.
764 self.update(options, args, file_list)
765 else:
766 # If the installed version of SVN doesn't support --depth, fallback to
767 # just exporting the file. This has the downside that revision
768 # information is not stored next to the file, so we will have to
769 # re-export the file every time we sync.
770 if not os.path.exists(checkout_path):
771 os.makedirs(checkout_path)
772 command = ["export", os.path.join(self.url, filename),
773 os.path.join(checkout_path, filename)]
774 if options.revision:
775 command.extend(['--revision', str(options.revision)])
756 scm.SVN.Run(command, self._root_dir) 776 scm.SVN.Run(command, self._root_dir)
757 command = ["update", filename]
758 scm.SVN.RunAndGetFileList(options, command, checkout_path, file_list)
759 # After the initial checkout, we can use update as if it were any other
760 # dep.
761 self.update(options, args, file_list)
762 777
763 def revert(self, options, args, file_list): 778 def revert(self, options, args, file_list):
764 """Reverts local modifications. Subversion specific. 779 """Reverts local modifications. Subversion specific.
765 780
766 All reverted files will be appended to file_list, even if Subversion 781 All reverted files will be appended to file_list, even if Subversion
767 doesn't know about them. 782 doesn't know about them.
768 """ 783 """
769 __pychecker__ = 'unusednames=args' 784 __pychecker__ = 'unusednames=args'
770 path = os.path.join(self._root_dir, self.relpath) 785 path = os.path.join(self._root_dir, self.relpath)
771 if not os.path.isdir(path): 786 if not os.path.isdir(path):
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory " 850 print("\n________ couldn't run \'%s\' in \'%s\':\nThe directory "
836 "does not exist." 851 "does not exist."
837 % (' '.join(command), path)) 852 % (' '.join(command), path))
838 # There's no file list to retrieve. 853 # There's no file list to retrieve.
839 else: 854 else:
840 scm.SVN.RunAndGetFileList(options, command, path, file_list) 855 scm.SVN.RunAndGetFileList(options, command, path, file_list)
841 856
842 def FullUrlForRelativeUrl(self, url): 857 def FullUrlForRelativeUrl(self, url):
843 # Find the forth '/' and strip from there. A bit hackish. 858 # Find the forth '/' and strip from there. A bit hackish.
844 return '/'.join(self.url.split('/')[:4]) + url 859 return '/'.join(self.url.split('/')[:4]) + url
OLDNEW
« no previous file with comments | « no previous file | scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698