Index: tests/gclient_scm_test.py |
diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py |
index 00592244c90ab633a05752319e5e4569aacdf28d..0263741bca538bcbfaca21e9c960cde4dc10d69c 100755 |
--- a/tests/gclient_scm_test.py |
+++ b/tests/gclient_scm_test.py |
@@ -600,106 +600,6 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): |
def tearDown(self): |
BaseTestCase.tearDown(self) |
- def testGetUsableRevGit(self): |
- # pylint: disable=E1101 |
- options = self.Options(verbose=True) |
- |
- self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsValidRevision', True) |
- gclient_scm.scm.GIT.IsValidRevision(cwd=self.base_path, rev=self.fake_hash_1 |
- ).AndReturn(True) |
- |
- self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) |
- gclient_scm.scm.GIT.IsGitSvn(cwd=self.base_path).MultipleTimes( |
- ).AndReturn(False) |
- |
- gclient_scm.scm.os.path.isdir(self.base_path).AndReturn(True) |
- gclient_scm.os.path.isdir(self.base_path).AndReturn(True) |
- |
- self.mox.ReplayAll() |
- |
- git_scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, |
- relpath=self.relpath) |
- # A [fake] git sha1 with a git repo should work (this is in the case that |
- # the LKGR gets flipped to git sha1's some day). |
- self.assertEquals(git_scm.GetUsableRev(self.fake_hash_1, options), |
- self.fake_hash_1) |
- # An SVN rev with an existing purely git repo should raise an exception. |
- self.assertRaises(gclient_scm.gclient_utils.Error, |
- git_scm.GetUsableRev, '1', options) |
- |
- def testGetUsableRevGitSvn(self): |
- # pylint: disable=E1101 |
- options = self.Options() |
- too_big = str(1e7) |
- |
- # Pretend like the git-svn repo's HEAD is at r2. |
- self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'GetGitSvnHeadRev', True) |
- gclient_scm.scm.GIT.GetGitSvnHeadRev(cwd=self.base_path).MultipleTimes( |
- ).AndReturn(2) |
- |
- self.mox.StubOutWithMock( |
- gclient_scm.scm.GIT, 'GetBlessedSha1ForSvnRev', True) |
- # r1 -> first fake hash, r3 -> second fake hash. |
- gclient_scm.scm.GIT.GetBlessedSha1ForSvnRev(cwd=self.base_path, rev='1' |
- ).AndReturn(self.fake_hash_1) |
- gclient_scm.scm.GIT.GetBlessedSha1ForSvnRev(cwd=self.base_path, rev='3' |
- ).MultipleTimes().AndReturn(self.fake_hash_2) |
- |
- # Ensure that we call git svn fetch if our LKGR is > the git-svn HEAD rev. |
- self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Fetch', True) |
- self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'Capture', True) |
- gclient_scm.scm.GIT.Capture(['config', '--get', 'svn-remote.svn.fetch'], |
- cwd=self.base_path).AndReturn('blah') |
- # pylint: disable=E1120 |
- gclient_scm.scm.GIT.Capture(['svn', 'fetch'], cwd=self.base_path) |
- error = subprocess2.CalledProcessError(1, 'cmd', '/cwd', 'stdout', 'stderr') |
- gclient_scm.scm.GIT.Capture(['config', '--get', 'svn-remote.svn.fetch'], |
- cwd=self.base_path).AndRaise(error) |
- gclient_scm.GitWrapper._Fetch(options) |
- gclient_scm.scm.GIT.Capture(['svn', 'fetch'], cwd=self.base_path) |
- gclient_scm.GitWrapper._Fetch(options) |
- |
- self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True) |
- gclient_scm.scm.GIT.IsGitSvn(cwd=self.base_path).MultipleTimes( |
- ).AndReturn(True) |
- |
- self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsValidRevision', True) |
- gclient_scm.scm.GIT.IsValidRevision(cwd=self.base_path, rev=self.fake_hash_1 |
- ).AndReturn(True) |
- gclient_scm.scm.GIT.IsValidRevision(cwd=self.base_path, rev=too_big |
- ).MultipleTimes(2).AndReturn(False) |
- |
- gclient_scm.os.path.isdir(self.base_path).AndReturn(False) |
- gclient_scm.os.path.isdir(self.base_path).MultipleTimes().AndReturn(True) |
- |
- self.mox.ReplayAll() |
- |
- git_svn_scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
- relpath=self.relpath) |
- # Without an existing checkout, this should fail. |
- # TODO(dbeam) Fix this. http://crbug.com/109184 |
- self.assertRaises(gclient_scm.gclient_utils.Error, |
- git_svn_scm.GetUsableRev, '1', options) |
- # Given an SVN revision with a git-svn checkout, it should be translated to |
- # a git sha1 and be usable. |
- self.assertEquals(git_svn_scm.GetUsableRev('1', options), |
- self.fake_hash_1) |
- # Our fake HEAD rev is r2, so this should call git fetch and git svn fetch |
- # to get more revs (pymox will complain if this doesn't happen). We mock an |
- # optimized checkout the first time, so this run should call git fetch. |
- self.assertEquals(git_svn_scm.GetUsableRev('3', options), |
- self.fake_hash_2) |
- # The time we pretend we're not optimized, so no git fetch should fire. |
- self.assertEquals(git_svn_scm.GetUsableRev('3', options), |
- self.fake_hash_2) |
- # Given a git sha1 with a git-svn checkout, it should be used as is. |
- self.assertEquals(git_svn_scm.GetUsableRev(self.fake_hash_1, options), |
- self.fake_hash_1) |
- # We currently check for seemingly valid SVN revisions by assuming 6 digit |
- # numbers, so assure that numeric revs >= 1000000 don't work. |
- self.assertRaises(gclient_scm.gclient_utils.Error, |
- git_svn_scm.GetUsableRev, too_big, options) |
- |
def testUpdateNoDotGit(self): |
options = self.Options() |