'Create edges linking commits with their parents'

def link(self, commits):

    scene = self.scene()
    for commit in commits:
        try:
            commit_item = self.items[commit.oid]
        except KeyError:
            continue
        for parent in reversed(commit.parents):
            try:
                parent_item = self.items[parent.oid]
            except KeyError:
                continue
            try:
                edge = parent_item.edges[commit.oid]
            except KeyError:
                edge = Edge(parent_item, commit_item)
            else:
                continue
            parent_item.edges[commit.oid] = edge
            commit_item.edges[parent.oid] = edge
            scene.addItem(edge)
