275
275
self.assertMultiLineEqual(out, b'')
276
276
self.assertTrue(err.endswith, b'3 objects\n')
279
class ShallowTests(ExternalBase):
282
super(ShallowTests, self).setUp()
283
# Smoke test for "bzr log" in a git repository with shallow depth.
284
self.repo = GitRepo.init('gitr', mkdir=True)
285
self.build_tree_contents([("gitr/foo", "hello from git")])
286
self.repo.stage("foo")
288
"message", committer="Somebody <user@example.com>",
289
commit_timestamp=1526330165, commit_timezone=0,
290
author_timestamp=1526330165, author_timezone=0,
291
merge_heads=[b'aa' * 20])
278
293
def test_log_shallow(self):
279
# Smoke test for "bzr log" in a git repository with shallow depth.
280
r = GitRepo.init('gitr', mkdir=True)
281
self.build_tree_contents([("gitr/foo", "hello from git")])
283
cid = r.do_commit("message", committer="Somebody <user@example.com>",
284
commit_timestamp=1526330165, commit_timezone=0,
285
author_timestamp=1526330165, author_timezone=0,
286
merge_heads=[b'aa' * 20])
288
294
# Check that bzr log does not fail and includes the revision.
289
295
output, error = self.run_bzr(['log', 'gitr'], retcode=3)
290
296
self.assertEqual(error, 'brz: ERROR: Further revision history missing.\n')
291
297
self.assertEqual(output,
292
298
'------------------------------------------------------------\n'
293
'revision-id: git-v1:' + cid + '\n'
294
'git commit: ' + cid + '\n'
299
'revision-id: git-v1:' + self.repo.head() + '\n'
300
'git commit: ' + self.repo.head() + '\n'
295
301
'committer: Somebody <user@example.com>\n'
296
302
'timestamp: Mon 2018-05-14 20:36:05 +0000\n'
306
def test_version_info_rio(self):
307
output, error = self.run_bzr(['version-info', '--rio', 'gitr'])
308
self.assertEqual(error, '')
309
self.assertNotIn('revno:', output)
311
def test_version_info_python(self):
312
output, error = self.run_bzr(['version-info', '--python', 'gitr'])
313
self.assertEqual(error, '')
314
self.assertNotIn('revno:', output)
316
def test_version_info_custom_with_revno(self):
317
output, error = self.run_bzr(
318
['version-info', '--custom',
319
'--template=VERSION_INFO r{revno})\n', 'gitr'], retcode=3)
320
self.assertEqual(error, 'brz: ERROR: Variable {revno} is not available.\n')
321
self.assertEqual(output, 'VERSION_INFO r')
323
def test_version_info_custom_without_revno(self):
324
output, error = self.run_bzr(
325
['version-info', '--custom', '--template=VERSION_INFO \n',
327
self.assertEqual(error, '')
328
self.assertEqual(output, 'VERSION_INFO \n')