haikuwebkit/Websites/perf.webkit.org/browser-tests/commit-log-viewer-tests.js

204 lines
9.2 KiB
JavaScript
Raw Permalink Normal View History

Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
describe('CommitLogViewer', () => {
function importCommitLogViewer(context)
{
const scripts = [
'../shared/statistics.js',
'instrumentation.js',
'lazily-evaluated-function.js',
'models/data-model.js',
'models/repository.js',
'models/commit-set.js',
'models/commit-log.js',
Add the basic support for writing components in node.js https://bugs.webkit.org/show_bug.cgi?id=186299 Reviewed by Antti Koivisto. Add the basic support for writing components in node.js for generating rich email notifications. To do this, this patch introduces MarkupComponentBase and MarkupPage which implement similar API to ComponentBase and Page classes of v3 UI code. This enables us to share code between frontend and the backend in the future. Because there is no support for declarative custom elements or shadow root in HTML, MarkupComponentBase uses a similar but distinct concept of "content" tree to represent the "DOM" tree for a component. When generating the HTML, MarkupComponentBase and MarkupPage collectively transforms stylesheets and flattens the tree into a single HTML. In order to keep this flatteneing logic simple, MarkupComponentBase only supports a very small subset of CSS selectors to select elements by their local names and class names. Specifically, each class name and element name based selectors are replaced by a globally unique class name based selector, and each element which matches the selector is applied of the same globally unique class name. The transformation is applied when constructing the "content" tree as well as calls to renderReplace. Because much of v3 frontend code relies on DOM API, this patch also implements the simplest form of a fake DOM API as MarkupNode, MarkupParentNode, MarkupElement, and MarkupText. In order to avoid reimplementing HTML & CSS parsers, this patch introduces the concept of content and style templates to ComponentBase which are JSON alternatives to HTML & CSS template strings which can be used in both frontend & backend. * browser-tests/close-button-tests.js: Include CommonComponentBase. * browser-tests/commit-log-viewer-tests.js: Ditto. * browser-tests/component-base-tests.js: Ditto. Added a test cases for content & style templates. (async.importComponentBase): Added. * browser-tests/editable-text-tests.js: Include CommonComponentBase. * browser-tests/index.html: * browser-tests/markup-page-tests.js: Added. * browser-tests/page-router-tests.js: Include CommonComponentBase. * browser-tests/page-tests.js: Ditto. * browser-tests/test-group-form-tests.js: Ditto. * public/shared/common-component-base.js: Added. (CommonComponentBase): Extracted out of ComponentBase. (CommonComponentBase.prototype.renderReplace): Added. (CommonComponentBase.renderReplace): Moved from ComponentBase. (CommonComponentBase.prototype._recursivelyUpgradeUnknownElements): Moved and renamed from ComponentBase's _recursivelyReplaceUnknownElementsByComponents. (CommonComponentBase.prototype._upgradeUnknownElement): Extracted out of the same function. (CommonComponentBase._constructStylesheetFromTemplate): Added. (CommonComponentBase._constructNodeTreeFromTemplate): Added. (CommonComponentBase.prototype.createElement): Added. (CommonComponentBase.createElement): Moved from ComponentBase. (CommonComponentBase._addContentToElement): Moved from ComponentBase. (CommonComponentBase.prototype.createLink): Added. (CommonComponentBase.createLink): Moved from ComponentBase. (CommonComponentBase._context): Added. Set to document in a browser and MarkupDocument in node.js. (CommonComponentBase._isNode): Added. Set to a function which does instanceof Node/MarkupNode check. (CommonComponentBase._baseClass): Added. Set to ComponentBase or MarkupComponentBase. * public/v3/components/base.js: (ComponentBase): (ComponentBase.prototype._ensureShadowTree): Added the support for the content and style templates. Also avoid parsing the html template each time a component is instantiated by caching the result. * public/v3/index.html: * tools/js/markup-component.js: Added. (MarkupDocument): Added. A fake Document. (MarkupDocument.prototype.createContentRoot): A substitude for attachShadow. (MarkupDocument.prototype.createElement): (MarkupDocument.prototype.createTextNode): (MarkupDocument.prototype._idForClone): (MarkupDocument.prototype.reset): (MarkupDocument.prototype.markup): (MarkupDocument.prototype.escapeAttributeValue): (MarkupDocument.prototype.escapeNodeData): (MarkupNode): Added. A fake Node. Each node gets an unique ID. (MarkupNode.prototype._markup): (MarkupNode.prototype.clone): Implemented by the leave class. (MarkupNode.prototype._cloneNodeData): (MarkupNode.prototype.remove): (MarkupParentNode): Added. An equivalent of ContainerNode in WebCore. (MarkupParentNode.prototype.get childNodes): (MarkupParentNode.prototype._cloneNodeData): (MarkupParentNode.prototype.appendChild): (MarkupParentNode.prototype.removeChild): (MarkupParentNode.prototype.removeAllChildren): (MarkupParentNode.prototype.replaceChild): (MarkupContentRoot): Added. Used like a shadow tree. (MarkupContentRoot.prototype._markup): Added. (MarkupElement): Added. A fake Element. It also implements a subset of IDL attributes implemented by subclasses such as HTMLInputElement for simplicity. (MarkupElement.prototype.get id): Added. (MarkupElement.prototype.get localName): Added. (MarkupElement.prototype.clone): Added. (MarkupElement.prototype.appendChild): Added. (MarkupElement.prototype.addEventListener): Added. (MarkupElement.prototype.setAttribute): Added. (MarkupElement.prototype.getAttribute): Added. (MarkupElement.prototype.get attributes): Added. (MarkupElement.prototype.get textContent): Added. (MarkupElement.prototype.set textContent): Added. (MarkupElement.prototype._serializeStyle): Added. (MarkupElement.prototype._markup): Added. Flattens the tree with content tree like copy & paste so this can't be used to implement innerHTML. (MarkupElement.prototype.get value): Added. (MarkupElement.prototype.set value): Added. (MarkupElement.prototype.get style): Added. Returns a fake writeonly CSSStyleDeclaration. (MarkupElement.prototype.set style): Added. (MarkupElement.get selfClosingNames): Added. A small list of self-closing tags for the HTML generation. (MarkupText): Added. (MarkupText.prototype.clone): Added. (MarkupText.prototype._markup): Added. (MarkupText.prototype.get data): Added. (MarkupText.prototype.set data): Added. (MarkupComponentBase): Added. (MarkupComponentBase.prototype.element): Added. Like ComponentBase's element. (MarkupComponentBase.prototype.content): Added. Like ComponentBase's content. (MarkupComponentBase.prototype._findElementRecursivelyById): Added. A fake getElementById. (MarkupComponentBase.prototype.render): Added. Like ComponentBase's render. (MarkupComponentBase.prototype.runRenderLoop): Added. In ComponentBase, we use requestAnimationFrame. In MarkupComponentBase, we keep rendering until the queue drains empty. (MarkupComponentBase.prototype.renderReplace): Added. Like ComponentBase's renderReplace but applies the transformation of classes to workaround the lack of shadow tree support in scriptless HTML. (MarkupComponentBase.prototype._applyStyleOverrides): Added. Recursively applies the transformation. (MarkupComponentBase.prototype._ensureContentTree): Added. Like ComponentBase's _ensureShadowTree. (MarkupComponentBase.reset): Added. (MarkupComponentBase._parseTemplates): Added. Parses the content & style templates, and generates the transformed fake DOM tree and stylesheet text whereby selectors in each component is modified to be unique across all components. The function to apply the necessary changes to an element is saved in the global map of components, and later used in renderReplace via _applyStyleOverrides. (MarkupComponentBase.defineElement): Added. Like ComponentBase's defineElement. (MarkupComponentBase.prototype.createEventHandler): Added. (MarkupComponentBase.createEventHandler): Added. (MarkupPage): Added. The top-level component responsible for generating a DOCTYPE, head, and body. (MarkupPage.prototype.pageTitle): Added. (MarkupPage.prototype.content): Added. Overrides the one in MarkupComponentBase to return what would be the content of the body element as opposed to the html element for the connivance of subclasses, and to match the behavior of the frontend Page class. (MarkupPage.prototype.render): Added. (MarkupPage.prototype._updateComponentsStylesheet): Added. Concatenates the transformed stylesheet of all components used. (MarkupPage.get contentTemplate): Added. (MarkupPage.prototype.generateMarkup): Added. Enqueues the page to render, spin the render loop, and generates the HTML. We enqueue the page twice in order to invoke _updateComponentsStylesheet after all subcomponent had finished rendering. * unit-tests/markup-component-base-tests.js: Added. * unit-tests/markup-element-tests.js: Added. (.createElement): Added. * unit-tests/markup-page-tests.js: Added. Canonical link: https://commits.webkit.org/201761@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-07 18:25:35 +00:00
'../shared/common-component-base.js',
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
'components/base.js',
'components/spinner-icon.js',
'components/commit-log-viewer.js'];
Add the basic support for writing components in node.js https://bugs.webkit.org/show_bug.cgi?id=186299 Reviewed by Antti Koivisto. Add the basic support for writing components in node.js for generating rich email notifications. To do this, this patch introduces MarkupComponentBase and MarkupPage which implement similar API to ComponentBase and Page classes of v3 UI code. This enables us to share code between frontend and the backend in the future. Because there is no support for declarative custom elements or shadow root in HTML, MarkupComponentBase uses a similar but distinct concept of "content" tree to represent the "DOM" tree for a component. When generating the HTML, MarkupComponentBase and MarkupPage collectively transforms stylesheets and flattens the tree into a single HTML. In order to keep this flatteneing logic simple, MarkupComponentBase only supports a very small subset of CSS selectors to select elements by their local names and class names. Specifically, each class name and element name based selectors are replaced by a globally unique class name based selector, and each element which matches the selector is applied of the same globally unique class name. The transformation is applied when constructing the "content" tree as well as calls to renderReplace. Because much of v3 frontend code relies on DOM API, this patch also implements the simplest form of a fake DOM API as MarkupNode, MarkupParentNode, MarkupElement, and MarkupText. In order to avoid reimplementing HTML & CSS parsers, this patch introduces the concept of content and style templates to ComponentBase which are JSON alternatives to HTML & CSS template strings which can be used in both frontend & backend. * browser-tests/close-button-tests.js: Include CommonComponentBase. * browser-tests/commit-log-viewer-tests.js: Ditto. * browser-tests/component-base-tests.js: Ditto. Added a test cases for content & style templates. (async.importComponentBase): Added. * browser-tests/editable-text-tests.js: Include CommonComponentBase. * browser-tests/index.html: * browser-tests/markup-page-tests.js: Added. * browser-tests/page-router-tests.js: Include CommonComponentBase. * browser-tests/page-tests.js: Ditto. * browser-tests/test-group-form-tests.js: Ditto. * public/shared/common-component-base.js: Added. (CommonComponentBase): Extracted out of ComponentBase. (CommonComponentBase.prototype.renderReplace): Added. (CommonComponentBase.renderReplace): Moved from ComponentBase. (CommonComponentBase.prototype._recursivelyUpgradeUnknownElements): Moved and renamed from ComponentBase's _recursivelyReplaceUnknownElementsByComponents. (CommonComponentBase.prototype._upgradeUnknownElement): Extracted out of the same function. (CommonComponentBase._constructStylesheetFromTemplate): Added. (CommonComponentBase._constructNodeTreeFromTemplate): Added. (CommonComponentBase.prototype.createElement): Added. (CommonComponentBase.createElement): Moved from ComponentBase. (CommonComponentBase._addContentToElement): Moved from ComponentBase. (CommonComponentBase.prototype.createLink): Added. (CommonComponentBase.createLink): Moved from ComponentBase. (CommonComponentBase._context): Added. Set to document in a browser and MarkupDocument in node.js. (CommonComponentBase._isNode): Added. Set to a function which does instanceof Node/MarkupNode check. (CommonComponentBase._baseClass): Added. Set to ComponentBase or MarkupComponentBase. * public/v3/components/base.js: (ComponentBase): (ComponentBase.prototype._ensureShadowTree): Added the support for the content and style templates. Also avoid parsing the html template each time a component is instantiated by caching the result. * public/v3/index.html: * tools/js/markup-component.js: Added. (MarkupDocument): Added. A fake Document. (MarkupDocument.prototype.createContentRoot): A substitude for attachShadow. (MarkupDocument.prototype.createElement): (MarkupDocument.prototype.createTextNode): (MarkupDocument.prototype._idForClone): (MarkupDocument.prototype.reset): (MarkupDocument.prototype.markup): (MarkupDocument.prototype.escapeAttributeValue): (MarkupDocument.prototype.escapeNodeData): (MarkupNode): Added. A fake Node. Each node gets an unique ID. (MarkupNode.prototype._markup): (MarkupNode.prototype.clone): Implemented by the leave class. (MarkupNode.prototype._cloneNodeData): (MarkupNode.prototype.remove): (MarkupParentNode): Added. An equivalent of ContainerNode in WebCore. (MarkupParentNode.prototype.get childNodes): (MarkupParentNode.prototype._cloneNodeData): (MarkupParentNode.prototype.appendChild): (MarkupParentNode.prototype.removeChild): (MarkupParentNode.prototype.removeAllChildren): (MarkupParentNode.prototype.replaceChild): (MarkupContentRoot): Added. Used like a shadow tree. (MarkupContentRoot.prototype._markup): Added. (MarkupElement): Added. A fake Element. It also implements a subset of IDL attributes implemented by subclasses such as HTMLInputElement for simplicity. (MarkupElement.prototype.get id): Added. (MarkupElement.prototype.get localName): Added. (MarkupElement.prototype.clone): Added. (MarkupElement.prototype.appendChild): Added. (MarkupElement.prototype.addEventListener): Added. (MarkupElement.prototype.setAttribute): Added. (MarkupElement.prototype.getAttribute): Added. (MarkupElement.prototype.get attributes): Added. (MarkupElement.prototype.get textContent): Added. (MarkupElement.prototype.set textContent): Added. (MarkupElement.prototype._serializeStyle): Added. (MarkupElement.prototype._markup): Added. Flattens the tree with content tree like copy & paste so this can't be used to implement innerHTML. (MarkupElement.prototype.get value): Added. (MarkupElement.prototype.set value): Added. (MarkupElement.prototype.get style): Added. Returns a fake writeonly CSSStyleDeclaration. (MarkupElement.prototype.set style): Added. (MarkupElement.get selfClosingNames): Added. A small list of self-closing tags for the HTML generation. (MarkupText): Added. (MarkupText.prototype.clone): Added. (MarkupText.prototype._markup): Added. (MarkupText.prototype.get data): Added. (MarkupText.prototype.set data): Added. (MarkupComponentBase): Added. (MarkupComponentBase.prototype.element): Added. Like ComponentBase's element. (MarkupComponentBase.prototype.content): Added. Like ComponentBase's content. (MarkupComponentBase.prototype._findElementRecursivelyById): Added. A fake getElementById. (MarkupComponentBase.prototype.render): Added. Like ComponentBase's render. (MarkupComponentBase.prototype.runRenderLoop): Added. In ComponentBase, we use requestAnimationFrame. In MarkupComponentBase, we keep rendering until the queue drains empty. (MarkupComponentBase.prototype.renderReplace): Added. Like ComponentBase's renderReplace but applies the transformation of classes to workaround the lack of shadow tree support in scriptless HTML. (MarkupComponentBase.prototype._applyStyleOverrides): Added. Recursively applies the transformation. (MarkupComponentBase.prototype._ensureContentTree): Added. Like ComponentBase's _ensureShadowTree. (MarkupComponentBase.reset): Added. (MarkupComponentBase._parseTemplates): Added. Parses the content & style templates, and generates the transformed fake DOM tree and stylesheet text whereby selectors in each component is modified to be unique across all components. The function to apply the necessary changes to an element is saved in the global map of components, and later used in renderReplace via _applyStyleOverrides. (MarkupComponentBase.defineElement): Added. Like ComponentBase's defineElement. (MarkupComponentBase.prototype.createEventHandler): Added. (MarkupComponentBase.createEventHandler): Added. (MarkupPage): Added. The top-level component responsible for generating a DOCTYPE, head, and body. (MarkupPage.prototype.pageTitle): Added. (MarkupPage.prototype.content): Added. Overrides the one in MarkupComponentBase to return what would be the content of the body element as opposed to the html element for the connivance of subclasses, and to match the behavior of the frontend Page class. (MarkupPage.prototype.render): Added. (MarkupPage.prototype._updateComponentsStylesheet): Added. Concatenates the transformed stylesheet of all components used. (MarkupPage.get contentTemplate): Added. (MarkupPage.prototype.generateMarkup): Added. Enqueues the page to render, spin the render loop, and generates the HTML. We enqueue the page twice in order to invoke _updateComponentsStylesheet after all subcomponent had finished rendering. * unit-tests/markup-component-base-tests.js: Added. * unit-tests/markup-element-tests.js: Added. (.createElement): Added. * unit-tests/markup-page-tests.js: Added. Canonical link: https://commits.webkit.org/201761@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232588 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-07 18:25:35 +00:00
return context.importScripts(scripts, 'CommonComponentBase', 'ComponentBase', 'CommitLogViewer', 'Repository', 'CommitLog', 'RemoteAPI').then(() => {
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
return context.symbols.CommitLogViewer;
});
}
const webkitCommit210948 = {
"id": "185326",
"revision": "210948",
"repository": 1,
"previousCommit": null,
"ownsCommits": false,
"time": +new Date("2017-01-20 02:52:34.577Z"),
"authorName": "Zalan Bujtas",
"authorEmail": "zalan@apple.com",
"message": "a message",
};
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
const webkitCommit210949 = {
"id": "185334",
"revision": "210949",
Add sub-commit UI in commit log viewer. https://bugs.webkit.org/show_bug.cgi?id=170379 Reviewed by Ryosuke Niwa. Add an API to return sub-commits for a given commit. Add sub-commit difference viewer into commit log viewer to show changed sub-commits between two commits. Add 'ownsSubCommits' info in 'api/commits' return values. Extend 'api/manifest' to include whether a repositories owns other repositories. Only show this sub-commit difference viewer when a repository owns other repositories and both commits owns sub-commits. Add unit tests for those new features. * browser-tests/commit-log-viewer-tests.js: Updated test cases. * public/api/commits.php: Added 'sub-commits' to provide sub-commit for a given commit. * public/include/commit-log-fetcher.php: Added function to query sub-commit from database. Added 'repository' and 'ownsSubCommits' fields in returning commits. * public/v3/components/expand-collapse-button.js: Added. (ExpandCollapseButton): (ExpandCollapseButton.prototype.didConstructShadowTree): Changes state on click and dispatches 'toggle' event. (ExpandCollapseButton.sizeFactor): (ExpandCollapseButton.buttonContent): (ExpandCollapseButton.cssTemplate): * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype._renderCommitList): Added sub-commit viewer if two adjacent commits both have sub-commits. (CommitLogViewer.cssTemplate): * public/v3/components/sub-commit-viewer.js: Added. (SubCommitViewer): Added 'SubCommitViewer' class to represent the sub-commit differences between two given commits.` (SubCommitViewer.prototype.didConstructShadowTree): Makes 'expand-collapse' button listen to 'toggle' event. (SubCommitViewer.prototype._toggleVisibility): Updates UI once 'expand-collapse' button is clicked. (SubCommitViewer.prototype.render): Render sub-commit view based on the state. (SubCommitViewer.prototype._renderSubcommitTable): Generates sub-commits difference table entries. (SubCommitViewer.htmlTemplate): (SubCommitViewer.cssTemplate): * public/v3/index.html: Added 'sub-commit-viewer.js' and 'expand-collapse-button.js'. * public/v3/models/commit-log.js: (CommitLog): Added '_subCommits'. (CommitLog.prototype.updateSingleton): Updates 'rawData.ownsSubCommits' as well. (CommitLog.prototype.ownsSubCommits): (CommitLog.prototype.subCommits): Added. Returns sub-commits. (CommitLog.prototype.fetchSubCommits): Added. Fetches sub-commits if haven't fetched them before. (CommitLog.prototype._buildSubCommitMap): Added. Creates a map which maps repositories to commits. (CommitLog.diffSubCommits): Added. Finds difference between two given commits. (CommitLog.fetchBetweenRevisions): Updated due to '_constructFromRawData' change. (CommitLog.fetchForSingleRevision): Updated due to '_constructFromRawData' change. (CommitLog._constructFromRawData): Removed first argument 'repository' as it can be determined by calling 'Repository.findById'. * public/v3/models/repository.js: (Repository): (Repository.prototype.owner): Returns the owner id. (Repository.prototype.ownedRepositories): Returns a list of repositories owned by this repository. * server-tests/api-commits-tests.js: Added tests for 'sub-commits' filter. * server-tests/api-manifest-tests.js: Added a test. * unit-tests/commit-log-tests.js: Added tests for 'fetchSubCommits' and 'diffSubCommits'. * unit-tests/resources/mock-v3-models.js: Added 'ownerRepository' and 'ownedRepository'. Canonical link: https://commits.webkit.org/187795@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-14 23:03:19 +00:00
"repository": 1,
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
"previousCommit": null,
Use 'owned commit' instead of 'sub commit' whenever refers to a commit owned by another commit. https://bugs.webkit.org/show_bug.cgi?id=177178 Reviewed by Ryosuke Niwa. We use both 'owned commit' and 'sub commit' to refer to a commit owned by an another commit. We should use one term instead of two. Renaming 'subCommit' to 'ownedCommit', 'ownsSubCommit' to 'ownsCommit' and 'sub-commit' to 'owned-commit'. * browser-tests/commit-log-viewer-tests.js: * public/api/commits.php: * public/api/report-commits.php: * public/include/commit-log-fetcher.php: * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype._renderCommitList): * public/v3/components/owned-commit-viewer.js: Renamed from Websites/perf.webkit.org/public/v3/components/sub-commit-viewer.js. (OwnedCommitViewer): (OwnedCommitViewer.prototype.didConstructShadowTree): (OwnedCommitViewer.prototype._toggleVisibility): (OwnedCommitViewer.prototype.render): (OwnedCommitViewer.prototype._renderOwnedCommitTable): (OwnedCommitViewer.htmlTemplate): (OwnedCommitViewer.cssTemplate): * public/v3/index.html: * public/v3/models/commit-log.js: (CommitLog): (CommitLog.prototype.updateSingleton): (CommitLog.prototype.ownsCommits): (CommitLog.prototype.fetchOwnedCommits): (CommitLog.prototype._buildOwnedCommitMap): (CommitLog.diffOwnedCommits): (CommitLog.prototype.ownsSubCommits): Deleted. (CommitLog.prototype.fetchSubCommits): Deleted. (CommitLog.prototype._buildSubCommitMap): Deleted. (CommitLog.diffSubCommits): Deleted. * server-tests/api-commits-tests.js: * server-tests/api-report-commits-tests.js: * server-tests/tools-os-build-fetcher-tests.js: (return.waitForInvocationPromise.then): (string_appeared_here.return.waitForInvocationPromise.then): * tools/js/os-build-fetcher.js: (prototype._fetchAvailableBuilds): (prototype._addOwnedCommitsForBuild): (prototype._addSubCommitsForBuild): Deleted. * unit-tests/commit-log-tests.js: (return.commit.fetchOwnedCommits.then): (return.fetchingPromise.then): (return.commit.fetchSubCommits.then): Deleted. Canonical link: https://commits.webkit.org/193549@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-19 21:47:41 +00:00
"ownsCommits": false,
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
"time": +new Date("2017-01-20T03:23:50.645Z"),
"authorName": "Chris Dumez",
"authorEmail": "cdumez@apple.com",
"message": "some message",
};
const webkitCommit210950 = {
"id": "185338",
"revision": "210950",
Add sub-commit UI in commit log viewer. https://bugs.webkit.org/show_bug.cgi?id=170379 Reviewed by Ryosuke Niwa. Add an API to return sub-commits for a given commit. Add sub-commit difference viewer into commit log viewer to show changed sub-commits between two commits. Add 'ownsSubCommits' info in 'api/commits' return values. Extend 'api/manifest' to include whether a repositories owns other repositories. Only show this sub-commit difference viewer when a repository owns other repositories and both commits owns sub-commits. Add unit tests for those new features. * browser-tests/commit-log-viewer-tests.js: Updated test cases. * public/api/commits.php: Added 'sub-commits' to provide sub-commit for a given commit. * public/include/commit-log-fetcher.php: Added function to query sub-commit from database. Added 'repository' and 'ownsSubCommits' fields in returning commits. * public/v3/components/expand-collapse-button.js: Added. (ExpandCollapseButton): (ExpandCollapseButton.prototype.didConstructShadowTree): Changes state on click and dispatches 'toggle' event. (ExpandCollapseButton.sizeFactor): (ExpandCollapseButton.buttonContent): (ExpandCollapseButton.cssTemplate): * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype._renderCommitList): Added sub-commit viewer if two adjacent commits both have sub-commits. (CommitLogViewer.cssTemplate): * public/v3/components/sub-commit-viewer.js: Added. (SubCommitViewer): Added 'SubCommitViewer' class to represent the sub-commit differences between two given commits.` (SubCommitViewer.prototype.didConstructShadowTree): Makes 'expand-collapse' button listen to 'toggle' event. (SubCommitViewer.prototype._toggleVisibility): Updates UI once 'expand-collapse' button is clicked. (SubCommitViewer.prototype.render): Render sub-commit view based on the state. (SubCommitViewer.prototype._renderSubcommitTable): Generates sub-commits difference table entries. (SubCommitViewer.htmlTemplate): (SubCommitViewer.cssTemplate): * public/v3/index.html: Added 'sub-commit-viewer.js' and 'expand-collapse-button.js'. * public/v3/models/commit-log.js: (CommitLog): Added '_subCommits'. (CommitLog.prototype.updateSingleton): Updates 'rawData.ownsSubCommits' as well. (CommitLog.prototype.ownsSubCommits): (CommitLog.prototype.subCommits): Added. Returns sub-commits. (CommitLog.prototype.fetchSubCommits): Added. Fetches sub-commits if haven't fetched them before. (CommitLog.prototype._buildSubCommitMap): Added. Creates a map which maps repositories to commits. (CommitLog.diffSubCommits): Added. Finds difference between two given commits. (CommitLog.fetchBetweenRevisions): Updated due to '_constructFromRawData' change. (CommitLog.fetchForSingleRevision): Updated due to '_constructFromRawData' change. (CommitLog._constructFromRawData): Removed first argument 'repository' as it can be determined by calling 'Repository.findById'. * public/v3/models/repository.js: (Repository): (Repository.prototype.owner): Returns the owner id. (Repository.prototype.ownedRepositories): Returns a list of repositories owned by this repository. * server-tests/api-commits-tests.js: Added tests for 'sub-commits' filter. * server-tests/api-manifest-tests.js: Added a test. * unit-tests/commit-log-tests.js: Added tests for 'fetchSubCommits' and 'diffSubCommits'. * unit-tests/resources/mock-v3-models.js: Added 'ownerRepository' and 'ownedRepository'. Canonical link: https://commits.webkit.org/187795@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-14 23:03:19 +00:00
"repository": 1,
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
"previousCommit": null,
Use 'owned commit' instead of 'sub commit' whenever refers to a commit owned by another commit. https://bugs.webkit.org/show_bug.cgi?id=177178 Reviewed by Ryosuke Niwa. We use both 'owned commit' and 'sub commit' to refer to a commit owned by an another commit. We should use one term instead of two. Renaming 'subCommit' to 'ownedCommit', 'ownsSubCommit' to 'ownsCommit' and 'sub-commit' to 'owned-commit'. * browser-tests/commit-log-viewer-tests.js: * public/api/commits.php: * public/api/report-commits.php: * public/include/commit-log-fetcher.php: * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype._renderCommitList): * public/v3/components/owned-commit-viewer.js: Renamed from Websites/perf.webkit.org/public/v3/components/sub-commit-viewer.js. (OwnedCommitViewer): (OwnedCommitViewer.prototype.didConstructShadowTree): (OwnedCommitViewer.prototype._toggleVisibility): (OwnedCommitViewer.prototype.render): (OwnedCommitViewer.prototype._renderOwnedCommitTable): (OwnedCommitViewer.htmlTemplate): (OwnedCommitViewer.cssTemplate): * public/v3/index.html: * public/v3/models/commit-log.js: (CommitLog): (CommitLog.prototype.updateSingleton): (CommitLog.prototype.ownsCommits): (CommitLog.prototype.fetchOwnedCommits): (CommitLog.prototype._buildOwnedCommitMap): (CommitLog.diffOwnedCommits): (CommitLog.prototype.ownsSubCommits): Deleted. (CommitLog.prototype.fetchSubCommits): Deleted. (CommitLog.prototype._buildSubCommitMap): Deleted. (CommitLog.diffSubCommits): Deleted. * server-tests/api-commits-tests.js: * server-tests/api-report-commits-tests.js: * server-tests/tools-os-build-fetcher-tests.js: (return.waitForInvocationPromise.then): (string_appeared_here.return.waitForInvocationPromise.then): * tools/js/os-build-fetcher.js: (prototype._fetchAvailableBuilds): (prototype._addOwnedCommitsForBuild): (prototype._addSubCommitsForBuild): Deleted. * unit-tests/commit-log-tests.js: (return.commit.fetchOwnedCommits.then): (return.fetchingPromise.then): (return.commit.fetchSubCommits.then): Deleted. Canonical link: https://commits.webkit.org/193549@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-19 21:47:41 +00:00
"ownsCommits": false,
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
"time": +new Date("2017-01-20T03:49:37.887Z"),
"authorName": "Commit Queue",
"authorEmail": "commit-queue@webkit.org",
"message": "another message",
};
const webkitCommit210950WithRevisionIdentifier = {
"id": "185338",
"revision": "210950",
"revisionIdentifier": "184278@main",
"repository": 1,
"previousCommit": null,
"ownsCommits": false,
"time": +new Date("2017-01-20T03:49:37.887Z"),
"authorName": "Commit Queue",
"authorEmail": "commit-queue@webkit.org",
"message": "another message",
};
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
it('should initially be empty with no spinner', () => {
const context = new BrowsingContext();
return importCommitLogViewer(context).then((CommitLogViewer) => {
const viewer = new CommitLogViewer;
context.document.body.appendChild(viewer.element());
viewer.enqueueToRender();
return waitForComponentsToRender(context).then(() => {
expect(viewer.content('spinner-container').offsetHeight).to.be(0);
expect(viewer.content('commits-list').matches(':empty')).to.be(true);
expect(viewer.content('repository-name').matches(':empty')).to.be(true);
});
});
});
it('should show the repository name and the spinner once it started fetching the list of commits ', () => {
const context = new BrowsingContext();
return importCommitLogViewer(context).then((CommitLogViewer) => {
const Repository = context.symbols.Repository;
const SpinnerIcon = context.symbols.SpinnerIcon;
const ComponentBase = context.symbols.ComponentBase;
const RemoteAPI = context.symbols.RemoteAPI;
const viewer = new CommitLogViewer;
const webkit = new Repository(1, {name: 'WebKit'});
context.document.body.appendChild(viewer.element());
viewer.enqueueToRender();
return waitForComponentsToRender(context).then(() => {
expect(viewer.content('spinner-container').offsetHeight).to.be(0);
expect(viewer.content('commits-list').matches(':empty')).to.be(true);
expect(viewer.content('repository-name').matches(':empty')).to.be(true);
expect(RemoteAPI.requests.length, 0);
viewer.view(webkit, '210948', '210950');
expect(RemoteAPI.requests.length, 1);
return waitForComponentsToRender(context);
}).then(() => {
expect(viewer.content('spinner-container').offsetHeight).to.not.be(0);
expect(viewer.content('commits-list').matches(':empty')).to.be(true);
expect(viewer.content('repository-name').matches(':empty')).to.be(false);
expect(viewer.content('repository-name').textContent).to.contain('WebKit');
});
});
});
it('should show the repository name, the list of commits, and hide the spinner once the list of commits are fetched', () => {
const context = new BrowsingContext();
return importCommitLogViewer(context).then(async (CommitLogViewer) => {
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
const Repository = context.symbols.Repository;
const SpinnerIcon = context.symbols.SpinnerIcon;
const ComponentBase = context.symbols.ComponentBase;
const requests = context.symbols.RemoteAPI.requests;
const viewer = new CommitLogViewer;
const webkit = new Repository(1, {name: 'WebKit'});
context.document.body.appendChild(viewer.element());
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
viewer.enqueueToRender();
await waitForComponentsToRender(context);
viewer.view(webkit, '210948', '210950');
await waitForComponentsToRender(context);
expect(viewer.content('spinner-container').offsetHeight).to.not.be(0);
expect(viewer.content('commits-list').matches(':empty')).to.be(true);
expect(viewer.content('repository-name').matches(':empty')).to.be(false);
expect(viewer.content('repository-name').textContent).to.contain('WebKit');
expect(requests.length).to.be(2);
expect(requests[0].url).to.be('/api/commits/1/?precedingRevision=210948&lastRevision=210950');
expect(requests[1].url).to.be('/api/commits/1/210948');
requests[0].resolve({
"status": "OK",
"commits": [webkitCommit210949, webkitCommit210950],
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
});
requests[1].resolve({
"status": "OK",
"commits": [webkitCommit210948],
});
await requests[0].promise;
await requests[1].promise;
await waitForComponentsToRender(context);
expect(viewer.content('spinner-container').offsetHeight).to.be(0);
expect(viewer.content('commits-list').matches(':empty')).to.be(false);
expect(viewer.content('commits-list').textContent).to.contain('r210949');
expect(viewer.content('commits-list').textContent).to.contain('Chris Dumez');
expect(viewer.content('commits-list').textContent).to.contain('r210950');
expect(viewer.content('commits-list').textContent).to.contain('Commit Queue');
expect(viewer.content('repository-name').matches(':empty')).to.be(false);
expect(viewer.content('repository-name').textContent).to.contain('WebKit');
expect(viewer.content('commits-list').querySelector('a')).to.be(null);
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
});
});
it('should show revision label', async () => {
const context = new BrowsingContext();
const CommitLogViewer = await importCommitLogViewer(context);
const Repository = context.symbols.Repository;
const requests = context.symbols.RemoteAPI.requests;
const viewer = new CommitLogViewer;
const webkit = new Repository(1, {name: 'WebKit'});
context.document.body.appendChild(viewer.element());
viewer.enqueueToRender();
await waitForComponentsToRender(context);
viewer.view(webkit, '210948', '210950');
await waitForComponentsToRender(context);
expect(viewer.content('spinner-container').offsetHeight).to.not.be(0);
expect(viewer.content('commits-list').matches(':empty')).to.be(true);
expect(viewer.content('repository-name').matches(':empty')).to.be(false);
expect(viewer.content('repository-name').textContent).to.contain('WebKit');
expect(requests.length).to.be(2);
expect(requests[0].url).to.be('/api/commits/1/?precedingRevision=210948&lastRevision=210950');
expect(requests[1].url).to.be('/api/commits/1/210948');
requests[0].resolve({
"status": "OK",
"commits": [webkitCommit210949, webkitCommit210950WithRevisionIdentifier],
});
requests[1].resolve({
"status": "OK",
"commits": [webkitCommit210948],
});
await requests[0].promise;
await requests[1].promise;
await waitForComponentsToRender(context);
expect(viewer.content('spinner-container').offsetHeight).to.be(0);
expect(viewer.content('commits-list').matches(':empty')).to.be(false);
expect(viewer.content('commits-list').textContent).to.contain('184278@main (r210950)');
expect(viewer.content('commits-list').textContent).to.contain('Commit Queue');
expect(viewer.content('repository-name').matches(':empty')).to.be(false);
expect(viewer.content('repository-name').textContent).to.contain('WebKit');
expect(viewer.content('commits-list').querySelector('a')).to.be(null);
});
Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits/<repository>/?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. Canonical link: https://commits.webkit.org/186834@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214202 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-21 01:19:39 +00:00
});