[Intel-gfx] [dim PATCH] dim: add retip command to rebase branch onto drm-tip

Jani Nikula jani.nikula at intel.com
Wed Mar 15 11:51:36 UTC 2017


Helper to rebase a branch onto drm-tip.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 dim     | 23 +++++++++++++++++++++++
 dim.rst |  6 ++++++
 2 files changed, 29 insertions(+)

diff --git a/dim b/dim
index a68cc28fd4b2..f1ca50f0d811 100755
--- a/dim
+++ b/dim
@@ -345,6 +345,29 @@ function dim_commit_add_tag
 	done
 }
 
+# $1: branch [optional]
+function git_find_tip
+{
+	git log $1 -1 --format=%H --grep="^drm-tip: .* integration manifest$"
+}
+
+# $1: branch [optional]
+function dim_retip
+{
+	local branch upstream remote
+
+	branch="$1"
+	shift
+	remote=$(url_to_remote $drm_tip_ssh)
+	upstream=$(git_find_tip "$branch")
+
+	if [[ -z "$upstream" ]]; then
+		echoerr "$branch is not based on drm-tip"
+		return 1
+	fi
+
+	git rebase --onto $remote/drm-tip $upstream $branch "$@"
+}
 
 # update for-linux-next and for-linux-next-fixes branches
 function update_linux_next # branch next next-fixes fixes
diff --git a/dim.rst b/dim.rst
index f624b79948ac..a778701c7335 100644
--- a/dim.rst
+++ b/dim.rst
@@ -362,6 +362,12 @@ uptodate
 --------
 Try to check if you're running an up-to-date version of **dim**.
 
+retip [*branch*] [*git-rebase option* ...]
+------------------------------------------
+
+Rebase the given local branch, current branch by default, onto drm-tip. Options
+after the branch will be passed to **git-rebase**.
+
 help
 ----
 Show this help. Install **rst2man(1)** for best results.
-- 
2.1.4



More information about the Intel-gfx mailing list