# Path: ellen/utils/format.py
# def format_commit(commit, repository):
#     d = {}
#     d['type'] = 'commit'
#     # FIXME: use parents
#     try:
#         d['parent'] = [str(p.id) for p in commit.parents] if commit.parents else []
#         d['parents'] = [str(p.id) for p in commit.parents] if commit.parents else []
#     except KeyError:
#         # FIXME: pygit2 commit.parents
#         d['parent'] = []
#         d['parents'] = []
#     d['tree'] = str(commit.tree.id)
#     d['committer'] = _format_pygit2_signature(commit.committer)
#     d['author'] = _format_pygit2_signature(commit.author)
#     d['email'] = commit.author.email  # FIXME
#     d['commit'] = str(commit.id)  # FIXME
#     d['message'], _, d['body'] = commit.message.strip().partition('\n\n')
#     d['sha'] = str(commit.id)
#     return d


from pygit2 import GIT_OBJ_TAG
from pygit2 import GIT_SORT_TIME
from pygit2 import GIT_SORT_TOPOLOGICAL
from ellen.utils.format import format_commit
        except (KeyError, ValueError):
            from_commit = None

    if max_count:
        length = max_count + skip if skip else max_count
    else:
        length = 0
    for c in walker:
        if all([_check_author(c, author),
                _check_file_change(c, path),
                _check_message(c, query),
                _check_date(c, since),
                _check_no_merges(c, no_merges)]):
            index = c.hex
            if first_parent:
                if next_commit and next_commit.hex != c.hex:
                    continue
                if len(c.parents) == 0:
                    next_commit = None
                elif len(c.parents) >= 1:
                    next_commit = c.parents[0]
                else:
                    continue
            if index not in commits_index_list:
                commits_index_list.append(index)
            commits_dict[index] = c
        if length and len(commits_index_list) >= length:
            break
    if skip:
        commits_index_list = commits_index_list[skip:]

# Path: ellen/utils/format.py
# def format_commit(commit, repository):
#     d = {}
#     d['type'] = 'commit'
#     # FIXME: use parents
#     try:
#         d['parent'] = [str(p.id) for p in commit.parents] if commit.parents else []
#         d['parents'] = [str(p.id) for p in commit.parents] if commit.parents else []
#     except KeyError:
#         # FIXME: pygit2 commit.parents
#         d['parent'] = []
#         d['parents'] = []
#     d['tree'] = str(commit.tree.id)
#     d['committer'] = _format_pygit2_signature(commit.committer)
#     d['author'] = _format_pygit2_signature(commit.author)
#     d['email'] = commit.author.email  # FIXME
#     d['commit'] = str(commit.id)  # FIXME
#     d['message'], _, d['body'] = commit.message.strip().partition('\n\n')
#     d['sha'] = str(commit.id)
#     return d


# Path: ellen/git/rev_list.py
from pygit2 import GIT_OBJ_TAG
from pygit2 import GIT_SORT_TIME
from pygit2 import GIT_SORT_TOPOLOGICAL
from ellen.utils.format import format_commit

        except (KeyError, ValueError):
            from_commit = None

    if max_count:
        length = max_count + skip if skip else max_count
    else:
        length = 0
    for c in walker:
        if all([_check_author(c, author),
                _check_file_change(c, path),
                _check_message(c, query),
                _check_date(c, since),
                _check_no_merges(c, no_merges)]):
            index = c.hex
            if first_parent:
                if next_commit and next_commit.hex != c.hex:
                    continue
                if len(c.parents) == 0:
                    next_commit = None
                elif len(c.parents) >= 1:
                    next_commit = c.parents[0]
                else:
                    continue
            if index not in commits_index_list:
                commits_index_list.append(index)
            commits_dict[index] = c
        if length and len(commits_index_list) >= length:
            break
    if skip:
        commits_index_list = commits_index_list[skip:]

    return [format_commit(commits_dict[i], repository)