launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #32690
Re: [Merge] ~ines-almeida/turnip:return-merge-commit-already-merged into turnip:master
Diff comments:
> diff --git a/turnip/api/store.py b/turnip/api/store.py
> index b2c4320..6b22b61 100644
> --- a/turnip/api/store.py
> +++ b/turnip/api/store.py
> @@ -819,6 +819,21 @@ def _get_remote_source_tip(
> repo.references.delete(source_ref_name)
>
>
> +def _find_merge_commit(repo, target_tip, source_tip):
> + """Find the merge commit that has source_tip as one of its parents"""
> + walker = repo.walk(target_tip, GIT_SORT_TOPOLOGICAL)
> +
> + for i, commit in enumerate(walker):
> + # Limit search depth
> + if i >= 100:
> + break
> +
> + if len(commit.parents) > 1 and source_tip in commit.parent_ids:
Sure!
If you look at a commit graph, you will notice that each commit will have a "parent" (the commit that came before). Merge commits will have more than 1 parent since they are merging 2 commits. So this is just iterating over all merge commits, and get the one where one of the parents is the source_tip, meaning that that merge commit is the one that merged the source tip commit into the current branch
> + return commit.hex
> +
> + return None
> +
> +
> def merge(
> repo_store,
> repo_name,
--
https://code.launchpad.net/~ines-almeida/turnip/+git/turnip/+merge/488417
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/turnip:return-merge-commit-already-merged into turnip:master.
References