|
8 | 8 | Actor, |
9 | 9 | Iterable, |
10 | 10 | Stats, |
| 11 | + finalize_process |
11 | 12 | ) |
12 | 13 | from git.diff import Diffable |
13 | 14 | from tree import Tree |
@@ -65,7 +66,6 @@ def __init__(self, repo, binsha, tree=None, author=None, authored_date=None, aut |
65 | 66 | message=None, parents=None, encoding=None, gpgsig=None): |
66 | 67 | """Instantiate a new Commit. All keyword arguments taking None as default will |
67 | 68 | be implicitly set on first query. |
68 | | -
|
69 | 69 | :param binsha: 20 byte sha1 |
70 | 70 | :param parents: tuple( Commit, ... ) |
71 | 71 | is a tuple of commit ids or actual Commits |
@@ -252,6 +252,10 @@ def _iter_from_process_or_stream(cls, repo, proc_or_stream): |
252 | 252 | assert len(hexsha) == 40, "Invalid line: %s" % hexsha |
253 | 253 | yield Commit(repo, hex_to_bin(hexsha)) |
254 | 254 | # END for each line in stream |
| 255 | + # TODO: Review this - it seems process handling got a bit out of control |
| 256 | + # due to many developers trying to fix the open file handles issue |
| 257 | + if hasattr(proc_or_stream, 'wait'): |
| 258 | + finalize_process(proc_or_stream) |
255 | 259 |
|
256 | 260 |
|
257 | 261 | @classmethod |
@@ -430,14 +434,21 @@ def _deserialize(self, stream): |
430 | 434 |
|
431 | 435 | self.author, self.authored_date, self.author_tz_offset = parse_actor_and_date(next_line) |
432 | 436 | self.committer, self.committed_date, self.committer_tz_offset = parse_actor_and_date(readline()) |
433 | | - |
| 437 | + |
| 438 | + # we might run into one or more mergetag blocks, skip those for now |
| 439 | + next_line = readline() |
| 440 | + while next_line.startswith('mergetag '): |
| 441 | + next_line = readline() |
| 442 | + while next_line.startswith(' '): |
| 443 | + next_line = readline() |
434 | 444 |
|
435 | 445 | # now we can have the encoding line, or an empty line followed by the optional |
436 | 446 | # message. |
437 | 447 | self.encoding = self.default_encoding |
438 | 448 |
|
439 | 449 | # read headers |
440 | | - buf = readline().strip() |
| 450 | + enc = next_line |
| 451 | + buf = enc.strip() |
441 | 452 | while buf != "": |
442 | 453 | if buf[0:10] == "encoding ": |
443 | 454 | self.encoding = buf[buf.find(' ')+1:] |
|
0 commit comments