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

Unified Diff: tests/gclient_scm_test.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_scm.py ('k') | tests/gclient_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_scm_test.py
===================================================================
--- tests/gclient_scm_test.py (revision 43902)
+++ tests/gclient_scm_test.py (working copy)
@@ -60,7 +60,8 @@
members = [
'FullUrlForRelativeUrl', 'RunCommand',
'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert',
- 'revinfo', 'runhooks', 'scm_name', 'status', 'update', 'url',
+ 'revinfo', 'runhooks', 'scm_name', 'status', 'update',
+ 'updatesingle', 'url',
]
# If you add a member, be sure to add the relevant test!
@@ -266,6 +267,61 @@
relpath=self.relpath)
scm.update(options, (), files_list)
+ def testUpdateSingleCheckout(self):
+ options = self.Options(verbose=True)
+ base_path = gclient_scm.os.path.join(self.root_dir, self.relpath)
+ file_info = {
+ 'URL': self.url,
+ 'Revision': 42,
+ }
+ # When checking out a single file, we issue an svn checkout and svn update.
+ gclient_scm.os.path.exists(base_path).AndReturn(False)
+ files_list = self.mox.CreateMockAnything()
+ gclient_scm.scm.SVN.Run(
+ ['checkout', '--depth', 'empty', self.url, base_path], self.root_dir)
+ gclient_scm.scm.SVN.RunAndGetFileList(options, ['update', 'DEPS'],
+ gclient_scm.os.path.join(self.root_dir, self.relpath), files_list)
+
+ # Now we fall back on scm.update().
+ gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git')
+ ).AndReturn(False)
+ gclient_scm.os.path.exists(base_path).AndReturn(True)
+ gclient_scm.scm.SVN.CaptureInfo(
+ gclient_scm.os.path.join(base_path, "."), '.'
+ ).AndReturn(file_info)
+ gclient_scm.scm.SVN.CaptureInfo(file_info['URL'], '.').AndReturn(file_info)
+ print("\n_____ %s at 42" % self.relpath)
+
+ self.mox.ReplayAll()
+ scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
+ relpath=self.relpath)
+ scm.updatesingle(options, ['DEPS'], files_list)
+
+ def testUpdateSingleUpdate(self):
+ options = self.Options(verbose=True)
+ base_path = gclient_scm.os.path.join(self.root_dir, self.relpath)
+ file_info = {
+ 'URL': self.url,
+ 'Revision': 42,
+ }
+ gclient_scm.os.path.exists(base_path).AndReturn(True)
+
+ # Now we fall back on scm.update().
+ files_list = self.mox.CreateMockAnything()
+ gclient_scm.os.path.exists(gclient_scm.os.path.join(base_path, '.git')
+ ).AndReturn(False)
+ gclient_scm.os.path.exists(base_path).AndReturn(True)
+ gclient_scm.scm.SVN.CaptureInfo(
+ gclient_scm.os.path.join(base_path, "."), '.'
+ ).AndReturn(file_info)
+ gclient_scm.scm.SVN.CaptureInfo(file_info['URL'], '.').AndReturn(file_info)
+ print("\n_____ %s at 42" % self.relpath)
+
+ self.mox.ReplayAll()
+ scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
+ relpath=self.relpath)
+ scm.updatesingle(options, ['DEPS'], files_list)
+
def testUpdateGit(self):
options = self.Options(verbose=True)
file_path = gclient_scm.os.path.join(self.root_dir, self.relpath, '.git')
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698