|
|
|
@ -44,7 +44,8 @@ class GClientSmokeBase(FakeReposTestBase):
|
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
|
|
|
|
shell=sys.platform.startswith('win'))
|
|
|
|
|
(stdout, stderr) = process.communicate()
|
|
|
|
|
return (stdout, stderr, process.returncode)
|
|
|
|
|
return (stdout.replace('\r\n', '\n'), stderr.replace('\r\n', '\n'),
|
|
|
|
|
process.returncode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GClientSmoke(GClientSmokeBase):
|
|
|
|
@ -81,7 +82,7 @@ class GClientSmoke(GClientSmokeBase):
|
|
|
|
|
os.remove(p)
|
|
|
|
|
results = self.gclient(cmd)
|
|
|
|
|
self.check(('', '', 0), results)
|
|
|
|
|
self.checkString(expected, open(p, 'rb').read())
|
|
|
|
|
self.checkString(expected, open(p, 'rU').read())
|
|
|
|
|
|
|
|
|
|
test(['config', self.svn_base + 'trunk/src/'],
|
|
|
|
|
'solutions = [\n'
|
|
|
|
@ -137,13 +138,12 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[-1]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[-1]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/foo',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
)
|
|
|
|
|
tree[join('src', 'svn_hooked1')] = 'svn_hooked1'
|
|
|
|
|
tree['src/svn_hooked1'] = 'svn_hooked1'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
# Manually remove svn_hooked1 before synching to make sure it's not
|
|
|
|
@ -159,13 +159,11 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/fpp',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'),
|
|
|
|
|
join('src', 'third_party', 'prout'),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/prout',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
)
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
@ -177,18 +175,16 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/fpp',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/foo',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'),
|
|
|
|
|
join('src', 'third_party', 'prout'),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/prout',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
)
|
|
|
|
|
tree[join('src', 'svn_hooked1')] = 'svn_hooked1'
|
|
|
|
|
tree['src/svn_hooked1'] = 'svn_hooked1'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
def testSyncIgnoredSolutionName(self):
|
|
|
|
@ -201,13 +197,12 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
'will soon considered an error.\n', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/foo',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
)
|
|
|
|
|
tree[join('src', 'svn_hooked1')] = 'svn_hooked1'
|
|
|
|
|
tree['src/svn_hooked1'] = 'svn_hooked1'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
def testSyncNoSolutionName(self):
|
|
|
|
@ -219,13 +214,11 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/fpp',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'),
|
|
|
|
|
join('src', 'third_party', 'prout'),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/prout',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
)
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
@ -236,13 +229,13 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
self.gclient(['sync', '--deps', 'mac'])
|
|
|
|
|
write(join(self.root_dir, 'src', 'other', 'hi'), 'Hey!')
|
|
|
|
|
|
|
|
|
|
results = self.gclient(['status'])
|
|
|
|
|
results = self.gclient(['status', '--deps', 'mac'])
|
|
|
|
|
out = results[0].splitlines(False)
|
|
|
|
|
self.assertEquals(out[0], '')
|
|
|
|
|
self.assertTrue(out[1].startswith('________ running \'svn status\' in \''))
|
|
|
|
|
self.assertEquals(out[2], '? svn_hooked1')
|
|
|
|
|
self.assertEquals(out[3], '? other')
|
|
|
|
|
self.assertEquals(out[4], '? third_party/foo')
|
|
|
|
|
self.assertEquals(out[4], '? ' + join('third_party', 'foo'))
|
|
|
|
|
self.assertEquals(out[5], '')
|
|
|
|
|
self.assertTrue(out[6].startswith('________ running \'svn status\' in \''))
|
|
|
|
|
self.assertEquals(out[7], '? hi')
|
|
|
|
@ -252,30 +245,32 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
|
|
|
|
|
# Revert implies --force implies running hooks without looking at pattern
|
|
|
|
|
# matching.
|
|
|
|
|
results = self.gclient(['revert'])
|
|
|
|
|
results = self.gclient(['revert', '--deps', 'mac'])
|
|
|
|
|
out = results[0].splitlines(False)
|
|
|
|
|
self.assertEquals(22, len(out))
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[-1]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[-1]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/foo',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
)
|
|
|
|
|
tree[join('src', 'svn_hooked1')] = 'svn_hooked1'
|
|
|
|
|
tree[join('src', 'svn_hooked2')] = 'svn_hooked2'
|
|
|
|
|
tree['src/svn_hooked1'] = 'svn_hooked1'
|
|
|
|
|
tree['src/svn_hooked2'] = 'svn_hooked2'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
results = self.gclient(['status'])
|
|
|
|
|
results = self.gclient(['status', '--deps', 'mac'])
|
|
|
|
|
out = results[0].splitlines(False)
|
|
|
|
|
self.assertEquals(out[0], '')
|
|
|
|
|
self.assertTrue(out[1].startswith('________ running \'svn status\' in \''))
|
|
|
|
|
self.assertEquals(out[2], '? svn_hooked1')
|
|
|
|
|
self.assertEquals(out[3], '? svn_hooked2')
|
|
|
|
|
self.assertEquals(out[4], '? other')
|
|
|
|
|
self.assertEquals(out[5], '? third_party/foo')
|
|
|
|
|
# I don't know why but on Windows they are reversed.
|
|
|
|
|
if (not (out[3] == '? other' and out[4] == '? svn_hooked2') and
|
|
|
|
|
not (out[3] == '? svn_hooked2' and out[4] == '? other')):
|
|
|
|
|
self.assertEquals(out[3], '? svn_hooked2')
|
|
|
|
|
self.assertEquals(out[4], '? other')
|
|
|
|
|
self.assertEquals(out[5], '? ' + join('third_party', 'foo'))
|
|
|
|
|
self.assertEquals(6, len(out))
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
@ -291,8 +286,8 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(out[0], '')
|
|
|
|
|
self.assertTrue(out[1].startswith('________ running \'svn status\' in \''))
|
|
|
|
|
self.assertEquals(out[2], '? other')
|
|
|
|
|
self.assertEquals(out[3], '? third_party/fpp')
|
|
|
|
|
self.assertEquals(out[4], '? third_party/prout')
|
|
|
|
|
self.assertEquals(out[3], '? ' + join('third_party', 'fpp'))
|
|
|
|
|
self.assertEquals(out[4], '? ' + join('third_party', 'prout'))
|
|
|
|
|
self.assertEquals(out[5], '')
|
|
|
|
|
self.assertTrue(out[6].startswith('________ running \'svn status\' in \''))
|
|
|
|
|
self.assertEquals(out[7], '? hi')
|
|
|
|
@ -308,13 +303,11 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/fpp',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'prout'),
|
|
|
|
|
join('src', 'third_party', 'prout'),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/third_party/prout', 'src/third_party/prout',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
)
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
@ -324,8 +317,8 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(out[0], '')
|
|
|
|
|
self.assertTrue(out[1].startswith('________ running \'svn status\' in \''))
|
|
|
|
|
self.assertEquals(out[2], '? other')
|
|
|
|
|
self.assertEquals(out[3], '? third_party/fpp')
|
|
|
|
|
self.assertEquals(out[4], '? third_party/prout')
|
|
|
|
|
self.assertEquals(out[3], '? ' + join('third_party', 'fpp'))
|
|
|
|
|
self.assertEquals(out[4], '? ' + join('third_party', 'prout'))
|
|
|
|
|
self.assertEquals(5, len(out))
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
@ -333,16 +326,16 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
def testRunHooks(self):
|
|
|
|
|
self.gclient(['config', self.svn_base + 'trunk/src/'])
|
|
|
|
|
self.gclient(['sync', '--deps', 'mac'])
|
|
|
|
|
results = self.gclient(['runhooks'])
|
|
|
|
|
results = self.gclient(['runhooks', '--deps', 'mac'])
|
|
|
|
|
out = results[0].splitlines(False)
|
|
|
|
|
self.assertEquals(4, len(out))
|
|
|
|
|
self.assertEquals(out[0], '')
|
|
|
|
|
self.assertTrue(re.match(r'^________ running \'.*?python -c '
|
|
|
|
|
self.assertTrue(re.match(r'^________ running \'.*?python(.exe)? -c '
|
|
|
|
|
r'open\(\'src/svn_hooked1\', \'w\'\)\.write\(\'svn_hooked1\'\)\' in \'.*',
|
|
|
|
|
out[1]))
|
|
|
|
|
self.assertEquals(out[2], '')
|
|
|
|
|
# runhooks runs all hooks even if not matching by design.
|
|
|
|
|
self.assertTrue(re.match(r'^________ running \'.*?python -c '
|
|
|
|
|
self.assertTrue(re.match(r'^________ running \'.*?python(.exe)? -c '
|
|
|
|
|
r'open\(\'src/svn_hooked2\', \'w\'\)\.write\(\'svn_hooked2\'\)\' in \'.*',
|
|
|
|
|
out[3]))
|
|
|
|
|
self.checkString('', results[1])
|
|
|
|
@ -351,14 +344,14 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
def testRunHooksDepsOs(self):
|
|
|
|
|
self.gclient(['config', self.svn_base + 'trunk/src/'])
|
|
|
|
|
self.gclient(['sync', '--deps', 'mac', '--revision', 'src@1'])
|
|
|
|
|
results = self.gclient(['runhooks'])
|
|
|
|
|
results = self.gclient(['runhooks', '--deps', 'mac'])
|
|
|
|
|
self.check(('', '', 0), results)
|
|
|
|
|
|
|
|
|
|
def testRevInfo(self):
|
|
|
|
|
# TODO(maruel): Test multiple solutions.
|
|
|
|
|
self.gclient(['config', self.svn_base + 'trunk/src/'])
|
|
|
|
|
self.gclient(['sync', '--deps', 'mac'])
|
|
|
|
|
results = self.gclient(['revinfo'])
|
|
|
|
|
results = self.gclient(['revinfo', '--deps', 'mac'])
|
|
|
|
|
out = ('src: %(base)s/src@2;\n'
|
|
|
|
|
'src/other: %(base)s/other@2;\n'
|
|
|
|
|
'src/third_party/foo: %(base)s/third_party/foo@1\n' %
|
|
|
|
@ -369,9 +362,11 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
|
|
class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
def setUp(self):
|
|
|
|
|
GClientSmokeBase.setUp(self)
|
|
|
|
|
self.FAKE_REPOS.setUpGIT()
|
|
|
|
|
self.enabled = self.FAKE_REPOS.setUpGIT()
|
|
|
|
|
|
|
|
|
|
def testSync(self):
|
|
|
|
|
if not self.enabled:
|
|
|
|
|
return
|
|
|
|
|
# TODO(maruel): safesync.
|
|
|
|
|
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
|
|
|
|
|
# Test unversioned checkout.
|
|
|
|
@ -384,12 +379,11 @@ class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_git_tree(
|
|
|
|
|
('src', self.FAKE_REPOS.git_hashes['repo_1'][1][1]),
|
|
|
|
|
(join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo_renamed'),
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
('src/repo2', self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
|
|
|
|
|
('src/repo2/repo_renamed', self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
)
|
|
|
|
|
tree[join('src', 'git_hooked1')] = 'git_hooked1'
|
|
|
|
|
tree[join('src', 'git_hooked2')] = 'git_hooked2'
|
|
|
|
|
tree['src/git_hooked1'] = 'git_hooked1'
|
|
|
|
|
tree['src/git_hooked2'] = 'git_hooked2'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
# Manually remove git_hooked1 before synching to make sure it's not
|
|
|
|
@ -407,12 +401,11 @@ class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_git_tree(
|
|
|
|
|
('src', self.FAKE_REPOS.git_hashes['repo_1'][0][1]),
|
|
|
|
|
(join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo3'),
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
(join('src', 'repo4'), self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
|
|
|
|
|
('src/repo2', self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
|
|
|
|
|
('src/repo2/repo3', self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
('src/repo4', self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
|
|
|
|
|
)
|
|
|
|
|
tree[join('src', 'git_hooked2')] = 'git_hooked2'
|
|
|
|
|
tree['src/git_hooked2'] = 'git_hooked2'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
# Test incremental sync: delete-unversioned_trees isn't there.
|
|
|
|
|
results = self.gclient(['sync', '--deps', 'mac'])
|
|
|
|
@ -423,19 +416,19 @@ class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_git_tree(
|
|
|
|
|
('src', self.FAKE_REPOS.git_hashes['repo_1'][1][1]),
|
|
|
|
|
(join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo3'),
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo_renamed'),
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
(join('src', 'repo4'), self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
|
|
|
|
|
('src/repo2', self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
|
|
|
|
|
('src/repo2/repo3', self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
('src/repo2/repo_renamed', self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
('src/repo4', self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
|
|
|
|
|
)
|
|
|
|
|
tree[join('src', 'git_hooked1')] = 'git_hooked1'
|
|
|
|
|
tree[join('src', 'git_hooked2')] = 'git_hooked2'
|
|
|
|
|
tree['src/git_hooked1'] = 'git_hooked1'
|
|
|
|
|
tree['src/git_hooked2'] = 'git_hooked2'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
def testSyncIgnoredSolutionName(self):
|
|
|
|
|
"""TODO(maruel): This will become an error soon."""
|
|
|
|
|
if not self.enabled:
|
|
|
|
|
return
|
|
|
|
|
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
|
|
|
|
|
results = self.gclient([
|
|
|
|
|
'sync', '--deps', 'mac', '--revision',
|
|
|
|
@ -452,15 +445,17 @@ class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_git_tree(
|
|
|
|
|
('src', self.FAKE_REPOS.git_hashes['repo_1'][1][1]),
|
|
|
|
|
(join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo_renamed'),
|
|
|
|
|
('src/repo2', self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
|
|
|
|
|
('src/repo2/repo_renamed',
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
)
|
|
|
|
|
tree[join('src', 'git_hooked1')] = 'git_hooked1'
|
|
|
|
|
tree[join('src', 'git_hooked2')] = 'git_hooked2'
|
|
|
|
|
tree['src/git_hooked1'] = 'git_hooked1'
|
|
|
|
|
tree['src/git_hooked2'] = 'git_hooked2'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
def testSyncNoSolutionName(self):
|
|
|
|
|
if not self.enabled:
|
|
|
|
|
return
|
|
|
|
|
# When no solution name is provided, gclient uses the first solution listed.
|
|
|
|
|
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
|
|
|
|
|
results = self.gclient([
|
|
|
|
@ -475,21 +470,22 @@ class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_git_tree(
|
|
|
|
|
('src', self.FAKE_REPOS.git_hashes['repo_1'][0][1]),
|
|
|
|
|
(join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo3'),
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
(join('src', 'repo4'), self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
|
|
|
|
|
('src/repo2', self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
|
|
|
|
|
('src/repo2/repo3', self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
('src/repo4', self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
|
|
|
|
|
)
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
def testRevertAndStatus(self):
|
|
|
|
|
"""TODO(maruel): Remove this line once this test is fixed."""
|
|
|
|
|
if not self.enabled:
|
|
|
|
|
return
|
|
|
|
|
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
|
|
|
|
|
# Tested in testSync.
|
|
|
|
|
self.gclient(['sync', '--deps', 'mac'])
|
|
|
|
|
write(join(self.root_dir, 'src', 'repo2', 'hi'), 'Hey!')
|
|
|
|
|
|
|
|
|
|
results = self.gclient(['status'])
|
|
|
|
|
results = self.gclient(['status', '--deps', 'mac'])
|
|
|
|
|
out = results[0].splitlines(False)
|
|
|
|
|
# TODO(maruel): http://crosbug.com/3584 It should output the unversioned
|
|
|
|
|
# files.
|
|
|
|
@ -497,7 +493,7 @@ class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
|
|
|
|
|
# Revert implies --force implies running hooks without looking at pattern
|
|
|
|
|
# matching.
|
|
|
|
|
results = self.gclient(['revert'])
|
|
|
|
|
results = self.gclient(['revert', '--deps', 'mac'])
|
|
|
|
|
out = results[0].splitlines(False)
|
|
|
|
|
# TODO(maruel): http://crosbug.com/3583 It just runs the hooks right now.
|
|
|
|
|
self.assertEquals(7, len(out))
|
|
|
|
@ -505,26 +501,27 @@ class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_git_tree(
|
|
|
|
|
('src', self.FAKE_REPOS.git_hashes['repo_1'][1][1]),
|
|
|
|
|
(join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo_renamed'),
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
('src/repo2', self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
|
|
|
|
|
('src/repo2/repo_renamed', self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
)
|
|
|
|
|
# TODO(maruel): http://crosbug.com/3583 This file should have been removed.
|
|
|
|
|
tree[join('src', 'repo2', 'hi')] = 'Hey!'
|
|
|
|
|
tree[join('src', 'git_hooked1')] = 'git_hooked1'
|
|
|
|
|
tree[join('src', 'git_hooked2')] = 'git_hooked2'
|
|
|
|
|
tree['src/git_hooked1'] = 'git_hooked1'
|
|
|
|
|
tree['src/git_hooked2'] = 'git_hooked2'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
results = self.gclient(['status'])
|
|
|
|
|
results = self.gclient(['status', '--deps', 'mac'])
|
|
|
|
|
out = results[0].splitlines(False)
|
|
|
|
|
# TODO(maruel): http://crosbug.com/3584 It should output the unversioned
|
|
|
|
|
# files.
|
|
|
|
|
self.assertEquals(0, len(out))
|
|
|
|
|
|
|
|
|
|
def testRunHooks(self):
|
|
|
|
|
if not self.enabled:
|
|
|
|
|
return
|
|
|
|
|
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
|
|
|
|
|
self.gclient(['sync', '--deps', 'mac'])
|
|
|
|
|
results = self.gclient(['runhooks'])
|
|
|
|
|
results = self.gclient(['runhooks', '--deps', 'mac'])
|
|
|
|
|
logging.debug(results[0])
|
|
|
|
|
out = results[0].splitlines(False)
|
|
|
|
|
self.assertEquals(4, len(out))
|
|
|
|
@ -541,10 +538,12 @@ class GClientSmokeGIT(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
|
|
|
|
|
def testRevInfo(self):
|
|
|
|
|
if not self.enabled:
|
|
|
|
|
return
|
|
|
|
|
# TODO(maruel): Test multiple solutions.
|
|
|
|
|
self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
|
|
|
|
|
self.gclient(['sync', '--deps', 'mac'])
|
|
|
|
|
results = self.gclient(['revinfo'])
|
|
|
|
|
results = self.gclient(['revinfo', '--deps', 'mac'])
|
|
|
|
|
out = ('src: %(base)srepo_1@%(hash1)s;\n'
|
|
|
|
|
'src/repo2: %(base)srepo_2@%(hash2)s;\n'
|
|
|
|
|
'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' %
|
|
|
|
@ -561,9 +560,11 @@ class GClientSmokeBoth(GClientSmokeBase):
|
|
|
|
|
def setUp(self):
|
|
|
|
|
GClientSmokeBase.setUp(self)
|
|
|
|
|
self.FAKE_REPOS.setUpSVN()
|
|
|
|
|
self.FAKE_REPOS.setUpGIT()
|
|
|
|
|
self.enabled = self.FAKE_REPOS.setUpGIT()
|
|
|
|
|
|
|
|
|
|
def testMultiSolutions(self):
|
|
|
|
|
if not self.enabled:
|
|
|
|
|
return
|
|
|
|
|
self.gclient(['config', '--spec',
|
|
|
|
|
'solutions=['
|
|
|
|
|
'{"name": "src",'
|
|
|
|
@ -579,24 +580,24 @@ class GClientSmokeBoth(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_git_tree(
|
|
|
|
|
('src-git', self.FAKE_REPOS.git_hashes['repo_1'][1][1]),
|
|
|
|
|
(join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo_renamed'),
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
('src/repo2', self.FAKE_REPOS.git_hashes['repo_2'][0][1]),
|
|
|
|
|
('src/repo2/repo_renamed', self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
)
|
|
|
|
|
tree.update(mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'foo'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/foo',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
))
|
|
|
|
|
tree[join('src', 'git_hooked1')] = 'git_hooked1'
|
|
|
|
|
tree[join('src', 'git_hooked2')] = 'git_hooked2'
|
|
|
|
|
tree[join('src', 'svn_hooked1')] = 'svn_hooked1'
|
|
|
|
|
tree[join('src', 'svn_hooked2')] = 'svn_hooked2'
|
|
|
|
|
tree['src/git_hooked1'] = 'git_hooked1'
|
|
|
|
|
tree['src/git_hooked2'] = 'git_hooked2'
|
|
|
|
|
tree['src/svn_hooked1'] = 'svn_hooked1'
|
|
|
|
|
tree['src/svn_hooked2'] = 'svn_hooked2'
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|
|
|
|
|
|
def testMultiSolutionsMultiRev(self):
|
|
|
|
|
if not self.enabled:
|
|
|
|
|
return
|
|
|
|
|
self.gclient(['config', '--spec',
|
|
|
|
|
'solutions=['
|
|
|
|
|
'{"name": "src",'
|
|
|
|
@ -614,19 +615,16 @@ class GClientSmokeBoth(GClientSmokeBase):
|
|
|
|
|
self.assertEquals(0, results[2])
|
|
|
|
|
tree = mangle_git_tree(
|
|
|
|
|
('src-git', self.FAKE_REPOS.git_hashes['repo_1'][0][1]),
|
|
|
|
|
(join('src', 'repo2'), self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
|
|
|
|
|
(join('src', 'repo2', 'repo3'),
|
|
|
|
|
self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
(join('src', 'repo4'), self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
|
|
|
|
|
('src/repo2', self.FAKE_REPOS.git_hashes['repo_2'][1][1]),
|
|
|
|
|
('src/repo2/repo3', self.FAKE_REPOS.git_hashes['repo_3'][1][1]),
|
|
|
|
|
('src/repo4', self.FAKE_REPOS.git_hashes['repo_4'][1][1]),
|
|
|
|
|
)
|
|
|
|
|
tree.update(mangle_svn_tree(
|
|
|
|
|
(join('trunk', 'src'), 'src', self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'), join('src', 'third_party', 'fpp'),
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'other'), join('src', 'other'),
|
|
|
|
|
('trunk/src', 'src', self.FAKE_REPOS.svn_revs[1]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/fpp',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
(join('trunk', 'third_party', 'foo'),
|
|
|
|
|
join('src', 'third_party', 'prout'),
|
|
|
|
|
('trunk/other', 'src/other', self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
('trunk/third_party/foo', 'src/third_party/prout',
|
|
|
|
|
self.FAKE_REPOS.svn_revs[2]),
|
|
|
|
|
))
|
|
|
|
|
self.assertTree(tree)
|
|
|
|
|