Diff
Modified: trunk/Tools/ChangeLog (274247 => 274248)
--- trunk/Tools/ChangeLog 2021-03-11 00:00:25 UTC (rev 274247)
+++ trunk/Tools/ChangeLog 2021-03-11 00:01:13 UTC (rev 274248)
@@ -1,3 +1,25 @@
+2021-03-10 Jonathan Bedard <[email protected]>
+
+ [resultsdbpy] Make client aware of hashes and revisions
+ https://bugs.webkit.org/show_bug.cgi?id=223001
+ <rdar://problem/75237812>
+
+ Reviewed by Dewei Zhu.
+
+ * Scripts/libraries/resultsdbpy/resultsdbpy/__init__.py: Bump version.
+ * Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/commit.js:
+ (Commit): Support both "id" and "identifier" in constructor.
+ (Commit.prototype.repr): Centralize string representation of commit.
+ (_CommitBank.prototype._loadSiblings):
+ * Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/investigate.js:
+ (commitsForUuid): Use repr().
+ * Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/timeline.js:
+ (xAxisFromScale): Use repr().
+ (TimelineFromEndpoint.prototype.render.onDotEnterFactory): Ditto.
+ * Scripts/libraries/resultsdbpy/resultsdbpy/view/templates/commits.html: Convert JSON to Commit object.
+ * Scripts/libraries/resultsdbpy/resultsdbpy/view/templates/investigate.html: Use repr().
+ * Scripts/libraries/resultsdbpy/setup.py: Bump version.
+
2021-03-10 Chris Dumez <[email protected]>
Improve AppleLanguagesTest.UpdateAppleLanguages API test
Modified: trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/__init__.py (274247 => 274248)
--- trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/__init__.py 2021-03-11 00:00:25 UTC (rev 274247)
+++ trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/__init__.py 2021-03-11 00:01:13 UTC (rev 274248)
@@ -44,6 +44,6 @@
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)
-version = Version(2, 0, 0)
+version = Version(2, 0, 1)
name = 'resultsdbpy'
Modified: trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/commit.js (274247 => 274248)
--- trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/commit.js 2021-03-11 00:00:25 UTC (rev 274247)
+++ trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/commit.js 2021-03-11 00:01:13 UTC (rev 274248)
@@ -101,16 +101,16 @@
let commitArgs = paramsToQuery({
repository_id: [cell.commit.repository_id],
branch: [cell.commit.branch],
- id: [cell.commit.id],
+ id: [cell.commit.identifier],
});
- let investigateArgs = {id: [cell.commit.id]};
- if (!['master', 'trunk'].includes(cell.commit.branch))
+ let investigateArgs = {id: [cell.commit.identifier]};
+ if (!['master', 'main', 'trunk'].includes(cell.commit.branch))
investigateArgs.branch = [cell.commit.branch];
return `<td rowspan="${cell.rowspan}">
- <a href="" <br>
+ <a href="" <br>
Branch: ${cell.commit.branch} <br>
- Committer: ${escapeHTML(cell.commit.committer)} <br>
+ Author: ${escapeHTML(cell.commit.author)} <br>
<a href="" Info</a><br>
<a href="" results for commit</a>
${function() {
@@ -129,18 +129,27 @@
class Commit {
constructor(json) {
+ this.identifier = json.identifier ? json.identifier : json.id;
+ this.revision = json.revision;
+ this.hash = json.hash;
+
+ this.author = json.author ? json.author.name : json.committer;
+
+ this.repository_id = json.repository_id;
this.branch = json.branch;
- this.committer = json.committer;
- this.id = json.id;
this.message = json.message;
+
+ this.timestamp = json.timestamp;
this.order = json.order;
- this.repository_id = json.repository_id;
- this.timestamp = json.timestamp;
this.uuid = this.timestamp * TIMESTAMP_TO_UUID_MULTIPLIER + this.order;
}
compare(commit) {
return this.uuid - commit.uuid;
}
+ label() {
+ // Per the birthday paradox, 10% chance of collision with 7.7 million commits with 12 character commits
+ return this.identifier.substring(0,12);
+ }
};
class _CommitBank {
@@ -286,7 +295,7 @@
const query = paramsToQuery({
branch: [commit.branch],
repository_id: [commit.repository_id],
- id: [commit.id],
+ id: [commit.identifier],
});
return fetch('api/commits/siblings?' + query).then(response => {
let self = this;
Modified: trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/investigate.js (274247 => 274248)
--- trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/investigate.js 2021-03-11 00:00:25 UTC (rev 274247)
+++ trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/investigate.js 2021-03-11 00:01:13 UTC (rev 274248)
@@ -38,7 +38,7 @@
if (!params.branch)
delete params.branch;
const query = paramsToQuery(params);
- return `<a href="" target="_blank">${commit.id.substring(0,12)}</a>`;
+ return `<a href="" target="_blank">${commit.label()}</a>`;
}).join(', ')}`
}
Modified: trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/timeline.js (274247 => 274248)
--- trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/timeline.js 2021-03-11 00:00:25 UTC (rev 274247)
+++ trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/static/js/timeline.js 2021-03-11 00:01:13 UTC (rev 274248)
@@ -170,7 +170,7 @@
}
function onScaleClick(node) {
- if (!node.label.id)
+ if (!node.label.label())
return;
let params = {
branch: node.label.branch ? [node.label.branch] : queryToParams(document.URL.split('?')[1]).branch,
@@ -191,7 +191,7 @@
ToolTip.set(
`<div class="content">
Time: ${new Date(node.label.timestamp * 1000).toLocaleString()}<br>
- Committer: ${node.label.committer}
+ Author: ${node.label.author}
${node.label.message ? `<br><div>${escapeHTML(node.label.message.split('\n')[0])}</div>` : ''}
</div>`,
node.tipPoints.map((point) => {
@@ -206,8 +206,7 @@
if (!ToolTip.isIn({x: event.x, y: event.y - scrollDelta}))
ToolTip.unset();
},
- // Per the birthday paradox, 10% change of collision with 7.7 million commits with 12 character commits
- getLabelFunc: (commit) => {return commit ? commit.id.substring(0,12) : '?';},
+ getLabelFunc: (commit) => {return commit ? commit.label() : '?';},
getScaleFunc: (commit) => commit.uuid,
exporter: (updateFunction) => {
updatesArray.push((scale) => {updateFunction(scaleForRepository(scale));});
@@ -653,7 +652,7 @@
if (!params.branch)
delete params.branch;
const query = paramsToQuery(params);
- return `<a href="" target="_blank">${commit.id.substring(0,12)}</a>`;
+ return `<a href="" target="_blank">${commit.label()}</a>`;
}).join(', ')}
<br>
${partialConfiguration}
Modified: trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/templates/commits.html (274247 => 274248)
--- trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/templates/commits.html 2021-03-11 00:00:25 UTC (rev 274247)
+++ trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/templates/commits.html 2021-03-11 00:01:13 UTC (rev 274248)
@@ -30,7 +30,7 @@
<script type="module">
import {REF, DOM} from '/library/js/Ref.js';
import {ErrorDisplay} from '/assets/js/common.js';
-import {CommitTable} from '/assets/js/commit.js';
+import {Commit, CommitTable} from '/assets/js/commit.js';
import {Drawer, BranchSelector, LimitSlider} from '/assets/js/drawer.js';
var _oneLine_ = true;
@@ -71,7 +71,7 @@
fetch(query ? 'api/commits?' + query : 'api/commits').then(response => {
response.json().then(json => {
if (myDispatch == this.latestDispatch)
- this.ref.setState(json);
+ this.ref.setState(json.map(datum => new Commit(datum)));
});
}).catch(error => {
if (myDispatch == this.latestDispatch)
Modified: trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/templates/investigate.html (274247 => 274248)
--- trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/templates/investigate.html 2021-03-11 00:00:25 UTC (rev 274247)
+++ trunk/Tools/Scripts/libraries/resultsdbpy/resultsdbpy/view/templates/investigate.html 2021-03-11 00:01:13 UTC (rev 274248)
@@ -159,7 +159,7 @@
return `<a href=""
commits.length == repositories.size ?
- commits.reverse().map(commit => commit.id.substring(0,12)).join(', ') :
+ commits.reverse().map(commit => commit.label()).join(', ') :
`${commits.length} commits`
}</a>`;
})()}
@@ -221,7 +221,7 @@
</div>
<a class="text block" style="width: calc(100% - var(--mediumSize) - 16px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; "href=""
${commits.length ?
- `${commits[0].id.substring(0,12)} ${commits.length > 1 ? commits[commits.length - 1].id.substring(0,12) : ''}` :
+ `${commits[0].label()} ${commits.length > 1 ? commits[commits.length - 1].label() : ''}` :
'?'} on ${failure.configuration}
</a>
</div>`;
Modified: trunk/Tools/Scripts/libraries/resultsdbpy/setup.py (274247 => 274248)
--- trunk/Tools/Scripts/libraries/resultsdbpy/setup.py 2021-03-11 00:00:25 UTC (rev 274247)
+++ trunk/Tools/Scripts/libraries/resultsdbpy/setup.py 2021-03-11 00:01:13 UTC (rev 274248)
@@ -30,7 +30,7 @@
setup(
name='resultsdbpy',
- version='1.1.3',
+ version='2.0.1',
description='Library for visualizing, processing and storing test results.',
long_description=readme(),
classifiers=[