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 dulwich.repo import (
26
from ...controldir import (
30
from ...tests.blackbox import ExternalBase
31
from ...workingtree import WorkingTree
36
from ...tests.script import TestCaseWithTransportAndScript
37
from ...tests.features import PluginLoadedFeature
40
class TestGitBlackBox(ExternalBase):
42
def simple_commit(self):
43
# Create a git repository with a revision.
44
repo = GitRepo.init(self.test_dir)
45
builder = tests.GitBranchBuilder()
46
builder.set_file('a', b'text for a\n', False)
47
r1 = builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>')
48
return repo, builder.finish()[r1]
51
r = GitRepo.init(self.test_dir)
52
dir = ControlDir.open(self.test_dir)
54
self.build_tree(['a', 'b'])
55
output, error = self.run_bzr(['add', 'a'])
56
self.assertEqual('adding a\n', output)
57
self.assertEqual('', error)
58
output, error = self.run_bzr(
59
['add', '--file-ids-from=../othertree', 'b'])
60
self.assertEqual('adding b\n', output)
62
'Ignoring --file-ids-from, since the tree does not support '
63
'setting file ids.\n', error)
66
r = GitRepo.init(self.test_dir)
67
dir = ControlDir.open(self.test_dir)
69
output, error = self.run_bzr(['nick'])
70
self.assertEqual("master\n", output)
72
def test_branches(self):
74
output, error = self.run_bzr(['branches'])
75
self.assertEqual("* master\n", output)
79
output, error = self.run_bzr(['info'])
80
self.assertEqual(error, '')
83
'Standalone tree (format: git)\n'
85
' light checkout root: .\n'
86
' checkout of co-located branch: master\n')
88
def test_ignore(self):
90
output, error = self.run_bzr(['ignore', 'foo'])
91
self.assertEqual(error, '')
92
self.assertEqual(output, '')
93
self.assertFileEqual("foo\n", ".gitignore")
95
def test_cat_revision(self):
97
output, error = self.run_bzr(['cat-revision', '-r-1'], retcode=3)
98
self.assertContainsRe(
100
'brz: ERROR: Repository .* does not support access to raw '
102
self.assertEqual(output, '')
104
def test_branch(self):
105
os.mkdir("gitbranch")
106
GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
107
os.chdir('gitbranch')
108
builder = tests.GitBranchBuilder()
109
builder.set_file(b'a', b'text for a\n', False)
110
builder.commit(b'Joe Foo <joe@foo.com>', b'<The commit message>')
114
output, error = self.run_bzr(['branch', 'gitbranch', 'bzrbranch'])
116
(error == 'Branched 1 revision(s).\n') or
117
(error == 'Branched 1 revision.\n'),
120
def test_checkout(self):
121
os.mkdir("gitbranch")
122
GitRepo.init(os.path.join(self.test_dir, "gitbranch"))
123
os.chdir('gitbranch')
124
builder = tests.GitBranchBuilder()
125
builder.set_file(b'a', b'text for a\n', False)
126
builder.commit(b'Joe Foo <joe@foo.com>', b'<The commit message>')
130
output, error = self.run_bzr(['checkout', 'gitbranch', 'bzrbranch'])
131
self.assertEqual(error,
132
'Fetching from Git to Bazaar repository. '
133
'For better performance, fetch into a Git repository.\n')
134
self.assertEqual(output, '')
136
def test_branch_ls(self):
138
output, error = self.run_bzr(['ls', '-r-1'])
139
self.assertEqual(error, '')
140
self.assertEqual(output, "a\n")
143
self.run_bzr("init --format=git repo")
145
def test_info_verbose(self):
148
output, error = self.run_bzr(['info', '-v'])
149
self.assertEqual(error, '')
150
self.assertTrue("Standalone tree (format: git)" in output)
151
self.assertTrue("control: Local Git Repository" in output)
152
self.assertTrue("branch: Local Git Branch" in output)
153
self.assertTrue("repository: Git Repository" in output)
155
def test_push_roundtripping(self):
156
self.knownFailure("roundtripping is not yet supported")
157
self.with_roundtripping()
159
GitRepo.init(os.path.join(self.test_dir, "bla"))
160
self.run_bzr(['init', 'foo'])
161
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
162
# when roundtripping is supported
163
output, error = self.run_bzr(['push', '-d', 'foo', 'bla'])
164
self.assertEqual(b"", output)
165
self.assertTrue(error.endswith(b"Created new branch.\n"))
167
def test_push_without_calculate_revnos(self):
168
self.run_bzr(['init', '--git', 'bla'])
169
self.run_bzr(['init', '--git', 'foo'])
170
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
171
output, error = self.run_bzr(
172
['push', '-Ocalculate_revnos=no', '-d', 'foo', 'bla'])
173
self.assertEqual("", output)
174
self.assertContainsRe(
176
'Pushed up to revision id git(.*).\n')
178
def test_merge(self):
179
self.run_bzr(['init', '--git', 'orig'])
180
self.build_tree_contents([('orig/a', 'orig contents\n')])
181
self.run_bzr(['add', 'orig/a'])
182
self.run_bzr(['commit', '-m', 'add orig', 'orig'])
183
self.run_bzr(['clone', 'orig', 'other'])
184
self.build_tree_contents([('other/a', 'new contents\n')])
185
self.run_bzr(['commit', '-m', 'modify', 'other'])
186
self.build_tree_contents([('orig/b', 'more\n')])
187
self.run_bzr(['add', 'orig/b'])
188
self.build_tree_contents([('orig/a', 'new contents\n')])
189
self.run_bzr(['commit', '-m', 'more', 'orig'])
190
self.run_bzr(['merge', '-d', 'orig', 'other'])
192
def test_push_lossy_non_mainline(self):
193
self.run_bzr(['init', '--git', 'bla'])
194
self.run_bzr(['init', 'foo'])
195
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
196
self.run_bzr(['branch', 'foo', 'foo1'])
197
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo1'])
198
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
199
self.run_bzr(['merge', '-d', 'foo', 'foo1'])
200
self.run_bzr(['commit', '--unchanged', '-m', 'merge', 'foo'])
201
output, error = self.run_bzr(['push', '--lossy', '-r1.1.1', '-d', 'foo', 'bla'])
202
self.assertEqual("", output)
204
'Pushing from a Bazaar to a Git repository. For better '
205
'performance, push into a Bazaar repository.\n'
206
'All changes applied successfully.\n'
207
'Pushed up to revision 2.\n', error)
209
def test_push_lossy_non_mainline_incremental(self):
210
self.run_bzr(['init', '--git', 'bla'])
211
self.run_bzr(['init', 'foo'])
212
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
213
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
214
output, error = self.run_bzr(['push', '--lossy', '-d', 'foo', 'bla'])
215
self.assertEqual("", output)
217
'Pushing from a Bazaar to a Git repository. For better '
218
'performance, push into a Bazaar repository.\n'
219
'All changes applied successfully.\n'
220
'Pushed up to revision 2.\n', error)
221
self.run_bzr(['commit', '--unchanged', '-m', 'bla', 'foo'])
222
output, error = self.run_bzr(['push', '--lossy', '-d', 'foo', 'bla'])
223
self.assertEqual("", output)
225
'Pushing from a Bazaar to a Git repository. For better '
226
'performance, push into a Bazaar repository.\n'
227
'All changes applied successfully.\n'
228
'Pushed up to revision 3.\n', error)
231
# Smoke test for "bzr log" in a git repository.
234
# Check that bzr log does not fail and includes the revision.
235
output, error = self.run_bzr(['log'])
236
self.assertEqual(error, '')
238
'<The commit message>' in output,
239
"Commit message was not found in output:\n%s" % (output,))
241
def test_log_verbose(self):
242
# Smoke test for "bzr log -v" in a git repository.
245
# Check that bzr log does not fail and includes the revision.
246
output, error = self.run_bzr(['log', '-v'])
247
self.assertContainsRe(output, 'revno: 1')
249
def test_log_without_revno(self):
250
# Smoke test for "bzr log -v" in a git repository.
253
# Check that bzr log does not fail and includes the revision.
254
output, error = self.run_bzr(['log', '-Ocalculate_revnos=no'])
255
self.assertNotContainsRe(output, 'revno: 1')
257
def test_commit_without_revno(self):
258
repo = GitRepo.init(self.test_dir)
259
output, error = self.run_bzr(
260
['commit', '-Ocalculate_revnos=yes', '--unchanged', '-m', 'one'])
261
self.assertContainsRe(error, 'Committed revision 1.')
262
output, error = self.run_bzr(
263
['commit', '-Ocalculate_revnos=no', '--unchanged', '-m', 'two'])
264
self.assertNotContainsRe(error, 'Committed revision 2.')
265
self.assertContainsRe(error, 'Committed revid .*.')
267
def test_log_file(self):
268
# Smoke test for "bzr log" in a git repository.
269
repo = GitRepo.init(self.test_dir)
270
builder = tests.GitBranchBuilder()
271
builder.set_file('a', b'text for a\n', False)
272
r1 = builder.commit(b'Joe Foo <joe@foo.com>', u'First')
273
builder.set_file('a', b'text 3a for a\n', False)
274
r2a = builder.commit(b'Joe Foo <joe@foo.com>', u'Second a', base=r1)
275
builder.set_file('a', b'text 3b for a\n', False)
276
r2b = builder.commit(b'Joe Foo <joe@foo.com>', u'Second b', base=r1)
277
builder.set_file('a', b'text 4 for a\n', False)
278
builder.commit(b'Joe Foo <joe@foo.com>', u'Third', merge=[r2a], base=r2b)
281
# Check that bzr log does not fail and includes the revision.
282
output, error = self.run_bzr(['log', '-n2', 'a'])
283
self.assertEqual(error, '')
284
self.assertIn('Second a', output)
285
self.assertIn('Second b', output)
286
self.assertIn('First', output)
287
self.assertIn('Third', output)
290
git_repo, commit_sha1 = self.simple_commit()
291
git_repo.refs[b"refs/tags/foo"] = commit_sha1
293
output, error = self.run_bzr(['tags'])
294
self.assertEqual(error, '')
295
self.assertEqual(output, "foo 1\n")
300
output, error = self.run_bzr(["tag", "bar"])
302
# bzr <= 2.2 emits this message in the output stream
303
# bzr => 2.3 emits this message in the error stream
304
self.assertEqual(error + output, 'Created tag bar.\n')
306
def test_init_repo(self):
307
output, error = self.run_bzr(["init", "--format=git", "bla.git"])
308
self.assertEqual(error, '')
309
self.assertEqual(output, 'Created a standalone tree (format: git)\n')
311
def test_diff_format(self):
312
tree = self.make_branch_and_tree('.')
313
self.build_tree(['a'])
315
output, error = self.run_bzr(['diff', '--format=git'], retcode=1)
316
self.assertEqual(error, '')
317
# Some older versions of Dulwich (< 0.19.12) formatted diffs slightly
319
from dulwich import __version__ as dulwich_version
320
if dulwich_version < (0, 19, 12):
321
self.assertEqual(output,
322
'diff --git /dev/null b/a\n'
325
'index 0000000..c197bd8 100644\n'
331
self.assertEqual(output,
332
'diff --git a/a b/a\n'
334
'new file mode 100644\n'
335
'index 0000000..c197bd8 100644\n'
341
def test_git_import_uncolocated(self):
342
r = GitRepo.init("a", mkdir=True)
343
self.build_tree(["a/file"])
345
r.do_commit(ref=b"refs/heads/abranch",
346
committer=b"Joe <joe@example.com>", message=b"Dummy")
347
r.do_commit(ref=b"refs/heads/bbranch",
348
committer=b"Joe <joe@example.com>", message=b"Dummy")
349
self.run_bzr(["git-import", "a", "b"])
351
set([".bzr", "abranch", "bbranch"]), set(os.listdir("b")))
353
def test_git_import(self):
354
r = GitRepo.init("a", mkdir=True)
355
self.build_tree(["a/file"])
357
r.do_commit(ref=b"refs/heads/abranch",
358
committer=b"Joe <joe@example.com>", message=b"Dummy")
359
r.do_commit(ref=b"refs/heads/bbranch",
360
committer=b"Joe <joe@example.com>", message=b"Dummy")
361
self.run_bzr(["git-import", "--colocated", "a", "b"])
362
self.assertEqual(set([".bzr"]), set(os.listdir("b")))
363
self.assertEqual(set(["abranch", "bbranch"]),
364
set(ControlDir.open("b").branch_names()))
366
def test_git_import_incremental(self):
367
r = GitRepo.init("a", mkdir=True)
368
self.build_tree(["a/file"])
370
r.do_commit(ref=b"refs/heads/abranch",
371
committer=b"Joe <joe@example.com>", message=b"Dummy")
372
self.run_bzr(["git-import", "--colocated", "a", "b"])
373
self.run_bzr(["git-import", "--colocated", "a", "b"])
374
self.assertEqual(set([".bzr"]), set(os.listdir("b")))
375
b = ControlDir.open("b")
376
self.assertEqual(["abranch"], b.branch_names())
378
def test_git_import_tags(self):
379
r = GitRepo.init("a", mkdir=True)
380
self.build_tree(["a/file"])
382
cid = r.do_commit(ref=b"refs/heads/abranch",
383
committer=b"Joe <joe@example.com>", message=b"Dummy")
384
r[b"refs/tags/atag"] = cid
385
self.run_bzr(["git-import", "--colocated", "a", "b"])
386
self.assertEqual(set([".bzr"]), set(os.listdir("b")))
387
b = ControlDir.open("b")
388
self.assertEqual(["abranch"], b.branch_names())
389
self.assertEqual(["atag"],
390
list(b.open_branch("abranch").tags.get_tag_dict().keys()))
392
def test_git_import_colo(self):
393
r = GitRepo.init("a", mkdir=True)
394
self.build_tree(["a/file"])
396
r.do_commit(ref=b"refs/heads/abranch",
397
committer=b"Joe <joe@example.com>", message=b"Dummy")
398
r.do_commit(ref=b"refs/heads/bbranch",
399
committer=b"Joe <joe@example.com>", message=b"Dummy")
400
self.make_controldir("b", format="development-colo")
401
self.run_bzr(["git-import", "--colocated", "a", "b"])
403
set([b.name for b in ControlDir.open("b").list_branches()]),
404
set(["abranch", "bbranch"]))
406
def test_git_refs_from_git(self):
407
r = GitRepo.init("a", mkdir=True)
408
self.build_tree(["a/file"])
410
cid = r.do_commit(ref=b"refs/heads/abranch",
411
committer=b"Joe <joe@example.com>", message=b"Dummy")
412
r[b"refs/tags/atag"] = cid
413
(stdout, stderr) = self.run_bzr(["git-refs", "a"])
414
self.assertEqual(stderr, "")
415
self.assertEqual(stdout,
416
'refs/heads/abranch -> ' + cid.decode('ascii') + '\n'
417
'refs/tags/atag -> ' + cid.decode('ascii') + '\n')
419
def test_git_refs_from_bzr(self):
420
tree = self.make_branch_and_tree('a')
421
self.build_tree(["a/file"])
424
committer=b"Joe <joe@example.com>", message=b"Dummy")
425
tree.branch.tags.set_tag("atag", revid)
426
(stdout, stderr) = self.run_bzr(["git-refs", "a"])
427
self.assertEqual(stderr, "")
428
self.assertTrue("refs/tags/atag -> " in stdout)
429
self.assertTrue("HEAD -> " in stdout)
431
def test_check(self):
432
r = GitRepo.init("gitr", mkdir=True)
433
self.build_tree_contents([("gitr/foo", b"hello from git")])
435
r.do_commit(b"message", committer=b"Somebody <user@example.com>")
436
out, err = self.run_bzr(["check", "gitr"])
438
self.assertEqual(out, '')
439
self.assertTrue(err.endswith, '3 objects\n')
441
def test_local_whoami(self):
442
r = GitRepo.init("gitr", mkdir=True)
443
self.build_tree_contents([('gitr/.git/config', """\
445
email = some@example.com
448
out, err = self.run_bzr(["whoami", "-d", "gitr"])
449
self.assertEqual(out, "Test User <some@example.com>\n")
450
self.assertEqual(err, "")
452
self.build_tree_contents([('gitr/.git/config', """\
454
email = some@example.com
456
out, err = self.run_bzr(["whoami", "-d", "gitr"])
457
self.assertEqual(out, "some@example.com\n")
458
self.assertEqual(err, "")
460
def test_local_signing_key(self):
461
r = GitRepo.init("gitr", mkdir=True)
462
self.build_tree_contents([('gitr/.git/config', """\
464
email = some@example.com
466
signingkey = D729A457
468
out, err = self.run_bzr(["config", "-d", "gitr", "gpg_signing_key"])
469
self.assertEqual(out, "D729A457\n")
470
self.assertEqual(err, "")
473
class ShallowTests(ExternalBase):
476
super(ShallowTests, self).setUp()
477
# Smoke test for "bzr log" in a git repository with shallow depth.
478
self.repo = GitRepo.init('gitr', mkdir=True)
479
self.build_tree_contents([("gitr/foo", b"hello from git")])
480
self.repo.stage("foo")
482
b"message", committer=b"Somebody <user@example.com>",
483
author=b"Somebody <user@example.com>",
484
commit_timestamp=1526330165, commit_timezone=0,
485
author_timestamp=1526330165, author_timezone=0,
486
merge_heads=[b'aa' * 20])
488
def test_log_shallow(self):
489
# Check that bzr log does not fail and includes the revision.
490
output, error = self.run_bzr(['log', 'gitr'], retcode=3)
492
error, 'brz: ERROR: Further revision history missing.\n')
493
self.assertEqual(output,
494
'------------------------------------------------------------\n'
495
'revision-id: git-v1:' + self.repo.head().decode('ascii') + '\n'
496
'git commit: ' + self.repo.head().decode('ascii') + '\n'
497
'committer: Somebody <user@example.com>\n'
498
'timestamp: Mon 2018-05-14 20:36:05 +0000\n'
502
def test_version_info_rio(self):
503
output, error = self.run_bzr(['version-info', '--rio', 'gitr'])
504
self.assertEqual(error, '')
505
self.assertNotIn('revno:', output)
507
def test_version_info_python(self):
508
output, error = self.run_bzr(['version-info', '--python', 'gitr'])
509
self.assertEqual(error, '')
510
self.assertNotIn('revno:', output)
512
def test_version_info_custom_with_revno(self):
513
output, error = self.run_bzr(
514
['version-info', '--custom',
515
'--template=VERSION_INFO r{revno})\n', 'gitr'], retcode=3)
517
error, 'brz: ERROR: Variable {revno} is not available.\n')
518
self.assertEqual(output, 'VERSION_INFO r')
520
def test_version_info_custom_without_revno(self):
521
output, error = self.run_bzr(
522
['version-info', '--custom', '--template=VERSION_INFO \n',
524
self.assertEqual(error, '')
525
self.assertEqual(output, 'VERSION_INFO \n')
528
class SwitchTests(ExternalBase):
530
def test_switch_branch(self):
531
# Create a git repository with a revision.
532
repo = GitRepo.init(self.test_dir)
533
builder = tests.GitBranchBuilder()
534
builder.set_branch(b'refs/heads/oldbranch')
535
builder.set_file('a', b'text for a\n', False)
536
builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>')
537
builder.set_branch(b'refs/heads/newbranch')
539
builder.set_file('a', b'text for new a\n', False)
540
builder.commit(b'Joe Foo <joe@foo.com>', u'<The commit message>')
543
repo.refs.set_symbolic_ref(b'HEAD', b'refs/heads/newbranch')
547
output, error = self.run_bzr('switch oldbranch')
548
self.assertEqual(output, '')
549
self.assertTrue(error.startswith('Updated to revision 1.\n'), error)
551
self.assertFileEqual("text for a\n", 'a')
552
tree = WorkingTree.open('.')
553
with tree.lock_read():
554
basis_tree = tree.basis_tree()
555
with basis_tree.lock_read():
556
self.assertEqual([], list(tree.iter_changes(basis_tree)))
558
def test_branch_with_nested_trees(self):
559
orig = self.make_branch_and_tree('source', format='git')
560
subtree = self.make_branch_and_tree('source/subtree', format='git')
561
self.build_tree(['source/subtree/a'])
562
self.build_tree_contents([('source/.gitmodules', """\
563
[submodule "subtree"]
566
""" % subtree.user_url)])
568
subtree.commit('add subtree contents')
569
orig.add_reference(subtree)
570
orig.add(['.gitmodules'])
571
orig.commit('add subtree')
573
self.run_bzr('branch source target')
575
target = WorkingTree.open('target')
576
target_subtree = WorkingTree.open('target/subtree')
577
self.assertTreesEqual(orig, target)
578
self.assertTreesEqual(subtree, target_subtree)
581
class SwitchScriptTests(TestCaseWithTransportAndScript):
583
def test_switch_preserves(self):
584
# See https://bugs.launchpad.net/brz/+bug/1820606
587
Created a standalone tree (format: git)
589
$ echo original > file.txt
592
$ brz ci -q -m "Initial"
593
$ echo "entered on master branch" > file.txt
597
$ brz switch -b other
598
2>Tree is up to date at revision 1.
599
2>Switched to branch other
601
entered on master branch
605
class GrepTests(ExternalBase):
607
def test_simple_grep(self):
608
tree = self.make_branch_and_tree('.', format='git')
609
self.build_tree_contents([('a', 'text for a\n')])
611
output, error = self.run_bzr('grep text')
612
self.assertEqual(output, 'a:text for a\n')
613
self.assertEqual(error, '')
616
class ReconcileTests(ExternalBase):
618
def test_simple_reconcile(self):
619
tree = self.make_branch_and_tree('.', format='git')
620
self.build_tree_contents([('a', 'text for a\n')])
622
output, error = self.run_bzr('reconcile')
623
self.assertContainsRe(
625
'Reconciling branch file://.*\n'
626
'Reconciling repository file://.*\n'
627
'Reconciliation complete.\n')
628
self.assertEqual(error, '')
631
class StatusTests(ExternalBase):
633
def test_empty_dir(self):
634
tree = self.make_branch_and_tree('.', format='git')
635
self.build_tree(['a/', 'a/foo'])
636
self.build_tree_contents([('.gitignore', 'foo\n')])
637
tree.add(['.gitignore'])
638
tree.commit('add ignore')
639
output, error = self.run_bzr('st')
640
self.assertEqual(output, '')
641
self.assertEqual(error, '')
644
class StatsTests(ExternalBase):
646
def test_simple_stats(self):
647
self.requireFeature(PluginLoadedFeature('stats'))
648
tree = self.make_branch_and_tree('.', format='git')
649
self.build_tree_contents([('a', 'text for a\n')])
651
tree.commit('a commit', committer='Somebody <somebody@example.com>')
652
output, error = self.run_bzr('stats')
653
self.assertEqual(output, ' 1 Somebody <somebody@example.com>\n')
656
class GitObjectsTests(ExternalBase):
658
def run_simple(self, format):
659
tree = self.make_branch_and_tree('.', format=format)
660
self.build_tree(['a/', 'a/foo'])
663
output, error = self.run_bzr('git-objects')
664
shas = list(output.splitlines())
665
self.assertEqual([40, 40], [len(s) for s in shas])
666
self.assertEqual(error, '')
668
output, error = self.run_bzr('git-object %s' % shas[0])
669
self.assertEqual('', error)
671
def test_in_native(self):
672
self.run_simple(format='git')
674
def test_in_bzr(self):
675
self.run_simple(format='2a')
678
class GitApplyTests(ExternalBase):
680
def test_apply(self):
681
b = self.make_branch_and_tree('.')
683
with open('foo.patch', 'w') as f:
685
From bdefb25fab801e6af0a70e965f60cb48f2b759fa Mon Sep 17 00:00:00 2001
686
From: Dmitry Bogatov <KAction@debian.org>
687
Date: Fri, 8 Feb 2019 23:28:30 +0000
688
Subject: [PATCH] Add fixed for out-of-date-standards-version
692
1 files changed, 14 insertions(+)
693
create mode 100644 message
695
diff --git a/message b/message
697
index 0000000..05ec0b1
701
+Update standards version, no changes needed.
703
+Fixed-Lintian-Tags: out-of-date-standards-version
705
output, error = self.run_bzr('git-apply foo.patch')
706
self.assertContainsRe(
708
'Committing to: .*\n'
709
'Committed revision 1.\n')