Skip to content

Commit

Permalink
Access Commit._extra rather than deprecated Commit.extra
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Jan 31, 2023
1 parent 23a986a commit e439305
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dulwich/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ def _serialize(self):
# No trailing empty line
if chunks[-1].endswith(b" \n"):
chunks[-1] = chunks[-1][:-2]
for k, v in self.extra:
for k, v in self._extra:
if b"\n" in k or b"\n" in v:
raise AssertionError("newline in extra data: {!r} -> {!r}".format(k, v))
chunks.append(git_line(k, v))
Expand Down Expand Up @@ -1556,7 +1556,7 @@ def _get_extra(self):
"""Return extra settings of this commit."""
warnings.warn(
'Commit.extra is deprecated. Use Commit._extra instead.',
DeprecationWarning)
DeprecationWarning, stacklevel=2)
return self._extra

extra = property(
Expand Down
6 changes: 3 additions & 3 deletions dulwich/tests/test_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def test_simple(self):

def test_custom(self):
c = Commit.from_string(self.make_commit_text(extra={b"extra-field": b"data"}))
self.assertEqual([(b"extra-field", b"data")], c.extra)
self.assertEqual([(b"extra-field", b"data")], c._extra)

def test_encoding(self):
c = Commit.from_string(self.make_commit_text(encoding=b"UTF-8"))
Expand Down Expand Up @@ -732,7 +732,7 @@ def test_parse_gpgsig(self):
"""
)
self.assertEqual(b"foo\n", c.message)
self.assertEqual([], c.extra)
self.assertEqual([], c._extra)
self.assertEqual(
b"""-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Expand Down Expand Up @@ -776,7 +776,7 @@ def test_parse_header_trailing_newline(self):
3.3.0 version bump and docs
"""
)
self.assertEqual([], c.extra)
self.assertEqual([], c._extra)
self.assertEqual(
b"""\
-----BEGIN PGP SIGNATURE-----
Expand Down

0 comments on commit e439305

Please sign in to comment.