OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 24 matching lines...) Expand all Loading... |
35 return match[1]; | 35 return match[1]; |
36 return null; | 36 return null; |
37 } | 37 } |
38 | 38 |
39 function findReviewer(message) | 39 function findReviewer(message) |
40 { | 40 { |
41 var regexp = /R=(.+)/; | 41 var regexp = /R=(.+)/; |
42 var reviewers = findUsingRegExp(message, regexp); | 42 var reviewers = findUsingRegExp(message, regexp); |
43 if (!reviewers) | 43 if (!reviewers) |
44 return null; | 44 return null; |
45 return reviewers.replace(/\s*,\s*/, ", "); | 45 return reviewers.replace(/\s*,\s*/, ', '); |
46 } | 46 } |
47 | 47 |
48 function findBugID(message) | 48 function findBugID(message) |
49 { | 49 { |
50 var regexp = /BUG=(\d+)/; | 50 var regexp = /BUG=(.+)/; |
51 var bugID = parseInt(findUsingRegExp(message, regexp), 10); | 51 var value = findUsingRegExp(message, regexp); |
52 return isNaN(bugID) ? 0 : bugID; | 52 if (!value) |
53 | 53 return null; |
| 54 return value.split(/\s*,\s*/).map(function(id) { |
| 55 var parsedID = parseInt(id.replace(/[^\d]/g, ''), 10); |
| 56 return isNaN(parsedID) ? 0 : parsedID; |
| 57 }).filter(function(id) { |
| 58 return !!id; |
| 59 }); |
54 } | 60 } |
55 | 61 |
56 function findRevision(message) | 62 function findRevision(message) |
57 { | 63 { |
58 var regexp = /git-svn-id: svn:\/\/svn.chromium.org\/blink\/trunk@(\d+)/; | 64 var regexp = /git-svn-id: svn:\/\/svn.chromium.org\/blink\/trunk@(\d+)/; |
59 var svnRevision = parseInt(findUsingRegExp(message, regexp), 10); | 65 var svnRevision = parseInt(findUsingRegExp(message, regexp), 10); |
60 return isNaN(svnRevision) ? null : svnRevision; | 66 return isNaN(svnRevision) ? null : svnRevision; |
61 } | 67 } |
62 | 68 |
63 function parseCommitMessage(message) { | 69 function parseCommitMessage(message) { |
64 var lines = message.split('\n'); | 70 var lines = message.split('\n'); |
65 var title = ""; | 71 var title = ''; |
66 lines.some(function(line) { | 72 lines.some(function(line) { |
67 if (line) { | 73 if (line) { |
68 title = line; | 74 title = line; |
69 return true; | 75 return true; |
70 } | 76 } |
71 }); | 77 }); |
72 var summary = lines.join('\n').trim(); | 78 var summary = lines.join('\n').trim(); |
73 return { | 79 return { |
74 title: title, | 80 title: title, |
75 summary: summary, | 81 summary: summary, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 }; | 123 }; |
118 | 124 |
119 trac.recentCommitData = function(path, limit) | 125 trac.recentCommitData = function(path, limit) |
120 { | 126 { |
121 return net.xml('http://blink.lc/blink/atom').then(function(commitData) { | 127 return net.xml('http://blink.lc/blink/atom').then(function(commitData) { |
122 return parseCommitData(commitData); | 128 return parseCommitData(commitData); |
123 }); | 129 }); |
124 }; | 130 }; |
125 | 131 |
126 })(); | 132 })(); |
OLD | NEW |