[PATCH v10 09/15] contrib: related: add support for more roles

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

 



Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 contrib/related/git-related    | 14 ++++++++++++--
 contrib/related/test-related.t |  8 ++++----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/contrib/related/git-related b/contrib/related/git-related
index 04c56f5..f94f5f4 100755
--- a/contrib/related/git-related
+++ b/contrib/related/git-related
@@ -8,6 +8,13 @@ $min_percent = 10
 $files = []
 $rev_args = []
 
+KNOWN_ROLES = {
+  'Signed-off-by' => :signer,
+  'Reviewed-by' => :reviewer,
+  'Acked-by' => :acker,
+  'Cc' => :cced,
+}
+
 class Person
 
   attr_reader :roles
@@ -77,9 +84,12 @@ class Commit
           in_body = true
         end
       else
-        if line =~ /^(Signed-off-by|Reviewed-by|Acked-by|Cc): ([^<>]+) <(\S+?)>$/
+        role_regex = KNOWN_ROLES.keys.join('|')
+        if line =~ /^(#{role_regex}): ([^<>]+) <(\S+?)>$/
           person = Persons.get($2, $3)
-          person.add_role(@id, :signer) if person != author
+          role = KNOWN_ROLES[$1]
+          next if role == :signer and person == author
+          person.add_role(@id, role)
         end
       end
     end
diff --git a/contrib/related/test-related.t b/contrib/related/test-related.t
index 90cc516..9da2693 100755
--- a/contrib/related/test-related.t
+++ b/contrib/related/test-related.t
@@ -46,7 +46,7 @@ test_expect_success "others" "
 	cat > expected <<-EOF &&
 	John Doe <john@xxxxxxx> (author: 33%)
 	John Poppins <john@xxxxxxx> (author: 33%)
-	Jon Stewart <jon@xxxxxxxxxxx> (signer: 33%, author: 33%)
+	Jon Stewart <jon@xxxxxxxxxxx> (reviewer: 33%, author: 33%)
 	EOF
 	test_cmp expected actual
 "
@@ -58,7 +58,7 @@ test_expect_success "multiple patches" "
 	cat > expected <<-EOF &&
 	John Doe <john@xxxxxxx> (author: 25%)
 	John Poppins <john@xxxxxxx> (author: 25%)
-	Jon Stewart <jon@xxxxxxxxxxx> (signer: 25%, author: 25%)
+	Jon Stewart <jon@xxxxxxxxxxx> (reviewer: 25%, author: 25%)
 	Pablo Escobar <pablo@xxxxxxxxxxx> (author: 25%)
 	EOF
 	test_cmp expected actual
@@ -69,7 +69,7 @@ test_expect_success "from committish" "
 	cat > expected <<-EOF &&
 	John Doe <john@xxxxxxx> (author: 33%)
 	John Poppins <john@xxxxxxx> (author: 33%)
-	Jon Stewart <jon@xxxxxxxxxxx> (signer: 33%, author: 33%)
+	Jon Stewart <jon@xxxxxxxxxxx> (reviewer: 33%, author: 33%)
 	EOF
 	test_cmp expected actual
 "
@@ -79,7 +79,7 @@ test_expect_success "from single rev committish" "
 	cat > expected <<-EOF &&
 	John Doe <john@xxxxxxx> (author: 33%)
 	John Poppins <john@xxxxxxx> (author: 33%)
-	Jon Stewart <jon@xxxxxxxxxxx> (signer: 33%, author: 33%)
+	Jon Stewart <jon@xxxxxxxxxxx> (reviewer: 33%, author: 33%)
 	EOF
 	test_cmp expected actual
 "
-- 
1.8.4-fc

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]