Merge lp:~jelmer/brz/alpha-fix-git-python3 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/alpha-fix-git-python3
Merge into: lp:brz
Diff against target: 61 lines (+24/-7)
2 files modified
breezy/git/tests/test_transportgit.py (+23/-6)
breezy/git/transportgit.py (+1/-1)
To merge this branch: bzr merge lp:~jelmer/brz/alpha-fix-git-python3
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+356037@code.launchpad.net

Commit message

Fix reading of packed refs on Python 3.

Description of the change

Fix reading of packed refs on Python 3.

Breezy itself never creates packed-refs, so this codepath was not exercised.

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

Thanks!

review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Running landing tests failed
https://ci.breezy-vcs.org/job/land-brz/511/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/git/tests/test_transportgit.py'
--- breezy/git/tests/test_transportgit.py 2018-06-14 17:59:16 +0000
+++ breezy/git/tests/test_transportgit.py 2018-10-04 17:14:51 +0000
@@ -20,11 +20,15 @@
2020
21from dulwich.objects import Blob21from dulwich.objects import Blob
22from dulwich.tests.test_object_store import PackBasedObjectStoreTests22from dulwich.tests.test_object_store import PackBasedObjectStoreTests
23from dulwich.tests.test_refs import RefsContainerTests
23from dulwich.tests.utils import make_object24from dulwich.tests.utils import make_object
2425
25from ...tests import TestCaseWithTransport26from ...tests import TestCaseWithTransport
2627
27from ..transportgit import TransportObjectStore28from ..transportgit import (
29 TransportObjectStore,
30 TransportRefsContainer,
31 )
2832
2933
30class TransportObjectStoreTests(PackBasedObjectStoreTests, TestCaseWithTransport):34class TransportObjectStoreTests(PackBasedObjectStoreTests, TestCaseWithTransport):
@@ -55,9 +59,22 @@
5559
56# FIXME: Unfortunately RefsContainerTests requires on a specific set of refs existing.60# FIXME: Unfortunately RefsContainerTests requires on a specific set of refs existing.
5761
58# class TransportRefContainerTests(RefsContainerTests, TestCaseWithTransport):62class TransportRefContainerTests(TestCaseWithTransport):
59#63
60# def setUp(self):64 def setUp(self):
61# TestCaseWithTransport.setUp(self)65 TestCaseWithTransport.setUp(self)
62# self._refs = TransportRefsContainer(self.get_transport())66 self._refs = TransportRefsContainer(self.get_transport())
67
68 def test_packed_refs_missing(self):
69 self.assertEqual({}, self._refs.get_packed_refs())
70
71 def test_packed_refs(self):
72 self.get_transport().put_bytes_non_atomic('packed-refs',
73 b'# pack-refs with: peeled fully-peeled sorted \n'
74 b'2001b954f1ec392f84f7cec2f2f96a76ed6ba4ee refs/heads/master')
75 self.assertEqual(
76 {b'refs/heads/master': b'2001b954f1ec392f84f7cec2f2f96a76ed6ba4ee'},
77 self._refs.get_packed_refs())
78
79
6380
6481
=== modified file 'breezy/git/transportgit.py'
--- breezy/git/transportgit.py 2018-08-04 17:32:58 +0000
+++ breezy/git/transportgit.py 2018-10-04 17:14:51 +0000
@@ -164,7 +164,7 @@
164 return {}164 return {}
165 try:165 try:
166 first_line = next(iter(f)).rstrip()166 first_line = next(iter(f)).rstrip()
167 if (first_line.startswith("# pack-refs") and " peeled" in167 if (first_line.startswith(b"# pack-refs") and b" peeled" in
168 first_line):168 first_line):
169 for sha, name, peeled in read_packed_refs_with_peeled(f):169 for sha, name, peeled in read_packed_refs_with_peeled(f):
170 self._packed_refs[name] = sha170 self._packed_refs[name] = sha

Subscribers

People subscribed via source and target branches