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

Commit1adc79a

Browse files
committed
test_commit: add a testcase for parsing rev-list --bisect-all output
This adds a testcase for Commit.list_from_string to ensure thatit can properly parse the output of git rev-list --bisect-all.Signed-off-by: David Aguilar <davvid@gmail.com>
1 parentc231551 commit1adc79a

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

‎test/fixtures/rev_list_bisect_all

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
commit cf37099ea8d1d8c7fbf9b6d12d7ec0249d3acb8b (dist=2)
2+
tree 01fb5ddba393df486d850c37f40c9a87f4a28a14
3+
parent bfdc8e26d36833b3a7106c306fdbe6d38dec817e
4+
author Florian Apolloner <florian@apolloner.eu> 1218480521 +0200
5+
committer Florian Apolloner <florian@apolloner.eu> 1218480521 +0200
6+
7+
use shell=True in windows (git.exe needs to be on %PATH%)
8+
One bug remaining: git on windows is returning status 0 for `git this-does-not-exist`, so no GitCommandError is raised.
9+
10+
commit 33ebe7acec14b25c5f84f35a664803fcab2f7781 (dist=1)
11+
tree 960b40fe368a9882221bcdd8635b9080dec01ec6
12+
author Michael Trier <mtrier@gmail.com> 1210193388 -0400
13+
committer Michael Trier <mtrier@gmail.com> 1210193388 -0400
14+
15+
initial project
16+
17+
commit a6604a00a652e754cb8b6b0b9f194f839fc38d7c (dist=1)
18+
tree 547e8af2f10ffa77c4ed4d0a8381e64141f986b4
19+
parent cf37099ea8d1d8c7fbf9b6d12d7ec0249d3acb8b
20+
author Florian Apolloner <florian@apolloner.eu> 1219330141 +0200
21+
committer Florian Apolloner <florian@apolloner.eu> 1219330141 +0200
22+
23+
fixed unneeded list unpacking
24+
25+
commit 8df638c22c75ddc9a43ecdde90c0c9939f5009e7 (dist=0)
26+
tree 43a63b045e538a38161c8da5e154ff1c9436ea4e
27+
parent a6604a00a652e754cb8b6b0b9f194f839fc38d7c
28+
parent 127e511ea2e22f3bd9a0279e747e9cfa9509986d
29+
author Florian Apolloner <florian@apolloner.eu> 1219330182 +0200
30+
committer Florian Apolloner <florian@apolloner.eu> 1219330182 +0200
31+
32+
Merge branch 'master' of git@gitorious.org:git-python/mainline
33+
34+
commit c231551328faa864848bde6ff8127f59c9566e90 (dist=-1)
35+
tree 991ed402b4f6562209ea56550a3c5050d1aa0118
36+
parent 8df638c22c75ddc9a43ecdde90c0c9939f5009e7
37+
author David Aguilar <davvid@gmail.com> 1220418344 -0700
38+
committer David Aguilar <davvid@gmail.com> 1220418344 -0700
39+
40+
commit: handle --bisect-all output in Commit.list_from_string
41+
42+
Rui Abreu Ferrerira pointed out that "git rev-list --bisect-all"
43+
returns a slightly different format which we can easily accomodate
44+
by changing the way we parse rev-list output.
45+
46+
http://groups.google.com/group/git-python/browse_thread/thread/aed1d5c4b31d5027
47+
48+
This resolves the issue mentioned in that thread.
49+
50+
Signed-off-by: David Aguilar <davvid@gmail.com>
51+

‎test/git/test_commit.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,32 @@ def test_stats(self, git):
186186
assert_true(git.called)
187187
assert_equal(git.call_args, (('diff','634396b2f541a9f2d58b00be1a07f0c358b999b3'), {'numstat':True}))
188188

189+
@patch(Git,'_call_process')
190+
deftest_rev_list_bisect_all(self,git):
191+
"""
192+
'git rev-list --bisect-all' returns additional information
193+
in the commit header. This test ensures that we properly parse it.
194+
"""
195+
196+
git.return_value=fixture('rev_list_bisect_all')
197+
198+
revs=self.repo.git.rev_list('HEAD',
199+
pretty='raw',
200+
first_parent=True,
201+
bisect_all=True)
202+
assert_true(git.called)
203+
204+
commits=Commit.list_from_string(self.repo,revs)
205+
expected_ids= (
206+
'cf37099ea8d1d8c7fbf9b6d12d7ec0249d3acb8b',
207+
'33ebe7acec14b25c5f84f35a664803fcab2f7781',
208+
'a6604a00a652e754cb8b6b0b9f194f839fc38d7c',
209+
'8df638c22c75ddc9a43ecdde90c0c9939f5009e7',
210+
'c231551328faa864848bde6ff8127f59c9566e90',
211+
)
212+
forsha1,commitinzip(expected_ids,commits):
213+
assert_equal(sha1,commit.id)
214+
189215
deftest_str(self):
190216
commit=Commit(self.repo,id='abc')
191217
assert_equal ("abc",str(commit))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp