Skip to contentSkip to conversation

dim: Add add-missing-cc command

PATCH In review Maarten Lankhorst 2 participants 6 messages Jul 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dim: Add add-missing-cc command

This commit will take the topmost commit and add all cc's from get_maintainer.pl, it is useful for adding cc's to an entire patch series touching multiple drivers, to add the right cc to each one.

---
 dim     | 41 +++++++++++++++++++++++++++++++++++++++++
 dim.rst |  6 ++++++
 2 files changed, 47 insertions(+)
dim +41 -0
index 267dbc0313b1..2378ec56e438 100755
@@ -1914,6 +1914,47 @@ function dim_fixes
 	fi
 }
 
+function dim_add_missing_cc
+{
+	git show | scripts/get_maintainer.pl --email --norolestats --pattern-depth 1 | while read cc; do
+		email="$(echo "$cc" | sed -e 's/.*<//' -e 's/>.*//')"
+		name=''
+
+		if echo "$cc" | grep -q '<'; then
+			name="$(echo ${cc/<*/} | sed -e 's/[[:space:]]*\$//')";
+		fi
+
+		# Don't add main mailing lists
+		if [ "$email" = "[email protected]" -o \
+		     "$email" = "[email protected]}" ]; then
+			continue
+		fi
+
+		# Variables from the while loop don't propagate,
+		# print out a 1 on success
+		matches=$(
+			git show -s | grep -i "^    Cc:" | sed 's/^ *[Cc][Cc]: *//' | while read testcc; do
+				testemail="$(echo "$testcc" | sed -e 's/.*<//' -e 's/>.*//')"
+
+				if [ "$testemail" != "$email" ]; then
+					if [ -z "$name" ]; then continue; fi
+
+					testname="$(echo ${testcc/<*/} | sed -e 's/[[:space:]]*\$//' -e 's/^[[:space:]]*//')"
+
+					if [ "$testname" != "$name" ]; then continue; fi
+				fi
+
+				echo 1
+				break
+			done
+		)
+
+		if [ -z "$matches" ]; then
+			$DRY dim_commit_add_tag "Cc: ${cc}"
+		fi
+	done
+}
+
 function dim_help
 {
 	manpage=$DIM_PREFIX/maintainer-tools/dim.rst
dim.rst +6 -0
index 10572f139130..ae511ca54cbe 100644
@@ -274,6 +274,12 @@ add-link-queued
 **add-link** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
 *drm-intel-next-queued* branches respectively.
 
+add-missing-cc
+--------------
+Adds missing cc's to the topmost commit, can be used with
+*git rebase --exec "dim add-missing-cc"*
+to add cc's for an entire patch series.
+
 magic-rebase-resolve
 --------------------
 Tries to resolve a rebase conflict by first resetting the tree
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 67 lines · Maarten Lankhorst

This commit will take the topmost commit and add all cc's from get_maintainer.pl, it is useful for adding cc's to an entire patch series touching multiple drivers, to add the right cc to each one.

---
 dim     | 41 +++++++++++++++++++++++++++++++++++++++++
 dim.rst |  6 ++++++
 2 files changed, 47 insertions(+)
dim +41 -0
index 267dbc0313b1..2378ec56e438 100755
@@ -1914,6 +1914,47 @@ function dim_fixes
 	fi
 }
 
+function dim_add_missing_cc
+{
+	git show | scripts/get_maintainer.pl --email --norolestats --pattern-depth 1 | while read cc; do
+		email="$(echo "$cc" | sed -e 's/.*<//' -e 's/>.*//')"
+		name=''
+
+		if echo "$cc" | grep -q '<'; then
+			name="$(echo ${cc/<*/} | sed -e 's/[[:space:]]*\$//')";
+		fi
+
+		# Don't add main mailing lists
+		if [ "$email" = "[email protected]" -o \
+		     "$email" = "[email protected]}" ]; then
+			continue
+		fi
+
+		# Variables from the while loop don't propagate,
+		# print out a 1 on success
+		matches=$(
+			git show -s | grep -i "^    Cc:" | sed 's/^ *[Cc][Cc]: *//' | while read testcc; do
+				testemail="$(echo "$testcc" | sed -e 's/.*<//' -e 's/>.*//')"
+
+				if [ "$testemail" != "$email" ]; then
+					if [ -z "$name" ]; then continue; fi
+
+					testname="$(echo ${testcc/<*/} | sed -e 's/[[:space:]]*\$//' -e 's/^[[:space:]]*//')"
+
+					if [ "$testname" != "$name" ]; then continue; fi
+				fi
+
+				echo 1
+				break
+			done
+		)
+
+		if [ -z "$matches" ]; then
+			$DRY dim_commit_add_tag "Cc: ${cc}"
+		fi
+	done
+}
+
 function dim_help
 {
 	manpage=$DIM_PREFIX/maintainer-tools/dim.rst
dim.rst +0 -0
index 10572f139130..ae511ca54cbe 100644

dim.rst add-link-queued · line 279

Quoted 6 lines
dim.rst +3 -0
@@ -274,6 +274,12 @@ add-link-queued
 **add-link** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
 *drm-intel-next-queued* branches respectively.
 
+add-missing-cc
+--------------
+Adds missing cc's to the topmost commit, can be used with

This needs the explanation what missing cc's are and where they are added from.

BR,
Jani.

Quoted 6 lines
dim.rst +3 -0
+*git rebase --exec "dim add-missing-cc"*
+to add cc's for an entire patch series.
+
 magic-rebase-resolve
 --------------------
 Tries to resolve a rebase conflict by first resetting the tree
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Op 12-07-17 om 11:53 schreef Jani Nikula:

Quoted 71 lines · Maarten Lankhorst
Quoted 70 lines

This commit will take the topmost commit and add all cc's from get_maintainer.pl, it is useful for adding cc's to an entire patch series touching multiple drivers, to add the right cc to each one.

---
 dim     | 41 +++++++++++++++++++++++++++++++++++++++++
 dim.rst |  6 ++++++
 2 files changed, 47 insertions(+)
dim +41 -0
index 267dbc0313b1..2378ec56e438 100755
@@ -1914,6 +1914,47 @@ function dim_fixes
 	fi
 }
 
+function dim_add_missing_cc
+{
+	git show | scripts/get_maintainer.pl --email --norolestats --pattern-depth 1 | while read cc; do
+		email="$(echo "$cc" | sed -e 's/.*<//' -e 's/>.*//')"
+		name=''
+
+		if echo "$cc" | grep -q '<'; then
+			name="$(echo ${cc/<*/} | sed -e 's/[[:space:]]*\$//')";
+		fi
+
+		# Don't add main mailing lists
+		if [ "$email" = "[email protected]" -o \
+		     "$email" = "[email protected]}" ]; then
+			continue
+		fi
+
+		# Variables from the while loop don't propagate,
+		# print out a 1 on success
+		matches=$(
+			git show -s | grep -i "^    Cc:" | sed 's/^ *[Cc][Cc]: *//' | while read testcc; do
+				testemail="$(echo "$testcc" | sed -e 's/.*<//' -e 's/>.*//')"
+
+				if [ "$testemail" != "$email" ]; then
+					if [ -z "$name" ]; then continue; fi
+
+					testname="$(echo ${testcc/<*/} | sed -e 's/[[:space:]]*\$//' -e 's/^[[:space:]]*//')"
+
+					if [ "$testname" != "$name" ]; then continue; fi
+				fi
+
+				echo 1
+				break
+			done
+		)
+
+		if [ -z "$matches" ]; then
+			$DRY dim_commit_add_tag "Cc: ${cc}"
+		fi
+	done
+}
+
 function dim_help
 {
 	manpage=$DIM_PREFIX/maintainer-tools/dim.rst
dim.rst +0 -0
index 10572f139130..ae511ca54cbe 100644
@@ -274,6 +274,12 @@ add-link-queued
 **add-link** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and
 *drm-intel-next-queued* branches respectively.
 
Quoted 8 lines

dim.rst add-link-queued · line 279

Quoted 3 lines
dim.rst +3 -0
+add-missing-cc
+--------------
+Adds missing cc's to the topmost commit, can be used with

This needs the explanation what missing cc's are and where they are added from.

BR,
Jani.

How about the following?

add-missing-cc
--------------
Adds all maintainers from scripts/get_maintainer.pl as cc's to the topmost commit. Any duplicates by name or email will be removed, so this can be used with *git rebase --exec "dim add-missing-cc"* to add cc's for an entire patch series that affect multiple drivers each with different maintainers.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 8 lines · Maarten Lankhorst

How about the following?

add-missing-cc
--------------
Adds all maintainers from scripts/get_maintainer.pl as cc's to the topmost commit. Any duplicates by name or email will be removed, so this can be used with *git rebase --exec "dim add-missing-cc"* to add cc's for an entire patch series that affect multiple drivers each with different maintainers.

Works for me.

J.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Op 12-07-17 om 12:33 schreef Jani Nikula:

Quoted 9 lines · Maarten Lankhorst
Quoted 8 lines

How about the following?

add-missing-cc
--------------
Adds all maintainers from scripts/get_maintainer.pl as cc's to the topmost commit. Any duplicates by name or email will be removed, so this can be used with *git rebase --exec "dim add-missing-cc"* to add cc's for an entire patch series that affect multiple drivers each with different maintainers.

Quoted 4 lines

Works for me.

J.

is that an ack?

~Maarten

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
In reply to Jani Nikula

Op 12-07-17 om 12:33 schreef Jani Nikula:

Quoted 9 lines · Maarten Lankhorst
Quoted 8 lines

How about the following?

add-missing-cc
--------------
Adds all maintainers from scripts/get_maintainer.pl as cc's to the topmost commit. Any duplicates by name or email will be removed, so this can be used with *git rebase --exec "dim add-missing-cc"* to add cc's for an entire patch series that affect multiple drivers each with different maintainers.

Quoted 4 lines

Works for me.

J.

Thanks, pushed. :)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel