We want explicit backmerges when a pull request pulls in random other
stuff. Motivated by a few recent examples.

Cc: Maxime Ripard <[email protected]>
Cc: Dave Airlie <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
---
 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dim-tools

Reply via email to