Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a0cb95c

Browse files
committed
Added test for complex blame revision query.
It works as expected by me at least. Related to #71
1 parent c767b52 commit a0cb95c

File tree

2 files changed

+184
-0
lines changed

2 files changed

+184
-0
lines changed
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 1 1 83
2+
author Sebastian Thiel
3+
author-mail <[email protected]>
4+
author-time 1420715996
5+
author-tz +0100
6+
committer Sebastian Thiel
7+
committer-mail <[email protected]>
8+
committer-time 1420716149
9+
committer-tz +0100
10+
summary Fixed PY3 support.
11+
boundary
12+
filename README.md
13+
## GitPython
14+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 2 2
15+
16+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 3 3
17+
GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
18+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 4 4
19+
20+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 5 5
21+
It provides abstractions of git objects for easy access of repository data, and additionally allows you to access the git repository more directly using either a pure python implementation, or the faster, but more resource intensive git command implementation.
22+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 6 6
23+
24+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 7 7
25+
The object database implementation is optimized for handling large quantities of objects and large datasets, which is achieved by using low-level structures and data streaming.
26+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 8 8
27+
28+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 9 9
29+
### REQUIREMENTS
30+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 10 10
31+
32+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 11 11
33+
* Git ( tested with 1.8.3.4 )
34+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 12 12
35+
* Python Nose - used for running the tests
36+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 13 13
37+
- Tested with nose 1.3.0
38+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 14 14
39+
* Mock by Michael Foord used for tests
40+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 15 15
41+
- Tested with 1.0.1
42+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 16 16
43+
* Coverage - used for tests coverage
44+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 17 17
45+
46+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 18 18
47+
The list of dependencies are listed in /requirements.txt and /test-requirements.txt. The installer takes care of installing them for you though.
48+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 19 19
49+
50+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 20 20
51+
### INSTALL
52+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 21 21
53+
54+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 22 22
55+
[![Latest Version](https://pypip.in/version/GitPython/badge.svg)](https://pypi.python.org/pypi/GitPython/)
56+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 23 23
57+
[![Supported Python Versions](https://pypip.in/py_versions/GitPython/badge.svg)](https://pypi.python.org/pypi/GitPython/)
58+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 24 24
59+
60+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 25 25
61+
If you have downloaded the source code:
62+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 26 26
63+
64+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 27 27
65+
python setup.py install
66+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 28 28
67+
68+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 29 29
69+
or if you want to obtain a copy from the Pypi repository:
70+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 30 30
71+
72+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 31 31
73+
pip install gitpython
74+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 32 32
75+
76+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 33 33
77+
Both commands will install the required package dependencies.
78+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 34 34
79+
80+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 35 35
81+
A distribution package can be obtained for manual installation at:
82+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 36 36
83+
84+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 37 37
85+
http://pypi.python.org/pypi/GitPython
86+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 38 38
87+
88+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 39 39
89+
### RUNNING TESTS
90+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 40 40
91+
92+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 41 41
93+
The easiest way to run test is by using [tox](https://pypi.python.org/pypi/tox) a wrapper around virtualenv. It will take care of setting up environnements with the proper dependencies installed and execute test commands. To install it simply:
94+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 42 42
95+
96+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 43 43
97+
pip install tox
98+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 44 44
99+
100+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 45 45
101+
Then run:
102+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 46 46
103+
104+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 47 47
105+
tox
106+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 48 48
107+
108+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 49 49
109+
### SOURCE
110+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 50 50
111+
112+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 51 51
113+
GitPython's git repo is available on GitHub, which can be browsed at [github](https://github.com/gitpython-developers/GitPython) and cloned like that:
114+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 52 52
115+
116+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 53 53
117+
git clone git://github.com/gitpython-developers/GitPython.git git-python
118+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 54 54
119+
120+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 55 55
121+
122+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 56 56
123+
### INFRASTRUCTURE
124+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 57 57
125+
126+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 58 58
127+
* [User Documentation](http://gitpython.readthedocs.org)
128+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 59 59
129+
* [Mailing List](http://groups.google.com/group/git-python)
130+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 60 60
131+
* [Issue Tracker](https://github.com/gitpython-developers/GitPython/issues)
132+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 61 61
133+
134+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 62 62
135+
### LICENSE
136+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 63 63
137+
138+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 64 64
139+
New BSD License. See the LICENSE file.
140+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 65 65
141+
142+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 66 66
143+
### DEVELOPMENT STATUS
144+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 67 67
145+
146+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 68 68
147+
[![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg?branch=0.3)](https://travis-ci.org/gitpython-developers/GitPython)
148+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 69 69
149+
[![Coverage Status](https://coveralls.io/repos/gitpython-developers/GitPython/badge.png?branch=master)](https://coveralls.io/r/gitpython-developers/GitPython?branch=master)
150+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 70 70
151+
[![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable)
152+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 71 71
153+
154+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 72 72
155+
Now that there seems to be a massive user base, this should be motivation enough to let git-python return to a proper state, which means
156+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 73 73
157+
158+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 74 74
159+
* no open pull requests
160+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 75 75
161+
* no open issues describing bugs
162+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 76 76
163+
164+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 77 77
165+
#### FUTURE GOALS
166+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 78 78
167+
168+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 79 79
169+
There has been a lot of work in the master branch, which is the direction I want git-python to go. Namely, it should be able to freely mix and match the back-end used, depending on your requirements and environment.
170+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 80 80
171+
172+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 81 81
173+
* make new master work similarly to 0.3, but with the option to swap for at least one additional backend
174+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 82 82
175+
* make a 1.0 release
176+
e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 83 83
177+
* add backends as required

git/test/test_repo.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ def test_blame_real(self):
314314
assert c, "Should have executed at least one blame command"
315315
assert nml, "There should at least be one blame commit that contains multiple lines"
316316

317+
@patch.object(Git, '_call_process')
318+
def test_blame_complex_revision(self, git):
319+
git.return_value = fixture('blame_complex_revision')
320+
res = self.rorepo.blame("HEAD~10..HEAD", "README.md")
321+
assert len(res) == 1
322+
assert len(res[0][1]) == 83, "Unexpected amount of parsed blame lines"
323+
317324
def test_untracked_files(self):
318325
base = self.rorepo.working_tree_dir
319326
files = (join_path_native(base, "__test_myfile"),

0 commit comments

Comments
 (0)