Skip to content

Commit 1116ef7

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents b4b5ecc + a4ad7ce commit 1116ef7

File tree

11 files changed

+45
-21
lines changed

11 files changed

+45
-21
lines changed

README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ The list of dependencies are listed in `./requirements.txt` and `./test-requirem
1818

1919
### INSTALL
2020

21-
[![Latest Version](https://pypip.in/version/GitPython/badge.svg)](https://pypi.python.org/pypi/GitPython/)
22-
[![Supported Python Versions](https://pypip.in/py_versions/GitPython/badge.svg)](https://pypi.python.org/pypi/GitPython/)
23-
2421
If you have downloaded the source code:
2522

2623
python setup.py install
@@ -101,8 +98,6 @@ New BSD License. See the LICENSE file.
10198
[![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg)](https://travis-ci.org/gitpython-developers/GitPython)
10299
[![Code Climate](https://codeclimate.com/github/gitpython-developers/GitPython/badges/gpa.svg)](https://codeclimate.com/github/gitpython-developers/GitPython)
103100
[![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable)
104-
[![Issue Stats](http://www.issuestats.com/github/gitpython-developers/GitPython/badge/pr)](http://www.issuestats.com/github/gitpython-developers/GitPython)
105-
[![Issue Stats](http://www.issuestats.com/github/gitpython-developers/GitPython/badge/issue)](http://www.issuestats.com/github/gitpython-developers/GitPython)
106101

107102
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
108103

@@ -111,4 +106,4 @@ Now that there seems to be a massive user base, this should be motivation enough
111106

112107
[twitch-channel]: http://www.twitch.tv/byronimo/profile
113108
[youtube-playlist]: https://www.youtube.com/playlist?list=PLMHbQxe1e9MnoEcLhn6Yhv5KAvpWkJbL0
114-
[contributing]: https://github.com/gitpython-developers/GitPython/blob/master/README.md
109+
[contributing]: https://github.com/gitpython-developers/GitPython/blob/master/README.md

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.7dev0
1+
2.0.8dev0

doc/source/changes.rst

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
Changelog
33
=========
44

5+
2.0.8 - Bugfixes
6+
================
7+
8+
* `DiffIndex.iter_change_type(...)` produces better results when diffing
9+
an index against the working tree.
10+
11+
2.0.7 - New Features
12+
====================
13+
14+
* `IndexFile.commit(...,skip_hooks=False)` added. This parameter emulates the
15+
behaviour of `--no-verify` on the command-line.
16+
517
2.0.6 - Fixes and Features
618
==========================
719

doc/source/tutorial.rst

+7-2
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,13 @@ Using environment variables, you can further adjust the behaviour of the git com
474474

475475
* **GIT_PYTHON_TRACE**
476476

477-
* If set to non-0, all executed git commands will be logged using a python logger.
478-
* if set to *full*, the executed git command and its output on stdout and stderr will be logged using a python logger.
477+
* If set to non-0, all executed git commands will be shown as they happen
478+
* If set to *full*, the executed git command _and_ its entire output on stdout and stderr will be shown as they happen
479+
480+
**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::
481+
482+
import logging
483+
logging.basicConfig(level=logging.INFO)
479484
480485
* **GIT_PYTHON_GIT_EXECUTABLE**
481486

git/diff.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ def iter_change_type(self, change_type):
183183
raise ValueError("Invalid change type: %s" % change_type)
184184

185185
for diff in self:
186-
if change_type == "A" and diff.new_file:
186+
if diff.change_type == change_type:
187+
yield diff
188+
elif change_type == "A" and diff.new_file:
187189
yield diff
188190
elif change_type == "D" and diff.deleted_file:
189191
yield diff
@@ -247,11 +249,12 @@ class Diff(object):
247249
NULL_BIN_SHA = b"\0" * 20
248250

249251
__slots__ = ("a_blob", "b_blob", "a_mode", "b_mode", "a_rawpath", "b_rawpath",
250-
"new_file", "deleted_file", "raw_rename_from", "raw_rename_to", "diff")
252+
"new_file", "deleted_file", "raw_rename_from", "raw_rename_to",
253+
"diff", "change_type")
251254

252255
def __init__(self, repo, a_rawpath, b_rawpath, a_blob_id, b_blob_id, a_mode,
253256
b_mode, new_file, deleted_file, raw_rename_from,
254-
raw_rename_to, diff):
257+
raw_rename_to, diff, change_type):
255258

256259
self.a_mode = a_mode
257260
self.b_mode = b_mode
@@ -286,6 +289,7 @@ def __init__(self, repo, a_rawpath, b_rawpath, a_blob_id, b_blob_id, a_mode,
286289
self.raw_rename_to = raw_rename_to or None
287290

288291
self.diff = diff
292+
self.change_type = change_type
289293

290294
def __eq__(self, other):
291295
for name in self.__slots__:
@@ -435,7 +439,7 @@ def _index_from_patch_format(cls, repo, stream):
435439
new_file, deleted_file,
436440
rename_from,
437441
rename_to,
438-
None))
442+
None, None))
439443

440444
previous_header = header
441445
# end for each header we parse
@@ -483,7 +487,7 @@ def _index_from_raw_format(cls, repo, stream):
483487
# END add/remove handling
484488

485489
diff = Diff(repo, a_path, b_path, a_blob_id, b_blob_id, old_mode, new_mode,
486-
new_file, deleted_file, rename_from, rename_to, '')
490+
new_file, deleted_file, rename_from, rename_to, '', change_type)
487491
index.append(diff)
488492
# END for each line
489493

git/ext/gitdb

git/refs/symbolic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def set_reference(self, ref, logmsg=None):
313313

314314
lfd = LockedFD(fpath)
315315
fd = lfd.open(write=True, stream=True)
316-
fd.write(write_value.encode('ascii'))
316+
fd.write(write_value.encode('ascii') + b'\n')
317317
lfd.commit()
318318

319319
# Adjust the reflog

git/repo/base.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,7 @@ def blame_incremental(self, rev, file, **kwargs):
714714
authored_date=int(props[b'author-time']),
715715
committer=Actor(safe_decode(props[b'committer']),
716716
safe_decode(props[b'committer-mail'].lstrip(b'<').rstrip(b'>'))),
717-
committed_date=int(props[b'committer-time']),
718-
message=safe_decode(props[b'summary']))
717+
committed_date=int(props[b'committer-time']))
719718
commits[hexsha] = c
720719
else:
721720
# Discard the next line (it's a filename end tag)
@@ -815,8 +814,7 @@ def blame(self, rev, file, incremental=False, **kwargs):
815814
authored_date=info['author_date'],
816815
committer=Actor._from_string(
817816
info['committer'] + ' ' + info['committer_email']),
818-
committed_date=info['committer_date'],
819-
message=info['summary'])
817+
committed_date=info['committer_date'])
820818
commits[sha] = c
821819
# END if commit objects needs initial creation
822820
if not is_binary:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:100644 100644 739bc65220ad90e9ebfa2d6af1723b97555569a4 0000000000000000000000000000000000000000 M README.md

git/test/test_diff.py

+9
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ def test_diff_with_rename(self):
104104
assert diff.rename_to == 'that'
105105
assert len(list(diffs.iter_change_type('R'))) == 1
106106

107+
def test_diff_of_modified_files_not_added_to_the_index(self):
108+
output = StringProcessAdapter(fixture('diff_abbrev-40_full-index_M_raw_no-color'))
109+
diffs = Diff._index_from_raw_format(self.rorepo, output.stdout)
110+
111+
assert len(diffs) == 1, 'one modification'
112+
assert len(list(diffs.iter_change_type('M'))) == 1, 'one modification'
113+
assert diffs[0].change_type == 'M'
114+
assert diffs[0].b_blob is None
115+
107116
def test_binary_diff(self):
108117
for method, file_name in ((Diff._index_from_patch_format, 'diff_patch_binary'),
109118
(Diff._index_from_raw_format, 'diff_raw_binary')):

git/test/test_repo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def test_should_display_blame_information(self, git):
307307
assert_equal('Tom Preston-Werner', c.committer.name)
308308
assert_equal('[email protected]', c.committer.email)
309309
assert_equal(1191997100, c.committed_date)
310-
assert_equal('initial grit setup', c.message)
310+
self.assertRaisesRegexp(ValueError, "634396b2f541a9f2d58b00be1a07f0c358b999b3 missing", lambda: c.message)
311311

312312
# test the 'lines per commit' entries
313313
tlist = b[0][1]

0 commit comments

Comments
 (0)