'Select the parent with the newest generation number'

def select_parent(self):

    selected_item = self.selected_item()
    if (selected_item is None):
        return
    parent_item = self.newest_item(selected_item.commit.parents)
    if (parent_item is None):
        return
    selected_item.setSelected(False)
    parent_item.setSelected(True)
    self.ensureVisible(parent_item.mapRectToScene(parent_item.boundingRect()))
