Skip to contentSkip to conversation

dim: add cherry-pick-[next-]fixes subcommands

RFC PATCH In review Jani Nikula 2 participants 3 messages Jan 29, 2016 – Feb 17, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 dim: add cherry-pick-[next-]fixes subcommands

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).

---

Undecided whether we should apply this already or not. It's crude, but I use it.

---
 dim | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
dim +49 -0
index 203c6b60cf1b..c64f6e86af62 100755
@@ -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="[email protected]" --grep="[email protected]" 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
 {
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 14 lines · Jani Nikula

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).

Quoted 6 lines

---

Undecided whether we should apply this already or not. It's crude, but I use it.

Imo add help text and push it. We can prettify later on. Oh and maybe bash completion too. Wrt speeding this up, have you looked at gregkh's toolchaing for stable kernels? It should be out there somewhere. -Daniel

Quoted 67 lines
---
 dim | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
dim +49 -0
index 203c6b60cf1b..c64f6e86af62 100755
@@ -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="[email protected]" --grep="[email protected]" 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
 {
Signature · 1 line
2.1.4
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 17 lines · Daniel Vetter
Quoted 16 lines · Jani Nikula

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).

Quoted 8 lines
Quoted 4 lines

---

Undecided whether we should apply this already or not. It's crude, but I use it.

Imo add help text and push it. We can prettify later on. Oh and maybe bash completion too. Wrt speeding this up, have you looked at gregkh's toolchaing for stable kernels? It should be out there somewhere.

Added help and pushed.

BR,
Jani.

Quoted 69 lines

-Daniel

Quoted 67 lines
---
 dim | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
dim +49 -0
index 203c6b60cf1b..c64f6e86af62 100755
@@ -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="[email protected]" --grep="[email protected]" 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
 {
Signature · 1 line
2.1.4
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx