← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~ines-almeida/turnip:return-merge-commit-already-merged into turnip:master

 

Looks good to me but left a question as I'm not familiar to this.

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:

I don't get this `if` logic, can you describe it to me please? Why is it enough to have more than 1 commit parent and one of them being the source_tip?

> +            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