Hello community,
here is the log from the commit of package python-GitPython for openSUSE:Factory checked in at 2018-08-08 14:54:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-GitPython (Old)
and /work/SRC/openSUSE:Factory/.python-GitPython.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-GitPython"
Wed Aug 8 14:54:15 2018 rev:11 rq:627962 version:2.1.11
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-GitPython/python-GitPython.changes 2018-05-15 10:31:07.869192501 +0200
+++ /work/SRC/openSUSE:Factory/.python-GitPython.new/python-GitPython.changes 2018-08-08 14:54:53.385687734 +0200
@@ -1,0 +2,17 @@
+Tue Aug 7 14:58:46 UTC 2018 - toddrme2178@gmail.com
+
+- update to 2.1.11
+ * Update test_docs.py
+ * Dedent code blocks in tutorial.
+ * Exception when constructing a Repo() from a pathlib.Path acknowledged help wanted
+ * Allow pathlib.Path in Repo.__init__
+ * Fix exception on import in MacOS
+ * Failed import raises non-ImportError exception on MacOS
+- update to 2.1.10
+ * Fix rename change type & support 'change in type' acknowledged
+ * Configurable chunk size
+ * Avoid from_timestamp() function to raise an exception when the offset…
+ * Adding files to repository that is located directly in the root acknowledged
+ * git: index: base: use os.path.relpath
+
+-------------------------------------------------------------------
Old:
----
GitPython-2.1.9.tar.gz
New:
----
GitPython-2.1.11.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-GitPython.spec ++++++
--- /var/tmp/diff_new_pack.DgW7nK/_old 2018-08-08 14:54:53.805688428 +0200
+++ /var/tmp/diff_new_pack.DgW7nK/_new 2018-08-08 14:54:53.809688434 +0200
@@ -18,9 +18,10 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
# Requires test files missing from the pypi source archive
+# See: https://github.com/gitpython-developers/GitPython/pull/788
%bcond_with test
Name: python-GitPython
-Version: 2.1.9
+Version: 2.1.11
Release: 0
Summary: Python Git Library
License: BSD-3-Clause
++++++ GitPython-2.1.9.tar.gz -> GitPython-2.1.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/AUTHORS new/GitPython-2.1.11/AUTHORS
--- old/GitPython-2.1.9/AUTHORS 2017-12-11 15:24:45.000000000 +0100
+++ new/GitPython-2.1.11/AUTHORS 2018-07-15 14:44:37.000000000 +0200
@@ -26,5 +26,6 @@
-Mikuláš Poul <mikulaspoul _at_ gmail.com>
-Charles Bouchard-Légaré
save
+### Projects using GitPython
+
+* [PyDriller](https://github.com/ishepard/pydriller)
+* [Kivy Designer](https://github.com/kivy/kivy-designer)
+* [Prowl](https://github.com/nettitude/Prowl)
+* [Python Taint](https://github.com/python-security/pyt)
+* [Buster](https://github.com/axitkhurana/buster)
+* [git-ftp](https://github.com/ezyang/git-ftp)
+* [Git-Pandas](https://github.com/wdm0006/git-pandas)
+* [PyGitUp](https://github.com/msiemens/PyGitUp)
+* [PyJFuzz](https://github.com/mseclab/PyJFuzz)
+* [Loki](https://github.com/Neo23x0/Loki)
+* [Omniwallet](https://github.com/OmniLayer/omniwallet)
+
### LICENSE
New BSD License. See the LICENSE file.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/VERSION new/GitPython-2.1.11/VERSION
--- old/GitPython-2.1.9/VERSION 2018-03-24 13:45:52.000000000 +0100
+++ new/GitPython-2.1.11/VERSION 2018-07-15 15:33:13.000000000 +0200
@@ -1 +1 @@
-2.1.9
+2.1.11
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/doc/source/changes.rst new/GitPython-2.1.11/doc/source/changes.rst
--- old/GitPython-2.1.9/doc/source/changes.rst 2018-03-24 13:50:05.000000000 +0100
+++ new/GitPython-2.1.11/doc/source/changes.rst 2018-07-15 15:35:23.000000000 +0200
@@ -2,6 +2,24 @@
Changelog
=========
+2.1.11 - Bugfixes
+=================
+
+see the following for (most) details:
+https://github.com/gitpython-developers/gitpython/milestone/26?closed=1
+
+or run have a look at the difference between tags v2.1.10 and v2.1.11:
+https://github.com/gitpython-developers/GitPython/compare/2.1.10...2.1.11
+
+2.1.10 - Bugfixes
+=================
+
+see the following for (most) details:
+https://github.com/gitpython-developers/gitpython/milestone/25?closed=1
+
+or run have a look at the difference between tags v2.1.9 and v2.1.10:
+https://github.com/gitpython-developers/GitPython/compare/2.1.9...2.1.10
+
2.1.9 - Dropping support for Python 2.6
=======================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/doc/source/tutorial.rst new/GitPython-2.1.11/doc/source/tutorial.rst
--- old/GitPython-2.1.9/doc/source/tutorial.rst 2016-10-09 11:24:43.000000000 +0200
+++ new/GitPython-2.1.11/doc/source/tutorial.rst 2018-07-15 14:44:37.000000000 +0200
@@ -19,6 +19,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [1-test_init_repo_object]
:end-before: # ![1-test_init_repo_object]
@@ -26,6 +27,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [2-test_init_repo_object]
:end-before: # ![2-test_init_repo_object]
@@ -33,6 +35,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [3-test_init_repo_object]
:end-before: # ![3-test_init_repo_object]
@@ -40,6 +43,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [4-test_init_repo_object]
:end-before: # ![4-test_init_repo_object]
@@ -47,6 +51,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [5-test_init_repo_object]
:end-before: # ![5-test_init_repo_object]
@@ -54,6 +59,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [6-test_init_repo_object]
:end-before: # ![6-test_init_repo_object]
@@ -66,6 +72,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [7-test_init_repo_object]
:end-before: # ![7-test_init_repo_object]
@@ -73,6 +80,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [8-test_init_repo_object]
:end-before: # ![8-test_init_repo_object]
@@ -80,6 +88,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [9-test_init_repo_object]
:end-before: # ![9-test_init_repo_object]
@@ -87,6 +96,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [10-test_init_repo_object]
:end-before: # ![10-test_init_repo_object]
@@ -94,6 +104,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [11-test_init_repo_object]
:end-before: # ![11-test_init_repo_object]
@@ -101,6 +112,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [12-test_init_repo_object]
:end-before: # ![12-test_init_repo_object]
@@ -108,6 +120,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [13-test_init_repo_object]
:end-before: # ![13-test_init_repo_object]
@@ -115,6 +128,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [14-test_init_repo_object]
:end-before: # ![14-test_init_repo_object]
@@ -126,6 +140,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [1-test_references_and_objects]
:end-before: # ![1-test_references_and_objects]
@@ -133,6 +148,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [2-test_references_and_objects]
:end-before: # ![2-test_references_and_objects]
@@ -140,6 +156,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [3-test_references_and_objects]
:end-before: # ![3-test_references_and_objects]
@@ -147,6 +164,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [4-test_references_and_objects]
:end-before: # ![4-test_references_and_objects]
@@ -156,6 +174,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [5-test_references_and_objects]
:end-before: # ![5-test_references_and_objects]
@@ -163,6 +182,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [6-test_references_and_objects]
:end-before: # ![6-test_references_and_objects]
@@ -170,6 +190,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [7-test_references_and_objects]
:end-before: # ![7-test_references_and_objects]
@@ -183,6 +204,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [8-test_references_and_objects]
:end-before: # ![8-test_references_and_objects]
@@ -190,6 +212,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [9-test_references_and_objects]
:end-before: # ![9-test_references_and_objects]
@@ -197,6 +220,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [10-test_references_and_objects]
:end-before: # ![10-test_references_and_objects]
@@ -204,6 +228,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [11-test_references_and_objects]
:end-before: # ![11-test_references_and_objects]
@@ -217,6 +242,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [12-test_references_and_objects]
:end-before: # ![12-test_references_and_objects]
@@ -224,6 +250,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [13-test_references_and_objects]
:end-before: # ![13-test_references_and_objects]
@@ -231,6 +258,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [14-test_references_and_objects]
:end-before: # ![14-test_references_and_objects]
@@ -238,6 +266,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [15-test_references_and_objects]
:end-before: # ![15-test_references_and_objects]
@@ -245,6 +274,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [16-test_references_and_objects]
:end-before: # ![16-test_references_and_objects]
@@ -257,6 +287,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [17-test_references_and_objects]
:end-before: # ![17-test_references_and_objects]
@@ -264,6 +295,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [18-test_references_and_objects]
:end-before: # ![18-test_references_and_objects]
@@ -271,6 +303,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [19-test_references_and_objects]
:end-before: # ![19-test_references_and_objects]
@@ -278,6 +311,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [20-test_references_and_objects]
:end-before: # ![20-test_references_and_objects]
@@ -285,6 +319,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [21-test_references_and_objects]
:end-before: # ![21-test_references_and_objects]
@@ -292,6 +327,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [22-test_references_and_objects]
:end-before: # ![22-test_references_and_objects]
@@ -304,6 +340,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [23-test_references_and_objects]
:end-before: # ![23-test_references_and_objects]
@@ -311,6 +348,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [24-test_references_and_objects]
:end-before: # ![24-test_references_and_objects]
@@ -321,6 +359,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [25-test_references_and_objects]
:end-before: # ![25-test_references_and_objects]
@@ -328,6 +367,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [26-test_references_and_objects]
:end-before: # ![26-test_references_and_objects]
@@ -343,7 +383,9 @@
with repo.git.custom_environment(GIT_SSH=ssh_executable):
repo.remotes.origin.fetch()
-Here's an example executable that can be used in place of the `ssh_executable` above::
+Here's an example executable that can be used in place of the `ssh_executable` above:
+
+.. code-block:: shell
#!/bin/sh
ID_RSA=/var/lib/openshift/5562b947ecdd5ce939000038/app-deployments/id_rsa
@@ -359,6 +401,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [1-test_submodules]
:end-before: # ![1-test_submodules]
@@ -383,6 +426,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [27-test_references_and_objects]
:end-before: # ![27-test_references_and_objects]
@@ -390,6 +434,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [28-test_references_and_objects]
:end-before: # ![28-test_references_and_objects]
@@ -413,6 +458,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [29-test_references_and_objects]
:end-before: # ![29-test_references_and_objects]
@@ -420,6 +466,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [30-test_references_and_objects]
:end-before: # ![30-test_references_and_objects]
@@ -430,6 +477,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: def test_add_file_and_commit
:end-before: # ![test_add_file_and_commit]
@@ -441,6 +489,7 @@
.. literalinclude:: ../../git/test/test_docs.py
:language: python
+ :dedent: 8
:start-after: # [31-test_references_and_objects]
:end-before: # ![31-test_references_and_objects]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/__init__.py new/GitPython-2.1.11/git/__init__.py
--- old/GitPython-2.1.9/git/__init__.py 2018-03-24 13:52:04.000000000 +0100
+++ new/GitPython-2.1.11/git/__init__.py 2018-07-15 15:37:41.000000000 +0200
@@ -12,13 +12,13 @@
import os.path as osp
-__version__ = '2.1.9'
+__version__ = '2.1.11'
#{ Initialization
def _init_externals():
"""Initialize external projects by putting them into the path"""
- if __version__ == '2.1.9':
+ if __version__ == '2.1.11':
sys.path.insert(0, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))
try:
@@ -79,5 +79,8 @@
#} END initialize git executable path
#################
-refresh()
+try:
+ refresh()
+except Exception as exc:
+ raise ImportError('Failed to initialize: {0}'.format(exc))
#################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/cmd.py new/GitPython-2.1.11/git/cmd.py
--- old/GitPython-2.1.9/git/cmd.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/cmd.py 2018-05-19 10:49:48.000000000 +0200
@@ -44,10 +44,10 @@
)
-execute_kwargs = {'istream', 'with_extended_output', 'with_exceptions',
- 'as_process', 'stdout_as_string', 'output_stream',
- 'with_stdout', 'kill_after_timeout', 'universal_newlines',
- 'shell', 'env'}
+execute_kwargs = {'istream', 'with_extended_output',
+ 'with_exceptions', 'as_process', 'stdout_as_string',
+ 'output_stream', 'with_stdout', 'kill_after_timeout',
+ 'universal_newlines', 'shell', 'env', 'max_chunk_size'}
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
@@ -174,8 +174,6 @@
dict_to_slots_and__excluded_are_none(self, d, excluded=self._excluded_)
# CONFIGURATION
- # The size in bytes read from stdout when copying git's output to another stream
- max_chunk_size = io.DEFAULT_BUFFER_SIZE
git_exec_name = "git" # default that should work on linux and windows
@@ -597,6 +595,7 @@
universal_newlines=False,
shell=None,
env=None,
+ max_chunk_size=io.DEFAULT_BUFFER_SIZE,
**subprocess_kwargs
):
"""Handles executing the command on the shell and consumes and returns
@@ -642,6 +641,11 @@
:param env:
A dictionary of environment variables to be passed to `subprocess.Popen`.
+
+ :param max_chunk_size:
+ Maximum number of bytes in one chunk of data passed to the output_stream in
+ one invocation of write() method. If the given number is not positive then
+ the default value is used.
:param subprocess_kwargs:
Keyword arguments to be passed to subprocess.Popen. Please note that
@@ -788,7 +792,8 @@
stderr_value = stderr_value[:-1]
status = proc.returncode
else:
- stream_copy(proc.stdout, output_stream, self.max_chunk_size)
+ max_chunk_size = max_chunk_size if max_chunk_size and max_chunk_size > 0 else io.DEFAULT_BUFFER_SIZE
+ stream_copy(proc.stdout, output_stream, max_chunk_size)
stdout_value = output_stream
stderr_value = proc.stderr.read()
# strip trailing "\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/diff.py new/GitPython-2.1.11/git/diff.py
--- old/GitPython-2.1.9/git/diff.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/diff.py 2018-05-19 10:49:48.000000000 +0200
@@ -165,8 +165,9 @@
# A = Added
# D = Deleted
# R = Renamed
- # M = modified
- change_type = ("A", "D", "R", "M")
+ # M = Modified
+ # T = Changed in the type
+ change_type = ("A", "D", "R", "M", "T")
def iter_change_type(self, change_type):
"""
@@ -179,7 +180,9 @@
* 'A' for added paths
* 'D' for deleted paths
* 'R' for renamed paths
- * 'M' for paths with modified data"""
+ * 'M' for paths with modified data
+ * 'T' for changed in the type paths
+ """
if change_type not in self.change_type:
raise ValueError("Invalid change type: %s" % change_type)
@@ -251,11 +254,11 @@
__slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "a_rawpath", "b_rawpath",
"new_file", "deleted_file", "raw_rename_from", "raw_rename_to",
- "diff", "change_type")
+ "diff", "change_type", "score")
def __init__(self, repo, a_rawpath, b_rawpath, a_blob_id, b_blob_id, a_mode,
b_mode, new_file, deleted_file, raw_rename_from,
- raw_rename_to, diff, change_type):
+ raw_rename_to, diff, change_type, score):
self.a_mode = a_mode
self.b_mode = b_mode
@@ -291,6 +294,7 @@
self.diff = diff
self.change_type = change_type
+ self.score = score
def __eq__(self, other):
for name in self.__slots__:
@@ -445,7 +449,7 @@
new_file, deleted_file,
rename_from,
rename_to,
- None, None))
+ None, None, None))
previous_header = header
# end for each header we parse
@@ -470,7 +474,13 @@
return
meta, _, path = line[1:].partition('\t')
- old_mode, new_mode, a_blob_id, b_blob_id, change_type = meta.split(None, 4)
+ old_mode, new_mode, a_blob_id, b_blob_id, _change_type = meta.split(None, 4)
+ # Change type can be R100
+ # R: status letter
+ # 100: score (in case of copy and rename)
+ change_type = _change_type[0]
+ score_str = ''.join(_change_type[1:])
+ score = int(score_str) if score_str.isdigit() else None
path = path.strip()
a_path = path.encode(defenc)
b_path = path.encode(defenc)
@@ -487,15 +497,19 @@
elif change_type == 'A':
a_blob_id = None
new_file = True
- elif change_type[0] == 'R': # parses RXXX, where XXX is a confidence value
+ elif change_type == 'R':
a_path, b_path = path.split('\t', 1)
a_path = a_path.encode(defenc)
b_path = b_path.encode(defenc)
rename_from, rename_to = a_path, b_path
+ elif change_type == 'T':
+ # Nothing to do
+ pass
# END add/remove handling
diff = Diff(repo, a_path, b_path, a_blob_id, b_blob_id, old_mode, new_mode,
- new_file, deleted_file, rename_from, rename_to, '', change_type)
+ new_file, deleted_file, rename_from, rename_to, '',
+ change_type, score)
index.append(diff)
handle_process_output(proc, handle_diff_line, None, finalize_process, decode_streams=False)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/index/base.py new/GitPython-2.1.11/git/index/base.py
--- old/GitPython-2.1.9/git/index/base.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/index/base.py 2018-05-19 10:49:48.000000000 +0200
@@ -561,10 +561,9 @@
return path
if self.repo.bare:
raise InvalidGitRepositoryError("require non-bare repository")
- relative_path = path.replace(self.repo.working_tree_dir + os.sep, "")
- if relative_path == path:
+ if not path.startswith(self.repo.working_tree_dir):
raise ValueError("Absolute path %r is not in git repository at %r" % (path, self.repo.working_tree_dir))
- return relative_path
+ return os.path.relpath(path, self.repo.working_tree_dir)
def _preprocess_add_items(self, items):
""" Split the items into two lists of path strings and BaseEntries. """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/objects/util.py new/GitPython-2.1.11/git/objects/util.py
--- old/GitPython-2.1.9/git/objects/util.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/objects/util.py 2018-05-19 10:49:48.000000000 +0200
@@ -121,8 +121,11 @@
def from_timestamp(timestamp, tz_offset):
"""Converts a timestamp + tz_offset into an aware datetime instance."""
utc_dt = datetime.fromtimestamp(timestamp, utc)
- local_dt = utc_dt.astimezone(tzoffset(tz_offset))
- return local_dt
+ try:
+ local_dt = utc_dt.astimezone(tzoffset(tz_offset))
+ return local_dt
+ except ValueError:
+ return utc_dt
def parse_date(string_date):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/repo/base.py new/GitPython-2.1.11/git/repo/base.py
--- old/GitPython-2.1.9/git/repo/base.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/repo/base.py 2018-07-15 14:44:37.000000000 +0200
@@ -36,6 +36,11 @@
import gc
import gitdb
+try:
+ import pathlib
+except ImportError:
+ pathlib = None
+
log = logging.getLogger(__name__)
@@ -116,6 +121,8 @@
epath = decygpath(epath)
epath = epath or path or os.getcwd()
+ if not isinstance(epath, str):
+ epath = str(epath)
if expand_vars and ("%" in epath or "$" in epath):
warnings.warn("The use of environment variables in paths is deprecated" +
"\nfor security reasons and may be removed in the future!!")
@@ -424,8 +431,7 @@
:param config_level:
For possible values, see config_writer method
If None, all applicable levels will be used. Specify a level in case
- you know which exact file you whish to read to prevent reading multiple files for
- instance
+ you know which file you wish to read to prevent reading multiple files.
:note: On windows, system configuration cannot currently be read as the path is
unknown, instead the global path will be used."""
files = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/test/fixtures/diff_change_in_type new/GitPython-2.1.11/git/test/fixtures/diff_change_in_type
--- old/GitPython-2.1.9/git/test/fixtures/diff_change_in_type 1970-01-01 01:00:00.000000000 +0100
+++ new/GitPython-2.1.11/git/test/fixtures/diff_change_in_type 2018-05-19 10:49:48.000000000 +0200
@@ -0,0 +1,10 @@
+diff --git a/this b/this
+deleted file mode 100644
+index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
+diff --git a/this b/this
+new file mode 120000
+index 0000000000000000000000000000000000000000..42061c01a1c70097d1e4579f29a5adf40abdec95
+--- /dev/null
++++ b/this
+@@ -0,0 +1 @@
++that
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/test/fixtures/diff_change_in_type_raw new/GitPython-2.1.11/git/test/fixtures/diff_change_in_type_raw
--- old/GitPython-2.1.9/git/test/fixtures/diff_change_in_type_raw 1970-01-01 01:00:00.000000000 +0100
+++ new/GitPython-2.1.11/git/test/fixtures/diff_change_in_type_raw 2018-05-19 10:49:48.000000000 +0200
@@ -0,0 +1 @@
+:100644 120000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 42061c01a1c70097d1e4579f29a5adf40abdec95 T this
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/test/test_diff.py new/GitPython-2.1.11/git/test/test_diff.py
--- old/GitPython-2.1.9/git/test/test_diff.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/test/test_diff.py 2018-05-19 10:49:48.000000000 +0200
@@ -108,8 +108,37 @@
self.assertIsNotNone(diff.renamed)
self.assertEqual(diff.rename_from, 'this')
self.assertEqual(diff.rename_to, 'that')
+ self.assertEqual(diff.change_type, 'R')
+ self.assertEqual(diff.score, 100)
self.assertEqual(len(list(diffs.iter_change_type('R'))), 1)
+ def test_diff_with_change_in_type(self):
+ output = StringProcessAdapter(fixture('diff_change_in_type'))
+ diffs = Diff._index_from_patch_format(self.rorepo, output)
+ self._assert_diff_format(diffs)
+ assert_equal(2, len(diffs))
+
+ diff = diffs[0]
+ self.assertIsNotNone(diff.deleted_file)
+ assert_equal(diff.a_path, 'this')
+ assert_equal(diff.b_path, 'this')
+ assert isinstance(str(diff), str)
+
+ diff = diffs[1]
+ assert_equal(diff.a_path, None)
+ assert_equal(diff.b_path, 'this')
+ self.assertIsNotNone(diff.new_file)
+ assert isinstance(str(diff), str)
+
+ output = StringProcessAdapter(fixture('diff_change_in_type_raw'))
+ diffs = Diff._index_from_raw_format(self.rorepo, output)
+ self.assertEqual(len(diffs), 1)
+ diff = diffs[0]
+ self.assertEqual(diff.rename_from, None)
+ self.assertEqual(diff.rename_to, None)
+ self.assertEqual(diff.change_type, 'T')
+ self.assertEqual(len(list(diffs.iter_change_type('T'))), 1)
+
def test_diff_of_modified_files_not_added_to_the_index(self):
output = StringProcessAdapter(fixture('diff_abbrev-40_full-index_M_raw_no-color'))
diffs = Diff._index_from_raw_format(self.rorepo, output)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/test/test_docs.py new/GitPython-2.1.11/git/test/test_docs.py
--- old/GitPython-2.1.9/git/test/test_docs.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/test/test_docs.py 2018-07-15 14:44:37.000000000 +0200
@@ -9,7 +9,7 @@
from git.test.lib import TestBase
from git.test.lib.helper import with_rw_directory
-import os.path as osp
+import os.path
class Tutorials(TestBase):
@@ -25,7 +25,6 @@
def test_init_repo_object(self, rw_dir):
# [1-test_init_repo_object]
from git import Repo
- join = osp.join
# rorepo is a Repo instance pointing to the git-python repository.
# For all you know, the first argument to Repo is a path to the repository
@@ -35,7 +34,7 @@
# ![1-test_init_repo_object]
# [2-test_init_repo_object]
- bare_repo = Repo.init(join(rw_dir, 'bare-repo'), bare=True)
+ bare_repo = Repo.init(os.path.join(rw_dir, 'bare-repo'), bare=True)
assert bare_repo.bare
# ![2-test_init_repo_object]
@@ -52,19 +51,19 @@
# ![4-test_init_repo_object]
# [5-test_init_repo_object]
- cloned_repo = repo.clone(join(rw_dir, 'to/this/path'))
+ cloned_repo = repo.clone(os.path.join(rw_dir, 'to/this/path'))
assert cloned_repo.__class__ is Repo # clone an existing repository
- assert Repo.init(join(rw_dir, 'path/for/new/repo')).__class__ is Repo
+ assert Repo.init(os.path.join(rw_dir, 'path/for/new/repo')).__class__ is Repo
# ![5-test_init_repo_object]
# [6-test_init_repo_object]
- with open(join(rw_dir, 'repo.tar'), 'wb') as fp:
+ with open(os.path.join(rw_dir, 'repo.tar'), 'wb') as fp:
repo.archive(fp)
# ![6-test_init_repo_object]
# repository paths
# [7-test_init_repo_object]
- assert osp.isdir(cloned_repo.working_tree_dir) # directory with your work files
+ assert os.path.isdir(cloned_repo.working_tree_dir) # directory with your work files
assert cloned_repo.git_dir.startswith(cloned_repo.working_tree_dir) # directory containing the git repository
assert bare_repo.working_tree_dir is None # bare repositories have no working tree
# ![7-test_init_repo_object]
@@ -148,7 +147,7 @@
self.assertEqual(new_branch.checkout(), cloned_repo.active_branch) # checking out branch adjusts the wtree
self.assertEqual(new_branch.commit, past.commit) # Now the past is checked out
- new_file_path = osp.join(cloned_repo.working_tree_dir, 'my-new-file')
+ new_file_path = os.path.join(cloned_repo.working_tree_dir, 'my-new-file')
open(new_file_path, 'wb').close() # create new file in working tree
cloned_repo.index.add([new_file_path]) # add it to the index
# Commit the changes to deviate masters history
@@ -164,7 +163,7 @@
# now new_branch is ahead of master, which probably should be checked out and reset softly.
# note that all these operations didn't touch the working tree, as we managed it ourselves.
# This definitely requires you to know what you are doing :) !
- assert osp.basename(new_file_path) in new_branch.commit.tree # new file is now in tree
+ assert os.path.basename(new_file_path) in new_branch.commit.tree # new file is now in tree
master.commit = new_branch.commit # let master point to most recent commit
cloned_repo.head.reference = master # we adjusted just the reference, not the working tree or index
# ![13-test_init_repo_object]
@@ -194,7 +193,7 @@
def test_references_and_objects(self, rw_dir):
# [1-test_references_and_objects]
import git
- repo = git.Repo.clone_from(self._small_repo_url(), osp.join(rw_dir, 'repo'), branch='master')
+ repo = git.Repo.clone_from(self._small_repo_url(), os.path.join(rw_dir, 'repo'), branch='master')
heads = repo.heads
master = heads.master # lists can be accessed by name for convenience
@@ -266,7 +265,7 @@
# [11-test_references_and_objects]
hct.blobs[0].data_stream.read() # stream object to read data from
- hct.blobs[0].stream_data(open(osp.join(rw_dir, 'blob_data'), 'wb')) # write data to given stream
+ hct.blobs[0].stream_data(open(os.path.join(rw_dir, 'blob_data'), 'wb')) # write data to given stream
# ![11-test_references_and_objects]
# [12-test_references_and_objects]
@@ -352,11 +351,11 @@
# Access blob objects
for (path, stage), entry in index.entries.items(): # @UnusedVariable
pass
- new_file_path = osp.join(repo.working_tree_dir, 'new-file-name')
+ new_file_path = os.path.join(repo.working_tree_dir, 'new-file-name')
open(new_file_path, 'w').close()
index.add([new_file_path]) # add a new file to the index
index.remove(['LICENSE']) # remove an existing one
- assert osp.isfile(osp.join(repo.working_tree_dir, 'LICENSE')) # working tree is untouched
+ assert os.path.isfile(os.path.join(repo.working_tree_dir, 'LICENSE')) # working tree is untouched
self.assertEqual(index.commit("my commit message").type, 'commit') # commit changed index
repo.active_branch.commit = repo.commit('HEAD~1') # forget last commit
@@ -375,11 +374,11 @@
# merge two trees three-way into memory
merge_index = IndexFile.from_tree(repo, 'HEAD~10', 'HEAD', repo.merge_base('HEAD~10', 'HEAD'))
# and persist it
- merge_index.write(osp.join(rw_dir, 'merged_index'))
+ merge_index.write(os.path.join(rw_dir, 'merged_index'))
# ![24-test_references_and_objects]
# [25-test_references_and_objects]
- empty_repo = git.Repo.init(osp.join(rw_dir, 'empty'))
+ empty_repo = git.Repo.init(os.path.join(rw_dir, 'empty'))
origin = empty_repo.create_remote('origin', repo.remotes.origin.url)
assert origin.exists()
assert origin == empty_repo.remotes.origin == empty_repo.remotes['origin']
@@ -482,8 +481,8 @@
def test_add_file_and_commit(self, rw_dir):
import git
- repo_dir = osp.join(rw_dir, 'my-new-repo')
- file_name = osp.join(repo_dir, 'new-file')
+ repo_dir = os.path.join(rw_dir, 'my-new-repo')
+ file_name = os.path.join(repo_dir, 'new-file')
r = git.Repo.init(repo_dir)
# This function just creates an empty file ...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/test/test_index.py new/GitPython-2.1.11/git/test/test_index.py
--- old/GitPython-2.1.9/git/test/test_index.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/test/test_index.py 2018-05-19 10:49:48.000000000 +0200
@@ -838,6 +838,21 @@
r.index.add([fp])
r.index.commit('Added [.exe')
+ def test__to_relative_path_at_root(self):
+ root = osp.abspath(os.sep)
+
+ class Mocked(object):
+ bare = False
+ git_dir = root
+ working_tree_dir = root
+
+ repo = Mocked()
+ path = os.path.join(root, 'file')
+ index = IndexFile(repo)
+
+ rel = index._to_relative_path(path)
+ self.assertEqual(rel, os.path.relpath(path, root))
+
@with_rw_repo('HEAD', bare=True)
def test_pre_commit_hook_success(self, rw_repo):
index = rw_repo.index
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/test/test_repo.py new/GitPython-2.1.11/git/test/test_repo.py
--- old/GitPython-2.1.9/git/test/test_repo.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/test/test_repo.py 2018-07-15 14:44:37.000000000 +0200
@@ -5,6 +5,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import glob
+import io
from io import BytesIO
import itertools
import os
@@ -109,6 +110,14 @@
assert not rw_repo.git.working_dir.endswith('.git')
self.assertEqual(r_from_gitdir.git.working_dir, rw_repo.git.working_dir)
+ @with_rw_repo('0.3.2.1')
+ def test_repo_creation_pathlib(self, rw_repo):
+ if pathlib is None: # pythons bellow 3.4 don't have pathlib
+ raise SkipTest("pathlib was introduced in 3.4")
+
+ r_from_gitdir = Repo(pathlib.Path(rw_repo.git_dir))
+ self.assertEqual(r_from_gitdir.git_dir, rw_repo.git_dir)
+
def test_description(self):
txt = "Test repository"
self.rorepo.description = txt
@@ -220,6 +229,22 @@
Repo.clone_from(original_repo.git_dir, pathlib.Path(rw_dir) / "clone_pathlib")
+ @with_rw_repo('HEAD')
+ def test_max_chunk_size(self, repo):
+ class TestOutputStream(object):
+ def __init__(self, max_chunk_size):
+ self.max_chunk_size = max_chunk_size
+
+ def write(self, b):
+ assert_true(len(b) <= self.max_chunk_size)
+
+ for chunk_size in [16, 128, 1024]:
+ repo.git.status(output_stream=TestOutputStream(chunk_size), max_chunk_size=chunk_size)
+
+ repo.git.log(n=100, output_stream=TestOutputStream(io.DEFAULT_BUFFER_SIZE), max_chunk_size=None)
+ repo.git.log(n=100, output_stream=TestOutputStream(io.DEFAULT_BUFFER_SIZE), max_chunk_size=-10)
+ repo.git.log(n=100, output_stream=TestOutputStream(io.DEFAULT_BUFFER_SIZE))
+
def test_init(self):
prev_cwd = os.getcwd()
os.chdir(tempfile.gettempdir())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GitPython-2.1.9/git/test/test_util.py new/GitPython-2.1.11/git/test/test_util.py
--- old/GitPython-2.1.9/git/test/test_util.py 2018-03-24 13:45:37.000000000 +0100
+++ new/GitPython-2.1.11/git/test/test_util.py 2018-05-19 10:49:48.000000000 +0200
@@ -7,7 +7,7 @@
import tempfile
import time
from unittest import skipIf
-
+from datetime import datetime
import ddt
@@ -18,7 +18,8 @@
utctz_to_altz,
verify_utctz,
parse_date,
-)
+ tzoffset,
+ from_timestamp)
from git.test.lib import (
TestBase,
assert_equal
@@ -260,3 +261,16 @@
self.failUnlessRaises(IndexError, ilist.__delitem__, 0)
self.failUnlessRaises(IndexError, ilist.__delitem__, 'something')
+
+ def test_from_timestamp(self):
+ # Correct offset: UTC+2, should return datetime + tzoffset(+2)
+ altz = utctz_to_altz('+0200')
+ self.assertEqual(datetime.fromtimestamp(1522827734, tzoffset(altz)), from_timestamp(1522827734, altz))
+
+ # Wrong offset: UTC+58, should return datetime + tzoffset(UTC)
+ altz = utctz_to_altz('+5800')
+ self.assertEqual(datetime.fromtimestamp(1522827734, tzoffset(0)), from_timestamp(1522827734, altz))
+
+ # Wrong offset: UTC-9000, should return datetime + tzoffset(UTC)
+ altz = utctz_to_altz('-9000')
+ self.assertEqual(datetime.fromtimestamp(1522827734, tzoffset(0)), from_timestamp(1522827734, altz))