Example #1
0
def revision_to_commit(rev, mapping, tree_sha):
    """
    Turn a Bazaar revision in to a Git commit
    :param tree_sha: HACK parameter (until we can retrieve this from the mapping)
    :return dulwich.objects.Commit represent the revision:
    """
    commit = Commit()
    commit._tree = tree_sha
    for p in rev.parent_ids:
        commit._parents.append(mapping.revision_id_bzr_to_foreign(p))
    commit._message = rev.message
    commit._committer = rev.committer
    if 'author' in rev.properties:
        commit._author = rev.properties['author']
    else:
        commit._author = rev.committer
    commit._commit_time = long(rev.timestamp)
    commit.serialize()
    return commit
Example #2
0
def revision_to_commit(rev, mapping, tree_sha):
    """
    Turn a Bazaar revision in to a Git commit
    :param tree_sha: HACK parameter (until we can retrieve this from the mapping)
    :return dulwich.objects.Commit represent the revision:
    """
    commit = Commit()
    commit._tree = tree_sha
    for p in rev.parent_ids:
        commit._parents.append(mapping.revision_id_bzr_to_foreign(p))
    commit._message = rev.message
    commit._committer = rev.committer
    if 'author' in rev.properties:
        commit._author = rev.properties['author']
    else:
        commit._author = rev.committer
    commit._commit_time = long(rev.timestamp)
    commit.serialize()
    return commit