62
64
self.simple_commit()
63
65
output, error = self.run_bzr(['info'])
64
66
self.assertEqual(error, '')
65
self.assertTrue("Standalone tree (format: git)" in output)
69
'Standalone tree (format: git)\n'
71
' light checkout root: .\n'
72
' checkout of co-located branch: master\n')
74
def test_ignore(self):
76
output, error = self.run_bzr(['ignore', 'foo'])
77
self.assertEqual(error, '')
78
self.assertEqual(output, '')
79
self.assertFileEqual("foo\n", ".gitignore")
67
81
def test_branch(self):
68
82
os.mkdir("gitbranch")
338
353
self.assertEqual(output, 'VERSION_INFO \n')
356
class SwitchTests(ExternalBase):
358
def test_switch_branch(self):
359
# Create a git repository with a revision.
360
repo = GitRepo.init(self.test_dir)
361
builder = tests.GitBranchBuilder()
362
builder.set_branch(b'refs/heads/oldbranch')
363
builder.set_file('a', b'text for a\n', False)
364
builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>')
365
builder.set_branch(b'refs/heads/newbranch')
367
builder.set_file('a', b'text for new a\n', False)
368
builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>')
371
repo.refs.set_symbolic_ref(b'HEAD', b'refs/heads/newbranch')
375
output, error = self.run_bzr('switch oldbranch')
376
self.assertEqual(output, '')
377
self.assertTrue(error.startswith('Updated to revision 1.\n'), error)
379
self.assertFileEqual("text for a\n", 'a')
380
tree = WorkingTree.open('.')
381
with tree.lock_read():
382
basis_tree = tree.basis_tree()
383
with basis_tree.lock_read():
384
self.assertEqual([], list(tree.iter_changes(basis_tree)))
341
387
class GrepTests(ExternalBase):
343
389
def test_simple_grep(self):
347
393
output, error = self.run_bzr('grep text')
348
394
self.assertEqual(output, 'a:text for a\n')
349
395
self.assertEqual(error, '')
398
class ReconcileTests(ExternalBase):
400
def test_simple_reconcile(self):
401
tree = self.make_branch_and_tree('.', format='git')
402
self.build_tree_contents([('a', 'text for a\n')])
404
output, error = self.run_bzr('reconcile')
405
self.assertContainsRe(
407
'Reconciling branch file://.*\n'
408
'Reconciling repository file://.*\n'
409
'Reconciliation complete.\n')
410
self.assertEqual(error, '')
413
class StatusTests(ExternalBase):
415
def test_empty_dir(self):
416
tree = self.make_branch_and_tree('.', format='git')
417
self.build_tree(['a/', 'a/foo'])
418
self.build_tree_contents([('.gitignore', 'foo\n')])
419
tree.add(['.gitignore'])
420
tree.commit('add ignore')
421
output, error = self.run_bzr('st')
422
self.assertEqual(output, '')
423
self.assertEqual(error, '')
426
class StatsTests(ExternalBase):
428
def test_simple_stats(self):
429
self.requireFeature(PluginLoadedFeature('stats'))
430
tree = self.make_branch_and_tree('.', format='git')
431
self.build_tree_contents([('a', 'text for a\n')])
433
tree.commit('a commit', committer='Somebody <somebody@example.com>')
434
output, error = self.run_bzr('stats')
435
self.assertEqual(output, ' 1 Somebody <somebody@example.com>\n')
438
class GitObjectsTests(ExternalBase):
440
def run_simple(self, format):
441
tree = self.make_branch_and_tree('.', format=format)
442
self.build_tree(['a/', 'a/foo'])
445
output, error = self.run_bzr('git-objects')
446
shas = list(output.splitlines())
447
self.assertEqual([40, 40], [len(s) for s in shas])
448
self.assertEqual(error, '')
450
output, error = self.run_bzr('git-object %s' % shas[0])
451
self.assertEqual('', error)
453
def test_in_native(self):
454
self.run_simple(format='git')
456
def test_in_bzr(self):
457
self.run_simple(format='2a')
460
class GitApplyTests(ExternalBase):
462
def test_apply(self):
463
b = self.make_branch_and_tree('.')
465
with open('foo.patch', 'w') as f:
467
From bdefb25fab801e6af0a70e965f60cb48f2b759fa Mon Sep 17 00:00:00 2001
468
From: Dmitry Bogatov <KAction@debian.org>
469
Date: Fri, 8 Feb 2019 23:28:30 +0000
470
Subject: [PATCH] Add fixed for out-of-date-standards-version
474
1 files changed, 14 insertions(+)
475
create mode 100644 message
477
diff --git a/message b/message
479
index 0000000..05ec0b1
483
+Update standards version, no changes needed.
485
+Fixed-Lintian-Tags: out-of-date-standards-version
487
output, error = self.run_bzr('git-apply foo.patch')
488
self.assertContainsRe(
490
'Committing to: .*\n'
491
'Committed revision 1.\n')