From: Jonathan Corbet Date: Mon, 4 Oct 2010 23:06:33 +0000 (-0600) Subject: Make tag matching stricter X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f64e9ffbd8f93d1c9d89f7e7bc6d72a6c80cb7e0;p=people%2Flarsk%2Fxenproject-org-gitdm.git Make tag matching stricter If you commit a git changelog to your repository, gitdm will be confused by all the added patch tags. So make the patterns stricter to force them only to match within the git log metadata - or so we hope. There is still room for confusion here; we really need to make grabpatch() smart enough to split metadata and the diff. Don't have time for that now. This patch changes results slightly. In the 2.6.36 cycle, there's a tag reading: Original-Idea-and-Signed-off-by: Nicolas Pitre Pre-patch gitdm would recognize that as a signoff; after the change it no longer does. Reported-by: Wolfgang Denk Signed-off-by: Jonathan Corbet --- diff --git a/gitdm b/gitdm index 93ac0fc..dce5d3c 100755 --- a/gitdm +++ b/gitdm @@ -189,7 +189,7 @@ def grabpatch(): # # Could be a signed-off-by: # - m = Psob.search (Line) + m = Psob.match (Line) if m: email = database.RemapEmail (m.group (2)) sobber = LookupStoreHacker(m.group (1), email) @@ -199,24 +199,24 @@ def grabpatch(): # # Various other tags of interest. # - m = Preview.search (Line) # Reviewed-by: + m = Preview.match (Line) # Reviewed-by: if m: email = database.RemapEmail (m.group (2)) p.addreviewer (LookupStoreHacker(m.group (1), email)) continue - m = Ptest.search (Line) # Tested-by: + m = Ptest.match (Line) # Tested-by: if m: email = database.RemapEmail (m.group (2)) p.addtester (LookupStoreHacker (m.group (1), email)) p.author.testcredit (patch) continue - m = Prep.search (Line) # Reported-by: + m = Prep.match (Line) # Reported-by: if m: email = database.RemapEmail (m.group (2)) p.addreporter (LookupStoreHacker (m.group (1), email)) p.author.reportcredit (patch) continue - m = Preptest.search (Line) # Reported-and-tested-by: + m = Preptest.match (Line) # Reported-and-tested-by: if m: email = database.RemapEmail (m.group (2)) h = LookupStoreHacker (m.group (1), email) diff --git a/patterns.py b/patterns.py index f912d9a..d3495b8 100644 --- a/patterns.py +++ b/patterns.py @@ -19,17 +19,17 @@ import re Pemail = r'\s+"?([^<"]+)"?\s<([^>]+)>' # just email addr + name Pcommit = re.compile (r'^commit ([0-9a-f ]+)$') Pauthor = re.compile (r'^Author:' + Pemail + '$') -Psob = re.compile (r'Signed-off-by:' + Pemail) +Psob = re.compile (r'^\s+Signed-off-by:' + Pemail + '.*$') Pmerge = re.compile (r'^Merge:.*$') Padd = re.compile (r'^\+[^+].*$') Prem = re.compile (r'^-[^-].*$') Pdate = re.compile (r'^(Commit)?Date:\s+(.*)$') Pfilea = re.compile (r'^---\s+(.*)$') Pfileb = re.compile (r'^\+\+\+\s+(.*)$') -Preview = re.compile (r'Reviewed-by:' + Pemail) -Ptest = re.compile (r' tested-by:' + Pemail, re.I) -Prep = re.compile (r'Reported-by:' + Pemail) -Preptest = re.compile (r'reported-and-tested-by:' + Pemail, re.I) +Preview = re.compile (r'^\s+Reviewed-by:' + Pemail + '.*$') +Ptest = re.compile (r'^\s+tested-by:' + Pemail + '.*$', re.I) +Prep = re.compile (r'^\s+Reported-by:' + Pemail + '.*$') +Preptest = re.compile (r'^\s+reported-and-tested-by:' + Pemail + '.*$', re.I) # # Merges are described with a variety of lines. #