Is there any agreement for the order of parental fixators?
Since one of the parent-latches must be associated with the previous commit of the current branch, which is merged, and the rest are previous commits of other merging branches.
I would like to identify the previous commit of the current branch , I use pygit , which returns a list of parents for the commit, and intuitively I thought that maybe the order of the parents matters, but I did not find an explicit mention of this.
I wrote this utility function using the first parent commit to branch into:
def walk_branch(pygit_repository, branch_oid): """ Walk a single branch """ from pygit2 import GIT_SORT_TOPOLOGICAL previous_first_parent_oid = None for commit in pygit_repository.walk(branch_oid, GIT_SORT_TOPOLOGICAL): if previous_first_parent_oid is None or commit.oid == previous_first_parent_oid: previous_first_parent_oid = commit.parents[0].oid if len(commit.parents) else None yield commit
source share