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

Side by Side Diff: gclient_scm.py

Issue 6883263: Remove unmaintained "gclient export" command, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 9 years, 7 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 | « gclient.py ('k') | tests/gclient_scm_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 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2010 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if self.relpath: 103 if self.relpath:
104 self.relpath = self.relpath.replace('/', os.sep) 104 self.relpath = self.relpath.replace('/', os.sep)
105 if self.relpath and self._root_dir: 105 if self.relpath and self._root_dir:
106 self.checkout_path = os.path.join(self._root_dir, self.relpath) 106 self.checkout_path = os.path.join(self._root_dir, self.relpath)
107 107
108 def RunCommand(self, command, options, args, file_list=None): 108 def RunCommand(self, command, options, args, file_list=None):
109 # file_list will have all files that are modified appended to it. 109 # file_list will have all files that are modified appended to it.
110 if file_list is None: 110 if file_list is None:
111 file_list = [] 111 file_list = []
112 112
113 commands = ['cleanup', 'export', 'update', 'updatesingle', 'revert', 113 commands = ['cleanup', 'update', 'updatesingle', 'revert',
114 'revinfo', 'status', 'diff', 'pack', 'runhooks'] 114 'revinfo', 'status', 'diff', 'pack', 'runhooks']
115 115
116 if not command in commands: 116 if not command in commands:
117 raise gclient_utils.Error('Unknown command %s' % command) 117 raise gclient_utils.Error('Unknown command %s' % command)
118 118
119 if not command in dir(self): 119 if not command in dir(self):
120 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % ( 120 raise gclient_utils.Error('Command %s not implemented in %s wrapper' % (
121 command, self.__class__.__name__)) 121 command, self.__class__.__name__))
122 122
123 return getattr(self, command)(options, args, file_list) 123 return getattr(self, command)(options, args, file_list)
(...skipping 13 matching lines...) Expand all
137 def cleanup(options, args, file_list): 137 def cleanup(options, args, file_list):
138 """'Cleanup' the repo. 138 """'Cleanup' the repo.
139 139
140 There's no real git equivalent for the svn cleanup command, do a no-op. 140 There's no real git equivalent for the svn cleanup command, do a no-op.
141 """ 141 """
142 142
143 def diff(self, options, args, file_list): 143 def diff(self, options, args, file_list):
144 merge_base = self._Capture(['merge-base', 'HEAD', 'origin']) 144 merge_base = self._Capture(['merge-base', 'HEAD', 'origin'])
145 self._Run(['diff', merge_base], options) 145 self._Run(['diff', merge_base], options)
146 146
147 def export(self, options, args, file_list):
148 """Export a clean directory tree into the given path.
149
150 Exports into the specified directory, creating the path if it does
151 already exist.
152 """
153 assert len(args) == 1
154 export_path = os.path.abspath(os.path.join(args[0], self.relpath))
155 if not os.path.exists(export_path):
156 os.makedirs(export_path)
157 self._Run(['checkout-index', '-a', '--prefix=%s/' % export_path],
158 options)
159
160 def pack(self, options, args, file_list): 147 def pack(self, options, args, file_list):
161 """Generates a patch file which can be applied to the root of the 148 """Generates a patch file which can be applied to the root of the
162 repository. 149 repository.
163 150
164 The patch file is generated from a diff of the merge base of HEAD and 151 The patch file is generated from a diff of the merge base of HEAD and
165 its upstream branch. 152 its upstream branch.
166 """ 153 """
167 merge_base = self._Capture(['merge-base', 'HEAD', 'origin']) 154 merge_base = self._Capture(['merge-base', 'HEAD', 'origin'])
168 gclient_utils.CheckCallAndFilter( 155 gclient_utils.CheckCallAndFilter(
169 ['git', 'diff', merge_base], 156 ['git', 'diff', merge_base],
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 """Cleanup working copy.""" 681 """Cleanup working copy."""
695 self._Run(['cleanup'] + args, options) 682 self._Run(['cleanup'] + args, options)
696 683
697 def diff(self, options, args, file_list): 684 def diff(self, options, args, file_list):
698 # NOTE: This function does not currently modify file_list. 685 # NOTE: This function does not currently modify file_list.
699 if not os.path.isdir(self.checkout_path): 686 if not os.path.isdir(self.checkout_path):
700 raise gclient_utils.Error('Directory %s is not present.' % 687 raise gclient_utils.Error('Directory %s is not present.' %
701 self.checkout_path) 688 self.checkout_path)
702 self._Run(['diff'] + args, options) 689 self._Run(['diff'] + args, options)
703 690
704 def export(self, options, args, file_list):
705 """Export a clean directory tree into the given path."""
706 assert len(args) == 1
707 export_path = os.path.abspath(os.path.join(args[0], self.relpath))
708 try:
709 os.makedirs(export_path)
710 except OSError:
711 pass
712 assert os.path.exists(export_path)
713 self._Run(['export', '--force', '.', export_path], options)
714
715 def pack(self, options, args, file_list): 691 def pack(self, options, args, file_list):
716 """Generates a patch file which can be applied to the root of the 692 """Generates a patch file which can be applied to the root of the
717 repository.""" 693 repository."""
718 if not os.path.isdir(self.checkout_path): 694 if not os.path.isdir(self.checkout_path):
719 raise gclient_utils.Error('Directory %s is not present.' % 695 raise gclient_utils.Error('Directory %s is not present.' %
720 self.checkout_path) 696 self.checkout_path)
721 gclient_utils.CheckCallAndFilter( 697 gclient_utils.CheckCallAndFilter(
722 ['svn', 'diff', '-x', '--ignore-eol-style'] + args, 698 ['svn', 'diff', '-x', '--ignore-eol-style'] + args,
723 cwd=self.checkout_path, 699 cwd=self.checkout_path,
724 print_stdout=False, 700 print_stdout=False,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 932
957 This method returns a new list to be used as a command.""" 933 This method returns a new list to be used as a command."""
958 new_command = command[:] 934 new_command = command[:]
959 if revision: 935 if revision:
960 new_command.extend(['--revision', str(revision).strip()]) 936 new_command.extend(['--revision', str(revision).strip()])
961 # --force was added to 'svn update' in svn 1.5. 937 # --force was added to 'svn update' in svn 1.5.
962 if ((options.force or options.manually_grab_svn_rev) and 938 if ((options.force or options.manually_grab_svn_rev) and
963 scm.SVN.AssertVersion("1.5")[0]): 939 scm.SVN.AssertVersion("1.5")[0]):
964 new_command.append('--force') 940 new_command.append('--force')
965 return new_command 941 return new_command
OLDNEW
« no previous file with comments | « gclient.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698