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

Unified Diff: gclient_scm.py

Issue 1356005: Add the ability to check out a single file from a repo.... (Closed) Base URL: http://src.chromium.org/svn/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
===================================================================
--- gclient_scm.py (revision 43902)
+++ gclient_scm.py (working copy)
@@ -97,8 +97,8 @@
if file_list is None:
file_list = []
- commands = ['cleanup', 'export', 'update', 'revert', 'revinfo',
- 'status', 'diff', 'pack', 'runhooks']
+ commands = ['cleanup', 'export', 'update', 'updatesingle', 'revert',
+ 'revinfo', 'status', 'diff', 'pack', 'runhooks']
if not command in commands:
raise gclient_utils.Error('Unknown command %s' % command)
@@ -746,6 +746,20 @@
command.extend(['--revision', str(revision)])
scm.SVN.RunAndGetFileList(options, command, self._root_dir, file_list)
+ def updatesingle(self, options, args, file_list):
+ checkout_path = os.path.join(self._root_dir, self.relpath)
+ filename = args.pop()
+ if not os.path.exists(checkout_path):
+ # Create an empty checkout and then update the one file we want. Future
+ # operations will only apply to the one file we checked out.
+ command = ["checkout", "--depth", "empty", self.url, checkout_path]
+ scm.SVN.Run(command, self._root_dir)
+ command = ["update", filename]
+ scm.SVN.RunAndGetFileList(options, command, checkout_path, file_list)
+ # After the initial checkout, we can use update as if it were any other
+ # dep.
+ self.update(options, args, file_list)
+
def revert(self, options, args, file_list):
"""Reverts local modifications. Subversion specific.
« 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