1
# Copyright (C) 2007 David Allouche <ddaa@ddaa.net>
2
# Copyright (C) 2007-2018 Jelmer Vernooij <jelmer@jelmer.uk>
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
"""Black-box tests for bzr-git."""
20
from __future__ import absolute_import
22
from dulwich.repo import (
28
from ...controldir import (
32
from ...tests.blackbox import ExternalBase
33
from ...workingtree import WorkingTree
38
from ...tests.script import TestCaseWithTransportAndScript
39
from ...tests.features import PluginLoadedFeature
42
class TestGitBlackBox(ExternalBase):
44
def simple_commit(self):
45
# Create a git repository with a revision.
46
repo = GitRepo.init(self.test_dir)
47
builder = tests.GitBranchBuilder()
48
builder.set_file('a', b'text for a\n', False)
49
r1 = builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>')
50
return repo, builder.finish()[r1]
53
r = GitRepo.init(self.test_dir)
54
dir = ControlDir.open(self.test_dir)
56
self.build_tree(['a', 'b'])
57
output, error = self.run_bzr(['add', 'a'])
58
self.assertEqual('adding a\n', output)
59
self.assertEqual('', error)
60
output, error = self.run_bzr(
61
['add', '--file-ids-from=../othertree', 'b'])
62
self.assertEqual('adding b\n', output)
64
'Ignoring --file-ids-from, since the tree does not support '
65
'setting file ids.\n', error)
68
r = GitRepo.init(self.test_dir)
69
dir = ControlDir.open(self.test_dir)
71
output, error = self.run_bzr(['nick'])
72
self.assertEqual("master\n", output)
74
def test_branches(self):
76
output, error = self.run_bzr(['branches'])
77
self.assertEqual("* master\n", output)
81
output, error = self.run_bzr(['info'])
82
self.assertEqual(error, '')
85
'Standalone tree (format: git)\n'
87
' light checkout root: .\n'
88
' checkout of co-located branch: master\n')
90
def test_ignore(self):
92
output, error = self.run_bzr(['ignore', 'foo'])
93
self.assertEqual(error, '')
94
self.assertEqual(output, '')
95
self.assertFileEqual("foo\n", ".gitignore")
97
def test_cat_revision(self):
99
output, error = self.run_bzr(['cat-revision', '-r-1'], retcode=3)
100
self.assertContainsRe(
102
'brz: ERROR: Repository .* does not support access to raw '
104
self.assertEqual(output, '')
106
def test_branch(self):
107
os.mkdir("gitbranch")
108
GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
109
os.chdir('gitbranch')
110
builder = tests.GitBranchBuilder()
111
builder.set_file(b'a', b'text for a\n', False)
112
builder.commit(b'Joe Foo <joe@foo.com>', b'<The commit message>')
116
output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
118
(error == 'Branched 1 revision(s).\n') or
119
(error == 'Branched 1 revision.\n'),
122
def test_checkout(self):
123
os.mkdir("gitbranch")
124
GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
125
os.chdir('gitbranch')
126
builder = tests.GitBranchBuilder()
127
builder.set_file(b'a', b'text for a\n', False)
128
builder.commit(b'Joe Foo <joe@foo.com>', b'<The commit message>')
132
output, error = self.run_bzr(['checkout', 'gitbranch', 'bzrbranch'])
133
self.assertEqual(error,
134
'Fetching from Git to Bazaar repository. '
135
'For better performance, fetch into a Git repository.\n')
136
self.assertEqual(output, '')
138
def test_branch_ls(self):
140
output, error = self.run_bzr(['ls', '-r-1'])
141
self.assertEqual(error, '')
142
self.assertEqual(output, "a\n")
145
self.run_bzr("init --format=git repo")
147
def test_info_verbose(self):
150
output, error = self.run_bzr(['info', '-v'])
151
self.assertEqual(error, '')
152
self.assertTrue("Standalone tree (format: git)" in output)
153
self.assertTrue("control: Local Git Repository" in output)
154
self.assertTrue("branch: Local Git Branch" in output)
155
self.assertTrue("repository: Git Repository" in output)
157
def test_push_roundtripping(self):
158
self.knownFailure("roundtripping is not yet supported")
159
self.with_roundtripping()
161
GitRepo.init(os.path.join(self.test_dir, "bla"))
162
self.run_bzr(['init', 'foo'])
163
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
164
# when roundtripping is supported
165
output, error = self.run_bzr(['push', '-d', 'foo', 'bla'])
166
self.assertEqual(b"", output)
167
self.assertTrue(error.endswith(b"Created new branch.\n"))
169
def test_push_without_calculate_revnos(self):
170
self.run_bzr(['init', '--git', 'bla'])
171
self.run_bzr(['init', '--git', 'foo'])
172
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
173
output, error = self.run_bzr(
174
['push', '-Ocalculate_revnos=no', '-d', 'foo', 'bla'])
175
self.assertEqual("", output)
176
self.assertContainsRe(
178
'Pushed up to revision id git(.*).\n')
180
def test_merge(self):
181
self.run_bzr(['init', '--git', 'orig'])
182
self.build_tree_contents([('orig/a', 'orig contents\n')])
183
self.run_bzr(['add', 'orig/a'])
184
self.run_bzr(['commit', '-m', 'add orig', 'orig'])
185
self.run_bzr(['clone', 'orig', 'other'])
186
self.build_tree_contents([('other/a', 'new contents\n')])
187
self.run_bzr(['commit', '-m', 'modify', 'other'])
188
self.build_tree_contents([('orig/b', 'more\n')])
189
self.run_bzr(['add', 'orig/b'])
190
self.build_tree_contents([('orig/a', 'new contents\n')])
191
self.run_bzr(['commit', '-m', 'more', 'orig'])
192
self.run_bzr(['merge', '-d', 'orig', 'other'])
194
def test_push_lossy_non_mainline(self):
195
self.run_bzr(['init', '--git', 'bla'])
196
self.run_bzr(['init', 'foo'])
197
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
198
self.run_bzr(['branch', 'foo', 'foo1'])
199
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo1'])
200
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
201
self.run_bzr(['merge', '-d', 'foo', 'foo1'])
202
self.run_bzr(['commit', '--unchanged', '-m', 'merge', 'foo'])
203
output, error = self.run_bzr(['push', '--lossy', '-r1.1.1', '-d', 'foo', 'bla'])
204
self.assertEqual("", output)
206
'Pushing from a Bazaar to a Git repository. For better '
207
'performance, push into a Bazaar repository.\n'
208
'All changes applied successfully.\n'
209
'Pushed up to revision 2.\n', error)
211
def test_push_lossy_non_mainline_incremental(self):
212
self.run_bzr(['init', '--git', 'bla'])
213
self.run_bzr(['init', 'foo'])
214
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
215
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
216
output, error = self.run_bzr(['push', '--lossy', '-d', 'foo', 'bla'])
217
self.assertEqual("", output)
219
'Pushing from a Bazaar to a Git repository. For better '
220
'performance, push into a Bazaar repository.\n'
221
'All changes applied successfully.\n'
222
'Pushed up to revision 2.\n', error)
223
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
224
output, error = self.run_bzr(['push', '--lossy', '-d', 'foo', 'bla'])
225
self.assertEqual("", output)
227
'Pushing from a Bazaar to a Git repository. For better '
228
'performance, push into a Bazaar repository.\n'
229
'All changes applied successfully.\n'
230
'Pushed up to revision 3.\n', error)
233
# Smoke test for "bzr log" in a git repository.
236
# Check that bzr log does not fail and includes the revision.
237
output, error = self.run_bzr(['log'])
238
self.assertEqual(error, '')
240
'<The commit message>' in output,
241
"Commit message was not found in output:\n%s" % (output,))
243
def test_log_verbose(self):
244
# Smoke test for "bzr log -v" in a git repository.
247
# Check that bzr log does not fail and includes the revision.
248
output, error = self.run_bzr(['log', '-v'])
249
self.assertContainsRe(output, 'revno: 1')
251
def test_log_without_revno(self):
252
# Smoke test for "bzr log -v" in a git repository.
255
# Check that bzr log does not fail and includes the revision.
256
output, error = self.run_bzr(['log', '-Ocalculate_revnos=no'])
257
self.assertNotContainsRe(output, 'revno: 1')
259
def test_commit_without_revno(self):
260
repo = GitRepo.init(self.test_dir)
261
output, error = self.run_bzr(
262
['commit', '-Ocalculate_revnos=yes', '--unchanged', '-m', 'one'])
263
self.assertContainsRe(error, 'Committed revision 1.')
264
output, error = self.run_bzr(
265
['commit', '-Ocalculate_revnos=no', '--unchanged', '-m', 'two'])
266
self.assertNotContainsRe(error, 'Committed revision 2.')
267
self.assertContainsRe(error, 'Committed revid .*.')
269
def test_log_file(self):
270
# Smoke test for "bzr log" in a git repository.
271
repo = GitRepo.init(self.test_dir)
272
builder = tests.GitBranchBuilder()
273
builder.set_file('a', b'text for a\n', False)
274
r1 = builder.commit(b'Joe Foo <joe@foo.com>', u'First')
275
builder.set_file('a', b'text 3a for a\n', False)
276
r2a = builder.commit(b'Joe Foo <joe@foo.com>', u'Second a', base=r1)
277
builder.set_file('a', b'text 3b for a\n', False)
278
r2b = builder.commit(b'Joe Foo <joe@foo.com>', u'Second b', base=r1)
279
builder.set_file('a', b'text 4 for a\n', False)
280
builder.commit(b'Joe Foo <joe@foo.com>', u'Third', merge=[r2a], base=r2b)
283
# Check that bzr log does not fail and includes the revision.
284
output, error = self.run_bzr(['log', '-n2', 'a'])
285
self.assertEqual(error, '')
286
self.assertIn('Second a', output)
287
self.assertIn('Second b', output)
288
self.assertIn('First', output)
289
self.assertIn('Third', output)
292
git_repo, commit_sha1 = self.simple_commit()
293
git_repo.refs[b"refs/tags/foo"] = commit_sha1
295
output, error = self.run_bzr(['tags'])
296
self.assertEqual(error, '')
297
self.assertEqual(output, "foo 1\n")
302
output, error = self.run_bzr(["tag", "bar"])
304
# bzr <= 2.2 emits this message in the output stream
305
# bzr => 2.3 emits this message in the error stream
306
self.assertEqual(error + output, 'Created tag bar.\n')
308
def test_init_repo(self):
309
output, error = self.run_bzr(["init", "--format=git", "bla.git"])
310
self.assertEqual(error, '')
311
self.assertEqual(output, 'Created a standalone tree (format: git)\n')
313
def test_diff_format(self):
314
tree = self.make_branch_and_tree('.')
315
self.build_tree(['a'])
317
output, error = self.run_bzr(['diff', '--format=git'], retcode=1)
318
self.assertEqual(error, '')
319
# Some older versions of Dulwich (< 0.19.12) formatted diffs slightly
321
from dulwich import __version__ as dulwich_version
322
if dulwich_version < (0, 19, 12):
323
self.assertEqual(output,
324
'diff --git /dev/null b/a\n'
327
'index 0000000..c197bd8 100644\n'
333
self.assertEqual(output,
334
'diff --git a/a b/a\n'
336
'new file mode 100644\n'
337
'index 0000000..c197bd8 100644\n'
343
def test_git_import_uncolocated(self):
344
r = GitRepo.init("a", mkdir=True)
345
self.build_tree(["a/file"])
347
r.do_commit(ref=b"refs/heads/abranch",
348
committer=b"Joe <joe@example.com>", message=b"Dummy")
349
r.do_commit(ref=b"refs/heads/bbranch",
350
committer=b"Joe <joe@example.com>", message=b"Dummy")
351
self.run_bzr(["git-import", "a", "b"])
353
set([".bzr", "abranch", "bbranch"]), set(os.listdir("b")))
355
def test_git_import(self):
356
r = GitRepo.init("a", mkdir=True)
357
self.build_tree(["a/file"])
359
r.do_commit(ref=b"refs/heads/abranch",
360
committer=b"Joe <joe@example.com>", message=b"Dummy")
361
r.do_commit(ref=b"refs/heads/bbranch",
362
committer=b"Joe <joe@example.com>", message=b"Dummy")
363
self.run_bzr(["git-import", "--colocated", "a", "b"])
364
self.assertEqual(set([".bzr"]), set(os.listdir("b")))
365
self.assertEqual(set(["abranch", "bbranch"]),
366
set(ControlDir.open("b").branch_names()))
368
def test_git_import_incremental(self):
369
r = GitRepo.init("a", mkdir=True)
370
self.build_tree(["a/file"])
372
r.do_commit(ref=b"refs/heads/abranch",
373
committer=b"Joe <joe@example.com>", message=b"Dummy")
374
self.run_bzr(["git-import", "--colocated", "a", "b"])
375
self.run_bzr(["git-import", "--colocated", "a", "b"])
376
self.assertEqual(set([".bzr"]), set(os.listdir("b")))
377
b = ControlDir.open("b")
378
self.assertEqual(["abranch"], b.branch_names())
380
def test_git_import_tags(self):
381
r = GitRepo.init("a", mkdir=True)
382
self.build_tree(["a/file"])
384
cid = r.do_commit(ref=b"refs/heads/abranch",
385
committer=b"Joe <joe@example.com>", message=b"Dummy")
386
r[b"refs/tags/atag"] = cid
387
self.run_bzr(["git-import", "--colocated", "a", "b"])
388
self.assertEqual(set([".bzr"]), set(os.listdir("b")))
389
b = ControlDir.open("b")
390
self.assertEqual(["abranch"], b.branch_names())
391
self.assertEqual(["atag"],
392
list(b.open_branch("abranch").tags.get_tag_dict().keys()))
394
def test_git_import_colo(self):
395
r = GitRepo.init("a", mkdir=True)
396
self.build_tree(["a/file"])
398
r.do_commit(ref=b"refs/heads/abranch",
399
committer=b"Joe <joe@example.com>", message=b"Dummy")
400
r.do_commit(ref=b"refs/heads/bbranch",
401
committer=b"Joe <joe@example.com>", message=b"Dummy")
402
self.make_controldir("b", format="development-colo")
403
self.run_bzr(["git-import", "--colocated", "a", "b"])
405
set([b.name for b in ControlDir.open("b").list_branches()]),
406
set(["abranch", "bbranch"]))
408
def test_git_refs_from_git(self):
409
r = GitRepo.init("a", mkdir=True)
410
self.build_tree(["a/file"])
412
cid = r.do_commit(ref=b"refs/heads/abranch",
413
committer=b"Joe <joe@example.com>", message=b"Dummy")
414
r[b"refs/tags/atag"] = cid
415
(stdout, stderr) = self.run_bzr(["git-refs", "a"])
416
self.assertEqual(stderr, "")
417
self.assertEqual(stdout,
418
'refs/heads/abranch -> ' + cid.decode('ascii') + '\n'
419
'refs/tags/atag -> ' + cid.decode('ascii') + '\n')
421
def test_git_refs_from_bzr(self):
422
tree = self.make_branch_and_tree('a')
423
self.build_tree(["a/file"])
426
committer=b"Joe <joe@example.com>", message=b"Dummy")
427
tree.branch.tags.set_tag("atag", revid)
428
(stdout, stderr) = self.run_bzr(["git-refs", "a"])
429
self.assertEqual(stderr, "")
430
self.assertTrue("refs/tags/atag -> " in stdout)
431
self.assertTrue("HEAD -> " in stdout)
433
def test_check(self):
434
r = GitRepo.init("gitr", mkdir=True)
435
self.build_tree_contents([("gitr/foo", b"hello from git")])
437
r.do_commit(b"message", committer=b"Somebody <user@example.com>")
438
out, err = self.run_bzr(["check", "gitr"])
440
self.assertEqual(out, '')
441
self.assertTrue(err.endswith, '3 objects\n')
443
def test_local_whoami(self):
444
r = GitRepo.init("gitr", mkdir=True)
445
self.build_tree_contents([('gitr/.git/config', """\
447
email = some@example.com
450
out, err = self.run_bzr(["whoami", "-d", "gitr"])
451
self.assertEqual(out, "Test User <some@example.com>\n")
452
self.assertEqual(err, "")
454
self.build_tree_contents([('gitr/.git/config', """\
456
email = some@example.com
458
out, err = self.run_bzr(["whoami", "-d", "gitr"])
459
self.assertEqual(out, "some@example.com\n")
460
self.assertEqual(err, "")
462
def test_local_signing_key(self):
463
r = GitRepo.init("gitr", mkdir=True)
464
self.build_tree_contents([('gitr/.git/config', """\
466
email = some@example.com
468
signingkey = D729A457
470
out, err = self.run_bzr(["config", "-d", "gitr", "gpg_signing_key"])
471
self.assertEqual(out, "D729A457\n")
472
self.assertEqual(err, "")
475
class ShallowTests(ExternalBase):
478
super(ShallowTests, self).setUp()
479
# Smoke test for "bzr log" in a git repository with shallow depth.
480
self.repo = GitRepo.init('gitr', mkdir=True)
481
self.build_tree_contents([("gitr/foo", b"hello from git")])
482
self.repo.stage("foo")
484
b"message", committer=b"Somebody <user@example.com>",
485
author=b"Somebody <user@example.com>",
486
commit_timestamp=1526330165, commit_timezone=0,
487
author_timestamp=1526330165, author_timezone=0,
488
merge_heads=[b'aa' * 20])
490
def test_log_shallow(self):
491
# Check that bzr log does not fail and includes the revision.
492
output, error = self.run_bzr(['log', 'gitr'], retcode=3)
494
error, 'brz: ERROR: Further revision history missing.\n')
495
self.assertEqual(output,
496
'------------------------------------------------------------\n'
497
'revision-id: git-v1:' + self.repo.head().decode('ascii') + '\n'
498
'git commit: ' + self.repo.head().decode('ascii') + '\n'
499
'committer: Somebody <user@example.com>\n'
500
'timestamp: Mon 2018-05-14 20:36:05 +0000\n'
504
def test_version_info_rio(self):
505
output, error = self.run_bzr(['version-info', '--rio', 'gitr'])
506
self.assertEqual(error, '')
507
self.assertNotIn('revno:', output)
509
def test_version_info_python(self):
510
output, error = self.run_bzr(['version-info', '--python', 'gitr'])
511
self.assertEqual(error, '')
512
self.assertNotIn('revno:', output)
514
def test_version_info_custom_with_revno(self):
515
output, error = self.run_bzr(
516
['version-info', '--custom',
517
'--template=VERSION_INFO r{revno})\n', 'gitr'], retcode=3)
519
error, 'brz: ERROR: Variable {revno} is not available.\n')
520
self.assertEqual(output, 'VERSION_INFO r')
522
def test_version_info_custom_without_revno(self):
523
output, error = self.run_bzr(
524
['version-info', '--custom', '--template=VERSION_INFO \n',
526
self.assertEqual(error, '')
527
self.assertEqual(output, 'VERSION_INFO \n')
530
class SwitchTests(ExternalBase):
532
def test_switch_branch(self):
533
# Create a git repository with a revision.
534
repo = GitRepo.init(self.test_dir)
535
builder = tests.GitBranchBuilder()
536
builder.set_branch(b'refs/heads/oldbranch')
537
builder.set_file('a', b'text for a\n', False)
538
builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>')
539
builder.set_branch(b'refs/heads/newbranch')
541
builder.set_file('a', b'text for new a\n', False)
542
builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>')
545
repo.refs.set_symbolic_ref(b'HEAD', b'refs/heads/newbranch')
549
output, error = self.run_bzr('switch oldbranch')
550
self.assertEqual(output, '')
551
self.assertTrue(error.startswith('Updated to revision 1.\n'), error)
553
self.assertFileEqual("text for a\n", 'a')
554
tree = WorkingTree.open('.')
555
with tree.lock_read():
556
basis_tree = tree.basis_tree()
557
with basis_tree.lock_read():
558
self.assertEqual([], list(tree.iter_changes(basis_tree)))
560
def test_branch_with_nested_trees(self):
561
orig = self.make_branch_and_tree('source', format='git')
562
subtree = self.make_branch_and_tree('source/subtree', format='git')
563
self.build_tree(['source/subtree/a'])
564
self.build_tree_contents([('source/.gitmodules', """\
565
[submodule "subtree"]
568
""" % subtree.user_url)])
570
subtree.commit('add subtree contents')
571
orig.add_reference(subtree)
572
orig.add(['.gitmodules'])
573
orig.commit('add subtree')
575
self.run_bzr('branch source target')
577
target = WorkingTree.open('target')
578
target_subtree = WorkingTree.open('target/subtree')
579
self.assertTreesEqual(orig, target)
580
self.assertTreesEqual(subtree, target_subtree)
583
class SwitchScriptTests(TestCaseWithTransportAndScript):
585
def test_switch_preserves(self):
586
# See https://bugs.launchpad.net/brz/+bug/1820606
589
Created a standalone tree (format: git)
591
$ echo original > file.txt
594
$ brz ci -q -m "Initial"
595
$ echo "entered on master branch" > file.txt
599
$ brz switch -b other
600
2>Tree is up to date at revision 1.
601
2>Switched to branch other
603
entered on master branch
607
class GrepTests(ExternalBase):
609
def test_simple_grep(self):
610
tree = self.make_branch_and_tree('.', format='git')
611
self.build_tree_contents([('a', 'text for a\n')])
613
output, error = self.run_bzr('grep text')
614
self.assertEqual(output, 'a:text for a\n')
615
self.assertEqual(error, '')
618
class ReconcileTests(ExternalBase):
620
def test_simple_reconcile(self):
621
tree = self.make_branch_and_tree('.', format='git')
622
self.build_tree_contents([('a', 'text for a\n')])
624
output, error = self.run_bzr('reconcile')
625
self.assertContainsRe(
627
'Reconciling branch file://.*\n'
628
'Reconciling repository file://.*\n'
629
'Reconciliation complete.\n')
630
self.assertEqual(error, '')
633
class StatusTests(ExternalBase):
635
def test_empty_dir(self):
636
tree = self.make_branch_and_tree('.', format='git')
637
self.build_tree(['a/', 'a/foo'])
638
self.build_tree_contents([('.gitignore', 'foo\n')])
639
tree.add(['.gitignore'])
640
tree.commit('add ignore')
641
output, error = self.run_bzr('st')
642
self.assertEqual(output, '')
643
self.assertEqual(error, '')
646
class StatsTests(ExternalBase):
648
def test_simple_stats(self):
649
self.requireFeature(PluginLoadedFeature('stats'))
650
tree = self.make_branch_and_tree('.', format='git')
651
self.build_tree_contents([('a', 'text for a\n')])
653
tree.commit('a commit', committer='Somebody <somebody@example.com>')
654
output, error = self.run_bzr('stats')
655
self.assertEqual(output, ' 1 Somebody <somebody@example.com>\n')
658
class GitObjectsTests(ExternalBase):
660
def run_simple(self, format):
661
tree = self.make_branch_and_tree('.', format=format)
662
self.build_tree(['a/', 'a/foo'])
665
output, error = self.run_bzr('git-objects')
666
shas = list(output.splitlines())
667
self.assertEqual([40, 40], [len(s) for s in shas])
668
self.assertEqual(error, '')
670
output, error = self.run_bzr('git-object %s' % shas[0])
671
self.assertEqual('', error)
673
def test_in_native(self):
674
self.run_simple(format='git')
676
def test_in_bzr(self):
677
self.run_simple(format='2a')
680
class GitApplyTests(ExternalBase):
682
def test_apply(self):
683
b = self.make_branch_and_tree('.')
685
with open('foo.patch', 'w') as f:
687
From bdefb25fab801e6af0a70e965f60cb48f2b759fa Mon Sep 17 00:00:00 2001
688
From: Dmitry Bogatov <KAction@debian.org>
689
Date: Fri, 8 Feb 2019 23:28:30 +0000
690
Subject: [PATCH] Add fixed for out-of-date-standards-version
694
1 files changed, 14 insertions(+)
695
create mode 100644 message
697
diff --git a/message b/message
699
index 0000000..05ec0b1
703
+Update standards version, no changes needed.
705
+Fixed-Lintian-Tags: out-of-date-standards-version
707
output, error = self.run_bzr('git-apply foo.patch')
708
self.assertContainsRe(
710
'Committing to: .*\n'
711
'Committed revision 1.\n')