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

Side by Side Diff: tests/gclient_scm_test.py

Issue 440263002: Revert of Add --no-history option to fetch and gclient for shallow clones. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 4 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 | « gclient_utils.py ('k') | tests/gclient_smoketest.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 #!/usr/bin/env python 1 #!/usr/bin/env python
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 5
6 """Unit tests for gclient_scm.py.""" 6 """Unit tests for gclient_scm.py."""
7 7
8 # pylint: disable=E1103 8 # pylint: disable=E1103
9 9
10 # Import before super_mox to keep valid references. 10 # Import before super_mox to keep valid references.
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 gclient_scm.gclient_utils.rmtree(self.base_path) 697 gclient_scm.gclient_utils.rmtree(self.base_path)
698 gclient_scm.os.path.exists(self.root_dir).AndReturn(True) 698 gclient_scm.os.path.exists(self.root_dir).AndReturn(True)
699 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None 699 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
700 ).AndReturn('1.5.1') 700 ).AndReturn('1.5.1')
701 gclient_scm.scm.SVN.RunAndGetFileList( 701 gclient_scm.scm.SVN.RunAndGetFileList(
702 options.verbose, 702 options.verbose,
703 ['checkout', self.url, self.base_path, '--force', 703 ['checkout', self.url, self.base_path, '--force',
704 '--ignore-externals'], 704 '--ignore-externals'],
705 cwd=self.root_dir, 705 cwd=self.root_dir,
706 file_list=[]) 706 file_list=[])
707 707
708 gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.' 708 gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.'
709 ).AndReturn({'Revision': 100}) 709 ).AndReturn({'Revision': 100})
710 710
711 self.mox.ReplayAll() 711 self.mox.ReplayAll()
712 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 712 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
713 relpath=self.relpath) 713 relpath=self.relpath)
714 file_list = [] 714 file_list = []
715 scm.update(options, None, file_list) 715 scm.update(options, None, file_list)
716 self.checkstdout('_____ Conflicting directory found in %s. Removing.\n' 716 self.checkstdout('_____ Conflicting directory found in %s. Removing.\n'
717 % self.base_path) 717 % self.base_path)
718 finally: 718 finally:
719 gclient_scm.os.environ = old_environ 719 gclient_scm.os.environ = old_environ
720 720
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 """This class doesn't use pymox.""" 777 """This class doesn't use pymox."""
778 class OptionsObject(object): 778 class OptionsObject(object):
779 def __init__(self, verbose=False, revision=None): 779 def __init__(self, verbose=False, revision=None):
780 self.verbose = verbose 780 self.verbose = verbose
781 self.revision = revision 781 self.revision = revision
782 self.manually_grab_svn_rev = True 782 self.manually_grab_svn_rev = True
783 self.deps_os = None 783 self.deps_os = None
784 self.force = False 784 self.force = False
785 self.reset = False 785 self.reset = False
786 self.nohooks = False 786 self.nohooks = False
787 self.no_history = False
788 self.upstream = False 787 self.upstream = False
789 self.cache_dir = None 788 self.cache_dir = None
790 self.merge = False 789 self.merge = False
791 self.jobs = 1 790 self.jobs = 1
792 self.delete_unversioned_trees = False 791 self.delete_unversioned_trees = False
793 792
794 sample_git_import = """blob 793 sample_git_import = """blob
795 mark :1 794 mark :1
796 data 6 795 data 6
797 Hello 796 Hello
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 self.reset = False 1198 self.reset = False
1200 self.nohooks = False 1199 self.nohooks = False
1201 # TODO(maruel): Test --jobs > 1. 1200 # TODO(maruel): Test --jobs > 1.
1202 self.jobs = 1 1201 self.jobs = 1
1203 1202
1204 def Options(self, *args, **kwargs): 1203 def Options(self, *args, **kwargs):
1205 return self.OptionsObject(*args, **kwargs) 1204 return self.OptionsObject(*args, **kwargs)
1206 1205
1207 def checkstdout(self, expected): 1206 def checkstdout(self, expected):
1208 value = sys.stdout.getvalue() 1207 value = sys.stdout.getvalue()
1209 sys.stdout.close() 1208 sys.stdout.close()
1210 # pylint: disable=E1101 1209 # pylint: disable=E1101
1211 self.assertEquals(expected, strip_timestamps(value)) 1210 self.assertEquals(expected, strip_timestamps(value))
1212 1211
1213 def setUp(self): 1212 def setUp(self):
1214 BaseTestCase.setUp(self) 1213 BaseTestCase.setUp(self)
1215 self.fake_hash_1 = 't0ta11yf4k3' 1214 self.fake_hash_1 = 't0ta11yf4k3'
1216 self.fake_hash_2 = '3v3nf4k3r' 1215 self.fake_hash_2 = '3v3nf4k3r'
1217 self.url = 'git://foo' 1216 self.url = 'git://foo'
1218 self.root_dir = '/tmp' if sys.platform != 'win32' else 't:\\tmp' 1217 self.root_dir = '/tmp' if sys.platform != 'win32' else 't:\\tmp'
1219 self.relpath = 'fake' 1218 self.relpath = 'fake'
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 1582
1584 if __name__ == '__main__': 1583 if __name__ == '__main__':
1585 level = logging.DEBUG if '-v' in sys.argv else logging.FATAL 1584 level = logging.DEBUG if '-v' in sys.argv else logging.FATAL
1586 logging.basicConfig( 1585 logging.basicConfig(
1587 level=level, 1586 level=level,
1588 format='%(asctime).19s %(levelname)s %(filename)s:' 1587 format='%(asctime).19s %(levelname)s %(filename)s:'
1589 '%(lineno)s %(message)s') 1588 '%(lineno)s %(message)s')
1590 unittest.main() 1589 unittest.main()
1591 1590
1592 # vim: ts=2:sw=2:tw=80:et: 1591 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « gclient_utils.py ('k') | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698