From 49a9f84461fa907da786e91e1a8c29d38cdb70eb Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 17 Jul 2016 10:04:16 +0200 Subject: chore(version-up): v2.0.7 --- VERSION | 2 +- doc/source/changes.rst | 6 ++++++ git/ext/gitdb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 2c403d06..f1547e6d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.7dev0 +2.0.7 diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 428fa2b4..b17e7592 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ========= +2.0.7 - New Features +==================== + +* `IndexFile.commit(...,skip_hooks=False)` added. This parameter emulates the + behaviour of `--no-verify` on the command-line. + 2.0.6 - Fixes and Features ========================== diff --git a/git/ext/gitdb b/git/ext/gitdb index d1996e04..2389b752 160000 --- a/git/ext/gitdb +++ b/git/ext/gitdb @@ -1 +1 @@ -Subproject commit d1996e04dbf4841b853b60c1365f0f5fd28d170c +Subproject commit 2389b75280efb1a63e6ea578eae7f897fd4beb1b -- cgit v1.2.1 From 0ed3cd7f798057c02799b6046987ed6a2e313126 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 17 Jul 2016 10:14:49 +0200 Subject: chore(version): set dev version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f1547e6d..f752945d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.7 +2.0.8dev0 -- cgit v1.2.1 From 2ff3a3e72b1ff79e75777ccdddc86f8540ce833d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 17 Jul 2016 10:31:53 +0200 Subject: fix(blame): lazily fetch full commit message That way, we will not only get the summary line contained in the blame, but fetch the full message. This is more costly than the previous implementation allowed it to be, but being less surprising/correct certainly is the preferred behaviour here. Fixes #485 --- git/repo/base.py | 6 ++---- git/test/test_repo.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/git/repo/base.py b/git/repo/base.py index 282dfc15..61864060 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -714,8 +714,7 @@ class Repo(object): authored_date=int(props[b'author-time']), committer=Actor(safe_decode(props[b'committer']), safe_decode(props[b'committer-mail'].lstrip(b'<').rstrip(b'>'))), - committed_date=int(props[b'committer-time']), - message=safe_decode(props[b'summary'])) + committed_date=int(props[b'committer-time'])) commits[hexsha] = c else: # Discard the next line (it's a filename end tag) @@ -815,8 +814,7 @@ class Repo(object): authored_date=info['author_date'], committer=Actor._from_string( info['committer'] + ' ' + info['committer_email']), - committed_date=info['committer_date'], - message=info['summary']) + committed_date=info['committer_date']) commits[sha] = c # END if commit objects needs initial creation if not is_binary: diff --git a/git/test/test_repo.py b/git/test/test_repo.py index fc8125fa..87887bad 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -307,7 +307,7 @@ class TestRepo(TestBase): assert_equal('Tom Preston-Werner', c.committer.name) assert_equal('tom@mojombo.com', c.committer.email) assert_equal(1191997100, c.committed_date) - assert_equal('initial grit setup', c.message) + self.assertRaisesRegexp(ValueError, "634396b2f541a9f2d58b00be1a07f0c358b999b3 missing", lambda: c.message) # test the 'lines per commit' entries tlist = b[0][1] -- cgit v1.2.1 From a5e6676db845e10bdca47c3fcf8dca9dea75ec42 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Mon, 18 Jul 2016 09:20:10 +0200 Subject: Update tutorial This mentions the instructions of what was discussed in #489. --- doc/source/tutorial.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/source/tutorial.rst b/doc/source/tutorial.rst index b0ef273d..92020975 100644 --- a/doc/source/tutorial.rst +++ b/doc/source/tutorial.rst @@ -474,8 +474,13 @@ Using environment variables, you can further adjust the behaviour of the git com * **GIT_PYTHON_TRACE** - * If set to non-0, all executed git commands will be logged using a python logger. - * if set to *full*, the executed git command and its output on stdout and stderr will be logged using a python logger. + * If set to non-0, all executed git commands will be shown as they happen + * If set to *full*, the executed git command _and_ its entire output on stdout and stderr will be shown as they happen + + **NOTE**: All logging is outputted using a Python logger, so make sure your program is configured to show INFO-level messages. If this is not the case, try adding the following to your program:: + + import logging + logging.basicConfig(level=logging.INFO) * **GIT_PYTHON_GIT_EXECUTABLE** -- cgit v1.2.1 From cee0cec2d4a27bbc7af10b91a1ad39d735558798 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Tue, 19 Jul 2016 08:38:02 +0200 Subject: Add missing newline when writing a symbolic ref. --- git/refs/symbolic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index ae67a7ee..d00ef617 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -313,7 +313,7 @@ class SymbolicReference(object): lfd = LockedFD(fpath) fd = lfd.open(write=True, stream=True) - fd.write(write_value.encode('ascii')) + fd.write(write_value.encode('ascii') + '\n') lfd.commit() # Adjust the reflog -- cgit v1.2.1 From b827f8162f61285754202bec8494192bc229f75a Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Tue, 19 Jul 2016 09:17:51 +0200 Subject: Use binary string constant for concatenation. --- git/refs/symbolic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index d00ef617..ec2944c6 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -313,7 +313,7 @@ class SymbolicReference(object): lfd = LockedFD(fpath) fd = lfd.open(write=True, stream=True) - fd.write(write_value.encode('ascii') + '\n') + fd.write(write_value.encode('ascii') + b'\n') lfd.commit() # Adjust the reflog -- cgit v1.2.1 From 1ec4389bc3d1653af301e93fe0a6b25a31da9f3d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 23 Jul 2016 16:19:50 +0200 Subject: doc(README): remove issue stats They do not get updated for some reason, generally the site is not quite production ready it seems, or is by now overwhelmed. [skip ci] --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 85983f0d..739bc652 100644 --- a/README.md +++ b/README.md @@ -101,8 +101,6 @@ New BSD License. See the LICENSE file. [![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg)](https://travis-ci.org/gitpython-developers/GitPython) [![Code Climate](https://codeclimate.com/github/gitpython-developers/GitPython/badges/gpa.svg)](https://codeclimate.com/github/gitpython-developers/GitPython) [![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable) -[![Issue Stats](http://www.issuestats.com/github/gitpython-developers/GitPython/badge/pr)](http://www.issuestats.com/github/gitpython-developers/GitPython) -[![Issue Stats](http://www.issuestats.com/github/gitpython-developers/GitPython/badge/issue)](http://www.issuestats.com/github/gitpython-developers/GitPython) 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 @@ -111,4 +109,4 @@ Now that there seems to be a massive user base, this should be motivation enough [twitch-channel]: http://www.twitch.tv/byronimo/profile [youtube-playlist]: https://www.youtube.com/playlist?list=PLMHbQxe1e9MnoEcLhn6Yhv5KAvpWkJbL0 -[contributing]: https://github.com/gitpython-developers/GitPython/blob/master/README.md \ No newline at end of file +[contributing]: https://github.com/gitpython-developers/GitPython/blob/master/README.md -- cgit v1.2.1 From 4006c4347788a078051dffd6b197bb0f19d50b86 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 23 Jul 2016 16:38:59 +0200 Subject: fix(diff): use explicit change-type if possible That way, we do not have to figure the change type out by examining the diff object. It's implemented in a way that should yield more desireable results as we keep the change-type that git is providing us with. Fixes #493 --- doc/source/changes.rst | 6 ++++++ git/diff.py | 14 +++++++++----- git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color | 1 + git/test/test_diff.py | 9 +++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color diff --git a/doc/source/changes.rst b/doc/source/changes.rst index b17e7592..9f8ebb51 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -2,6 +2,12 @@ Changelog ========= +2.0.8 - Bugfixes +================ + +* `DiffIndex.iter_change_type(...)` produces better results when diffing + an index against the working tree. + 2.0.7 - New Features ==================== diff --git a/git/diff.py b/git/diff.py index 06193920..fb8faaf6 100644 --- a/git/diff.py +++ b/git/diff.py @@ -183,7 +183,9 @@ class DiffIndex(list): raise ValueError("Invalid change type: %s" % change_type) for diff in self: - if change_type == "A" and diff.new_file: + if diff.change_type == change_type: + yield diff + elif change_type == "A" and diff.new_file: yield diff elif change_type == "D" and diff.deleted_file: yield diff @@ -247,11 +249,12 @@ class Diff(object): NULL_BIN_SHA = b"\0" * 20 __slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "a_rawpath", "b_rawpath", - "new_file", "deleted_file", "raw_rename_from", "raw_rename_to", "diff") + "new_file", "deleted_file", "raw_rename_from", "raw_rename_to", + "diff", "change_type") 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): + raw_rename_to, diff, change_type): self.a_mode = a_mode self.b_mode = b_mode @@ -286,6 +289,7 @@ class Diff(object): self.raw_rename_to = raw_rename_to or None self.diff = diff + self.change_type = change_type def __eq__(self, other): for name in self.__slots__: @@ -435,7 +439,7 @@ class Diff(object): new_file, deleted_file, rename_from, rename_to, - None)) + None, None)) previous_header = header # end for each header we parse @@ -483,7 +487,7 @@ class Diff(object): # 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, '') + new_file, deleted_file, rename_from, rename_to, '', change_type) index.append(diff) # END for each line diff --git a/git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color b/git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color new file mode 100644 index 00000000..dad85c68 --- /dev/null +++ b/git/test/fixtures/diff_abbrev-40_full-index_M_raw_no-color @@ -0,0 +1 @@ +:100644 100644 739bc65220ad90e9ebfa2d6af1723b97555569a4 0000000000000000000000000000000000000000 M README.md diff --git a/git/test/test_diff.py b/git/test/test_diff.py index ba0d2d13..9fdb26a2 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -104,6 +104,15 @@ class TestDiff(TestBase): assert diff.rename_to == 'that' assert len(list(diffs.iter_change_type('R'))) == 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.stdout) + + assert len(diffs) == 1, 'one modification' + assert len(list(diffs.iter_change_type('M'))) == 1, 'one modification' + assert diffs[0].change_type == 'M' + assert diffs[0].b_blob is None + def test_binary_diff(self): for method, file_name in ((Diff._index_from_patch_format, 'diff_patch_binary'), (Diff._index_from_raw_format, 'diff_raw_binary')): -- cgit v1.2.1 From 788bd7e55085cdb57bce1cabf1d68c172c53f935 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 23 Jul 2016 16:52:08 +0200 Subject: doc(README): remove pypi badges They don't seem to work anymore. [skip ci] --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 739bc652..ad2aa4fc 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,6 @@ The list of dependencies are listed in `./requirements.txt` and `./test-requirem ### INSTALL -[![Latest Version](https://pypip.in/version/GitPython/badge.svg)](https://pypi.python.org/pypi/GitPython/) -[![Supported Python Versions](https://pypip.in/py_versions/GitPython/badge.svg)](https://pypi.python.org/pypi/GitPython/) - If you have downloaded the source code: python setup.py install -- cgit v1.2.1