- Only update the for-linux-next branches in the repo for the branch
  just pushed.
- Roll out the same logic (to allow us to always merge feature
  patches) for drm-misc.

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 dim | 67 ++++++++++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 44 insertions(+), 23 deletions(-)

diff --git a/dim b/dim
index f42b1eebf48b..f7e814878a18 100755
--- a/dim
+++ b/dim
@@ -249,30 +249,43 @@ function map_nightly_remote
        get_remote_name $remote_url
 }

-function update_linux_next
+# update for-linux-next and for-linux-next-fixes branches
+function update_linux_next # branch next next-fixes fixes
 {
        cd $DIM_PREFIX/drm-tip
+       local branch=$1
+       local linux_next=$2
+       local linux_next_fixes=$3
+       local linux_fixes=$4

-       local nightly_origin=`map_nightly_remote origin`
+       source $DIM_PREFIX/drm-rerere/nightly.conf
+
+       local nightly_remote=`get_nightly_remote_for_branch $branch`
+
+       if [[ $nightly_remote != `get_nightly_remote_for_branch $linux_next` ]] 
; then
+               return
+       fi
+
+       local remote=`map_nightly_remote $nightly_remote`

        # always update drm-intel-fixes
-       echo -n "Pushing drm-intel-fixes to for-linux-next-fixes... "
-       git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-fixes:for-linux-next-fixes >& /dev/null
+       echo -n "Pushing $linux_fixes to for-linux-next-fixes... "
+       git push $DRY_RUN $remote +$remote/$linux_fixes:for-linux-next-fixes # 
>& /dev/null
        echo "Done."

-       if git merge-base --is-ancestor $nightly_origin/drm-intel-next-fixes 
$nightly_origin/drm-intel-fixes ; then
+       if git merge-base --is-ancestor $remote/$linux_next_fixes 
$remote/$linux_fixes ; then
                # -fixes has caught up to dinf, i.e. we're out of the merge
                # window. Push the next queue.
-               echo -n "Out of merge window. Pushing drm-intel-next-queued to 
for-linux-next... "
-               git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-next-queued:for-linux-next >& /dev/null
+               echo -n "Out of merge window. Pushing $linux_next to 
for-linux-next... "
+               git push $DRY_RUN $remote +$remote/$linux_next:for-linux-next 
>& /dev/null
                echo "Done."
        else
                # dinf is ahead of -fixes, i.e. drm-next has already closed for
                # the next merge window and we've started to gather new fixes
                # for the current -next cycle. Push dinf

-               echo -n "Pushing drm-intel-next-fixes to for-linux-next... "
-               git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-next-fixes:for-linux-next >& /dev/null
+               echo -n "Pushing $linux_next_fixes to for-linux-next... "
+               git push $DRY_RUN $remote 
+$remote/$linux_next_fixes:for-linux-next >& /dev/null
                echo "Done."
        fi
 }
@@ -428,8 +441,6 @@ function dim_rebuild_nightly
                echo "Fail: Branch setup for the rerere-cache is borked."
                exit 1
        fi
-
-       update_linux_next
 }

 # push branch $1, rebuild nightly. the rest of the arguments are passed to git
@@ -450,6 +461,9 @@ function dim_push_branch

        git push $DRY_RUN $remote $branch "$@"

+       update_linux_next $branch drm-intel-next-queued drm-intel-next-fixes 
drm-intel-fixes
+       update_linux_next $branch drm-misc-next drm-misc-next-fixes 
drm-misc-fixes
+
        dim_rebuild_nightly
 }

@@ -683,6 +697,24 @@ function dim_create_branch
        $DRY git commit --quiet -m "Adding $branch to -nightly"
 }

+function get_nightly_remote_for_branch
+{
+       local branch=$1
+
+       for tree in $nightly_branches; do
+               local nightly_branch=${tree%:*}
+               local nightly_remote=${nightly_branch%%/*}
+               nightly_branch=${nightly_branch#*/}
+
+               if [[ $nightly_branch == $branch ]] ; then
+                       nightly_remote=$nightly_remote
+                       echo $nightly_remote
+               fi
+       done
+
+       echo ""
+}
+
 function dim_remove_branch
 {
        if [[ "x$1" = "x" ]]; then
@@ -707,18 +739,7 @@ function dim_remove_branch

        source $DIM_PREFIX/drm-rerere/nightly.conf

-       local nightly_remote=""
-
-       for tree in $nightly_branches; do
-               local nightly_branch=${tree%:*}
-               local nightly_remote=${nightly_branch%%/*}
-               nightly_branch=${nightly_branch#*/}
-
-               if [[ $nightly_branch == $branch ]] ; then
-                       nightly_remote=$nightly_remote
-                       break
-               fi
-       done
+       local nightly_remote=`get_nightly_remote_for_branch $branch`

        if [[ $nightly_remote == "" ]] ; then
                echoerr "$branch not found in nightly.conf"
-- 
2.9.3

Reply via email to