]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
git-changelog: parse Oracle bug
authorMaxim Uvarov <maxim.uvarov@oracle.com>
Tue, 17 Apr 2012 18:16:31 +0000 (11:16 -0700)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Tue, 17 Apr 2012 18:16:31 +0000 (11:16 -0700)
Some commits has Orabug or Oracle bug not at first line,
this patch fixed it.
Signed-off-by: Maxim Uvarov <maxim.uvarov@oracle.com>
scripts/git-changelog

index b1ff75c67f93ce15b115a69a3ab3f131ebeef823..16da0446c6a8abcb8d61904d8c1dc505db3be3f2 100755 (executable)
@@ -56,12 +56,25 @@ class ChangeLog:
                            "--pretty=format:%b", commit],
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE).communicate()
-
-       ret = proc[0].strip('\n').split('\n')
-       if len(ret[0]) > 0 and len(ret[0]) > 7 and ret[0].find("Orabug") != -1:
-               return "[%s]" % ret[0]
-       else: 
-               return "" 
+       bugz = []
+       m = re.search("Orabug:.*$", proc[0], re.MULTILINE)
+       if m:
+               bugz.append(m.group())
+       ret = ""
+       if len(bugz) > 0:
+               for bug in bugz:
+                       ret += "%s " % bug
+       bugz = []
+       m = re.search("Oracle bug:.*$", proc[0], re.MULTILINE)
+       if m:
+               bugz.append(m.group())
+       if len(bugz) > 0:
+               for bug in bugz:
+                       ret += "%s " % bug
+       if len(ret) > 0:
+               return "[%s]" % ret.rstrip()
+       else:
+               return ret 
 
     def _get_cve(self, commit):
        proc = subprocess.Popen(['git', 'log', '-1',