'Select the parent with the oldest generation number'

def select_oldest_parent(self):

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