Merge lp:~jelmer/brz/both-dulwich into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/both-dulwich
Merge into: lp:brz
Diff against target: 41 lines (+22/-9)
1 file modified
breezy/git/tests/test_blackbox.py (+22/-9)
To merge this branch: bzr merge lp:~jelmer/brz/both-dulwich
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+368860@code.launchpad.net

Commit message

Fix compatibility with pre-0.19.12 versions of Dulwich.

Description of the change

Fix compatibility with pre-0.19.12 versions of Dulwich.

Newer versions have a slightly different way of formatting diff results.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks. Could probably write this with assertContainsRe but wouldn't really be any clearer.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/tests/test_blackbox.py'
2--- breezy/git/tests/test_blackbox.py 2019-06-02 05:13:10 +0000
3+++ breezy/git/tests/test_blackbox.py 2019-06-15 13:07:24 +0000
4@@ -212,15 +212,28 @@
5 tree.add(['a'])
6 output, error = self.run_bzr(['diff', '--format=git'], retcode=1)
7 self.assertEqual(error, '')
8- self.assertEqual(output,
9- 'diff --git a/a b/a\n'
10- 'old file mode 0\n'
11- 'new file mode 100644\n'
12- 'index 0000000..c197bd8 100644\n'
13- '--- /dev/null\n'
14- '+++ b/a\n'
15- '@@ -0,0 +1 @@\n'
16- '+contents of a\n')
17+ # Some older versions of Dulwich (< 0.19.12) formatted diffs slightly differently.
18+ from dulwich import __version__ as dulwich_version
19+ if dulwich_version < (0, 19, 12):
20+ self.assertEqual(output,
21+ 'diff --git /dev/null b/a\n'
22+ 'old mode 0\n'
23+ 'new mode 100644\n'
24+ 'index 0000000..c197bd8 100644\n'
25+ '--- /dev/null\n'
26+ '+++ b/a\n'
27+ '@@ -0,0 +1 @@\n'
28+ '+contents of a\n')
29+ else:
30+ self.assertEqual(output,
31+ 'diff --git a/a b/a\n'
32+ 'old file mode 0\n'
33+ 'new file mode 100644\n'
34+ 'index 0000000..c197bd8 100644\n'
35+ '--- /dev/null\n'
36+ '+++ b/a\n'
37+ '@@ -0,0 +1 @@\n'
38+ '+contents of a\n')
39
40 def test_git_import_uncolocated(self):
41 r = GitRepo.init("a", mkdir=True)

Subscribers

People subscribed via source and target branches