[Intel-gfx] [maintainer-tools RFC PATCH] dim: add cherry-pick-[next-]fixes subcommands

Jani Nikula jani.nikula at intel.com
Thu Jan 28 23:40:32 PST 2016


Add two new subcommands for cherry-picking fixes from dinq to
drm-intel-fixes and drm-intel-next-fixes. The only difference in the
subcommands is the assert branch check to ensure the user is on the
right branch.

The commands scan dinq for commits Cc'd to stable or drm-intel-fixes,
checks whether they've already been backported, attempts cherry-pick,
and asks for directions on failed cherry-pick.

It's still rough around the edges and slow as molasses due to unlimited
scan for backports (should just check a release or two back at most),
and an aborted run just starts over next time (though it should take the
freshly backported commits into account).

Signed-off-by: Jani Nikula <jani.nikula at intel.com>

---

Undecided whether we should apply this already or not. It's crude, but I
use it.
---
 dim | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/dim b/dim
index 203c6b60cf1b..c64f6e86af62 100755
--- a/dim
+++ b/dim
@@ -473,6 +473,55 @@ function dim_cherry_pick
 	$DRY git cherry-pick $1
 }
 
+function dim_cherry_pick_branch
+{
+	for commit in $(git log --reverse --format=format:%h --grep="drm-intel-fixes at lists.freedesktop.org" --grep="stable at vger.kernel.org" origin/master..$DIM_DRM_INTEL_REMOTE/drm-intel-next-queued -- drivers/gpu/drm/i915); do
+		echo "Considering $(git --no-pager log --oneline -1 $commit)"
+		log=$(mktemp)
+		# note *local* branches to account for unpushed ones
+		git log drm-intel-fixes --oneline --grep="cherry picked .* $commit" > $log
+		git log drm-intel-next-fixes --oneline --grep="cherry picked .* $commit" >> $log
+		if [ "$(cat $log)" = "" ]; then
+			if ! git cherry-pick -e -x -s $commit; then
+				select choice in "Diff" "Resolve" "Skip" "Abort"; do
+					case $choice in
+						Diff)
+							git diff
+							;;
+						Resolve)
+							exit
+							;;
+						Skip)
+							git cherry-pick --abort
+							break
+							;;
+						Abort)
+							git cherry-pick --abort
+							exit
+							;;
+					esac
+				done
+			fi
+		else
+			echo "Already backported as:"
+			sed 's/^/\t/' < $log
+		fi
+		rm -f $log
+	done
+}
+
+function dim_cherry_pick_fixes
+{
+	assert_branch drm-intel-fixes
+	dim_cherry_pick_branch "$@"
+}
+
+function dim_cherry_pick_next_fixes
+{
+	assert_branch drm-intel-next-fixes
+	dim_cherry_pick_branch "$@"
+}
+
 dim_alias_ar=apply-resolved
 function dim_apply_resolved
 {
-- 
2.1.4



More information about the Intel-gfx mailing list