| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 bugID: findBugID(summary), | 83 bugID: findBugID(summary), |
| 84 reviewer: findReviewer(summary), | 84 reviewer: findReviewer(summary), |
| 85 revision: findRevision(summary), | 85 revision: findRevision(summary), |
| 86 }; | 86 }; |
| 87 } | 87 } |
| 88 | 88 |
| 89 // FIXME: Consider exposing this method for unit testing. | 89 // FIXME: Consider exposing this method for unit testing. |
| 90 function parseCommitData(responseXML) | 90 function parseCommitData(responseXML) |
| 91 { | 91 { |
| 92 var commits = Array.prototype.map.call(responseXML.getElementsByTagName('ent
ry'), function(logentry) { | 92 var commits = Array.prototype.map.call(responseXML.getElementsByTagName('ent
ry'), function(logentry) { |
| 93 var author = $.trim(logentry.getElementsByTagName('author')[0].textConte
nt); | 93 var author = logentry.getElementsByTagName('author')[0].textContent.trim
(); |
| 94 var time = logentry.getElementsByTagName('published')[0].textContent; | 94 var time = logentry.getElementsByTagName('published')[0].textContent; |
| 95 var titleElement = logentry.getElementsByTagName('title')[0]; | 95 var titleElement = logentry.getElementsByTagName('title')[0]; |
| 96 var title = titleElement ? titleElement.textContent : null; | 96 var title = titleElement ? titleElement.textContent : null; |
| 97 | 97 |
| 98 // FIXME: This isn't a very high-fidelity reproduction of the commit mes
sage, | 98 // FIXME: This isn't a very high-fidelity reproduction of the commit mes
sage, |
| 99 // but it's good enough for our purposes. | 99 // but it's good enough for our purposes. |
| 100 var message = parseCommitMessage(logentry.getElementsByTagName('content'
)[0].textContent); | 100 var message = parseCommitMessage(logentry.getElementsByTagName('content'
)[0].textContent); |
| 101 | 101 |
| 102 return { | 102 return { |
| 103 'revision': message.revision, | 103 'revision': message.revision, |
| 104 'title': title || message.title, | 104 'title': title || message.title, |
| 105 'time': time, | 105 'time': time, |
| 106 'summary': message.title, | 106 'summary': message.title, |
| 107 'author': author, | 107 'author': author, |
| 108 'reviewer': message.reviewer, | 108 'reviewer': message.reviewer, |
| 109 'bugID': message.bugID, | 109 'bugID': message.bugID, |
| 110 'message': message.summary, | 110 'message': message.summary, |
| 111 'revertedRevision': undefined, | 111 'revertedRevision': undefined, |
| 112 }; | 112 }; |
| 113 }); | 113 }); |
| 114 return commits; | 114 return commits; |
| 115 } | 115 } |
| 116 | 116 |
| 117 trac.changesetURL = function(revision) | 117 trac.changesetURL = function(revision) |
| 118 { | 118 { |
| 119 var queryParameters = { | 119 var queryParameters = { |
| 120 view: 'rev', | 120 view: 'rev', |
| 121 revision: revision, | 121 revision: revision, |
| 122 }; | 122 }; |
| 123 return config.kBlinkRevisionURL + '?' + $.param(queryParameters); | 123 return config.kBlinkRevisionURL + '?' + base.queryParam(queryParameters); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 trac.recentCommitData = function(path, limit) | 126 trac.recentCommitData = function(path, limit) |
| 127 { | 127 { |
| 128 return net.xml('http://blink.lc/blink/atom').then(function(commitData) { | 128 return net.xml('http://blink.lc/blink/atom').then(function(commitData) { |
| 129 return parseCommitData(commitData); | 129 return parseCommitData(commitData); |
| 130 }); | 130 }); |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 })(); | 133 })(); |
| OLD | NEW |