Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33e09c8

Browse files
Yuri Volchkovyvolchkov
Yuri Volchkov
authored andcommitted
Fix inheritance issue at commit.iter_items
The iterator used to yield Commit() objects, which does not play wellwith inheritance. Yield cls() instead.Signed-off-by: Yuri Volchkov <yuri@volch.org>
1 parent3c19a6e commit33e09c8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

‎git/objects/commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream):
269269
# END handle extra info
270270

271271
assertlen(hexsha)==40,"Invalid line: %s"%hexsha
272-
yieldCommit(repo,hex_to_bin(hexsha))
272+
yieldcls(repo,hex_to_bin(hexsha))
273273
# END for each line in stream
274274
# TODO: Review this - it seems process handling got a bit out of control
275275
# due to many developers trying to fix the open file handles issue

‎test/test_commit.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ def test_iteration(self):
199199
less_ltd_commits=list(Commit.iter_items(self.rorepo,'master',paths=('CHANGES','AUTHORS')))
200200
assertlen(ltd_commits)<len(less_ltd_commits)
201201

202+
classChild(Commit):
203+
def__init__(self,*args,**kwargs):
204+
child_class=True
205+
super(Child,self).__init__(*args,**kwargs)
206+
207+
child_commits=list(Child.iter_items(self.rorepo,'master',paths=('CHANGES','AUTHORS')))
208+
asserttype(child_commits[0])==Child
209+
210+
202211
deftest_iter_items(self):
203212
# pretty not allowed
204213
self.assertRaises(ValueError,Commit.iter_items,self.rorepo,'master',pretty="raw")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp