[PATCH] dim: check pull request baselines

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Tue Feb 19 14:37:42 UTC 2019


Quoting Daniel Vetter (2019-02-19 15:04:12)
> We want explicit backmerges when a pull request pulls in random other
> stuff. Motivated by a few recent examples.
> 
> Cc: Maxime Ripard <maxime.ripard at bootlin.com>
> Cc: Dave Airlie <airlied at linux.ie>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas

> ---
>  dim | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/dim b/dim
> index 06188fea94c6..016cd4381f38 100755
> --- a/dim
> +++ b/dim
> @@ -1048,6 +1048,23 @@ function apply_patch #patch_file
>         return $rv
>  }
>  
> +function check_merge_baseline
> +{
> +       local pull_sha1 baseline_sha1 upstream_sha1
> +       pull_sha1=$1
> +       baseline_sha1=$2
> +       upstream_sha1=$3
> +
> +       # the merge base between the pull and upstream is supposed to be in our
> +       # tree already
> +       if ! git merge-base --is-ancestor $(git merge-base $pull_sha1 $upstream_sha1) $baseline_sha1 ; then
> +               echoerr "Pull request contains commits from $upstream_sha1"
> +               echoerr "Please backmerge first"
> +
> +               warn_of_fail "Issues in pull request detected"
> +       fi
> +}
> +
>  # ensure we're on branch $1, and apply patches. the rest of the arguments are
>  # passed to git am.
>  dim_alias_ab=apply-branch
> @@ -1114,6 +1131,9 @@ function dim_apply_pull
>  
>         checkpatch_commit_push_range 0 "HEAD..FETCH_HEAD"
>  
> +       check_merge_baseline FETCH_HEAD $branch $(branch_to_remote drm-fixes)/drm-fixes
> +       check_merge_baseline FETCH_HEAD $branch origin/master
> +
>         if ! $DRY git pull --no-ff $pull_branch ; then
>                 if ! check_conflicts "$pull_branch" ; then
>                         echoerr "Please resolve and then commit normally using git"
> -- 
> 2.20.1
> 
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools


More information about the dim-tools mailing list