summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2015-01-09 17:58:53 +0100
committerSebastian Thiel <byronimo@gmail.com>2015-01-09 18:00:38 +0100
commita0cb95c5df7a559633c48f5b0f200599c4a62091 (patch)
treedbe9253bc17cf23f0b63de03130350a7c542b9a6
parentc767b5206f1e9c8536110dda4d515ebb9242bbeb (diff)
downloadgitpython-a0cb95c5df7a559633c48f5b0f200599c4a62091.tar.gz
Added test for complex blame revision query.
It works as expected by me at least. Related to #71
-rw-r--r--git/test/fixtures/blame_complex_revision177
-rw-r--r--git/test/test_repo.py7
2 files changed, 184 insertions, 0 deletions
diff --git a/git/test/fixtures/blame_complex_revision b/git/test/fixtures/blame_complex_revision
new file mode 100644
index 00000000..e2de6d37
--- /dev/null
+++ b/git/test/fixtures/blame_complex_revision
@@ -0,0 +1,177 @@
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 1 1 83
+author Sebastian Thiel
+author-mail <byronimo@gmail.com>
+author-time 1420715996
+author-tz +0100
+committer Sebastian Thiel
+committer-mail <byronimo@gmail.com>
+committer-time 1420716149
+committer-tz +0100
+summary Fixed PY3 support.
+boundary
+filename README.md
+ ## GitPython
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 2 2
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 3 3
+ GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 4 4
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 5 5
+ 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.
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 6 6
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 7 7
+ 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.
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 8 8
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 9 9
+ ### REQUIREMENTS
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 10 10
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 11 11
+ * Git ( tested with 1.8.3.4 )
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 12 12
+ * Python Nose - used for running the tests
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 13 13
+ - Tested with nose 1.3.0
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 14 14
+ * Mock by Michael Foord used for tests
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 15 15
+ - Tested with 1.0.1
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 16 16
+ * Coverage - used for tests coverage
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 17 17
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 18 18
+ The list of dependencies are listed in /requirements.txt and /test-requirements.txt. The installer takes care of installing them for you though.
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 19 19
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 20 20
+ ### INSTALL
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 21 21
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 22 22
+ [![Latest Version](https://pypip.in/version/GitPython/badge.svg)](https://pypi.python.org/pypi/GitPython/)
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 23 23
+ [![Supported Python Versions](https://pypip.in/py_versions/GitPython/badge.svg)](https://pypi.python.org/pypi/GitPython/)
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 24 24
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 25 25
+ If you have downloaded the source code:
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 26 26
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 27 27
+ python setup.py install
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 28 28
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 29 29
+ or if you want to obtain a copy from the Pypi repository:
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 30 30
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 31 31
+ pip install gitpython
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 32 32
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 33 33
+ Both commands will install the required package dependencies.
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 34 34
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 35 35
+ A distribution package can be obtained for manual installation at:
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 36 36
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 37 37
+ http://pypi.python.org/pypi/GitPython
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 38 38
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 39 39
+ ### RUNNING TESTS
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 40 40
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 41 41
+ 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:
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 42 42
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 43 43
+ pip install tox
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 44 44
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 45 45
+ Then run:
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 46 46
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 47 47
+ tox
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 48 48
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 49 49
+ ### SOURCE
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 50 50
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 51 51
+ GitPython's git repo is available on GitHub, which can be browsed at [github](https://github.com/gitpython-developers/GitPython) and cloned like that:
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 52 52
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 53 53
+ git clone git://github.com/gitpython-developers/GitPython.git git-python
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 54 54
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 55 55
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 56 56
+ ### INFRASTRUCTURE
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 57 57
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 58 58
+ * [User Documentation](http://gitpython.readthedocs.org)
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 59 59
+ * [Mailing List](http://groups.google.com/group/git-python)
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 60 60
+ * [Issue Tracker](https://github.com/gitpython-developers/GitPython/issues)
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 61 61
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 62 62
+ ### LICENSE
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 63 63
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 64 64
+ New BSD License. See the LICENSE file.
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 65 65
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 66 66
+ ### DEVELOPMENT STATUS
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 67 67
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 68 68
+ [![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg?branch=0.3)](https://travis-ci.org/gitpython-developers/GitPython)
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 69 69
+ [![Coverage Status](https://coveralls.io/repos/gitpython-developers/GitPython/badge.png?branch=master)](https://coveralls.io/r/gitpython-developers/GitPython?branch=master)
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 70 70
+ [![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable)
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 71 71
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 72 72
+ 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
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 73 73
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 74 74
+ * no open pull requests
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 75 75
+ * no open issues describing bugs
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 76 76
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 77 77
+ #### FUTURE GOALS
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 78 78
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 79 79
+ 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.
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 80 80
+
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 81 81
+ * make new master work similarly to 0.3, but with the option to swap for at least one additional backend
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 82 82
+ * make a 1.0 release
+e40ad6369bc74d01af4dc41d3a9b8e25ac2aa01e 83 83
+ * add backends as required
diff --git a/git/test/test_repo.py b/git/test/test_repo.py
index e2342b3c..25acbec9 100644
--- a/git/test/test_repo.py
+++ b/git/test/test_repo.py
@@ -314,6 +314,13 @@ class TestRepo(TestBase):
assert c, "Should have executed at least one blame command"
assert nml, "There should at least be one blame commit that contains multiple lines"
+ @patch.object(Git, '_call_process')
+ def test_blame_complex_revision(self, git):
+ git.return_value = fixture('blame_complex_revision')
+ res = self.rorepo.blame("HEAD~10..HEAD", "README.md")
+ assert len(res) == 1
+ assert len(res[0][1]) == 83, "Unexpected amount of parsed blame lines"
+
def test_untracked_files(self):
base = self.rorepo.working_tree_dir
files = (join_path_native(base, "__test_myfile"),