[maintainer-tools PATCH] dim: Properly handle series on apply_branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So far we could use *dim* to apply a whole series
in a mbox, but only the very last patch was receiving
all the checks and patchwork link.

So this patch remove this limitation by using git mailsplit
to split the mbox and than use git am and checks individually
on each patch.

Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
---
 dim | 45 +++++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/dim b/dim
index 11aa675cc3bc..5457006631d6 100755
--- a/dim
+++ b/dim
@@ -767,38 +767,43 @@ function dim_apply_branch
 	branch=${1:?$usage}
 	shift
 	file=$(mktemp)
+	dir=$(mktemp -d)
 
 	assert_branch $branch
 	assert_repo_clean
 
+	committer_email=$(git_committer_email)
+
 	cat > $file
+	git mailsplit -o$dir $file > /dev/null
 
-	message_id=$(message_get_id $file)
+	for patch in `ls $dir`; do
 
-	committer_email=$(git_committer_email)
+		message_id=$(message_get_id $dir/$patch)
 
-	patch_from=$(grep "From:" "$file" | head -1)
-	if [[ "$patch_from" != *"$committer_email"* ]] ; then
-		sob=-s
-	fi
+		patch_from=$(grep "From:" "$dir/$patch" | head -1)
+		if [[ "$patch_from" != *"$committer_email"* ]] ; then
+			sob=-s
+		fi
 
-	git am --scissors -3 $sob "$@" $file
+		git am --scissors -3 $sob "$@" $dir/$patch
 
-	if [ -n "$message_id" ]; then
-		dim_commit_add_tag "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id";
-	else
-		echoerr "WARNING: No message-id found in the patch file."
-		rv=1
-	fi
+		if [ -n "$message_id" ]; then
+			dim_commit_add_tag "Link: https://patchwork.freedesktop.org/patch/msgid/$message_id";
+		else
+			echoerr "WARNING: No message-id found in the patch file."
+			rv=1
+		fi
 
-	if ! checkpatch_commit HEAD; then
-		rv=1
-	fi
-	if ! check_maintainer $branch HEAD; then
-		rv=1
-	fi
+		if ! checkpatch_commit HEAD; then
+			rv=1
+		fi
+		if ! check_maintainer $branch HEAD; then
+			rv=1
+		fi
 
-	eval $DRY $DIM_POST_APPLY_ACTION
+		eval $DRY $DIM_POST_APPLY_ACTION
+	done
 
 	return $rv
 }
-- 
2.13.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux