| 21 | |
| 22 | |
| 23 | var parseRawCommit = function(raw) { |
| 24 | if(!raw) return null; |
| 25 | |
| 26 | var lines = raw.split('\n'); |
| 27 | var msg = {}, match; |
| 28 | |
| 29 | msg.hash = lines.shift(); |
| 30 | msg.subject = lines.shift(); |
| 31 | msg.closes = []; |
| 32 | msg.breaks = []; |
| 33 | |
| 34 | lines.forEach(function(line) { |
| 35 | match = line.match(/(?:Closes|Fixes)\s#(\d+)/); |
| 36 | if(match) msg.closes.push(parseInt(match[1])); |
| 37 | }); |
| 38 | |
| 39 | match = raw.match(/BREAKING CHANGE:([\s\S]*)/); |
| 40 | if(match) { |
| 41 | msg.breaking = match[1]; |
| 42 | } |
| 43 | |
| 44 | |
| 45 | msg.body = lines.join('\n'); |
| 46 | match = msg.subject.match(/^(\w*)\s?\:\s?(.*)$/); |
| 47 | |
| 48 | if(!match || !match[1] || !match[2]) { |
| 49 | warn('Incorrect message: %s %s', msg.hash, msg.subject); |
| 50 | return null; |
| 51 | } |
| 52 | |
| 53 | msg.type = match[1]; |
| 54 | // msg.component = match[2]; |
| 55 | msg.subject = match[2]; |
| 56 | |
| 57 | return msg; |
| 58 | }; |
| 59 | |
| 60 | |
| 61 | var linkToIssue = function(issue) { |