WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
153624
Add code to parse the git branches out of the Trac RSS feed
https://bugs.webkit.org/show_bug.cgi?id=153624
Summary
Add code to parse the git branches out of the Trac RSS feed
Jason Marcell
Reported
2016-01-28 17:15:22 PST
Add code to parse the git branches out of the Trac RSS feed
Attachments
Patch
(6.52 KB, patch)
2016-01-28 17:17 PST
,
Jason Marcell
no flags
Details
Formatted Diff
Diff
Adds git branches to the timeline RSS feed
(1.37 KB, application/rss+xml)
2016-02-01 11:44 PST
,
Jason Marcell
no flags
Details
Patch
(14.17 KB, patch)
2016-02-01 14:35 PST
,
Jason Marcell
no flags
Details
Formatted Diff
Diff
Patch
(14.88 KB, patch)
2016-02-01 16:19 PST
,
Jason Marcell
dbates
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Jason Marcell
Comment 1
2016-01-28 17:17:42 PST
Created
attachment 270165
[details]
Patch
Daniel Bates
Comment 2
2016-01-28 19:34:27 PST
Comment on
attachment 270165
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=270165&action=review
> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:69 > + return (!commit.containsBranchLocation || commit.branchName === branchName || (commit.branchName instanceof Array && commit.branchName.includes(branchName))) && filter(commit);
This does not seem like the correct approach. In particular, its weird that branchName could be either a String object or an Array object.
> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:172 > + var gitBranches = doc.evaluate("./branches", commitElement, null, XPathResult.STRING_TYPE).stringValue; > + if (gitBranches) { > + result.containsBranchLocation = true; > + result.branchName = gitBranches.split(", "); > + }
We need a test case for a multi-branch commit.
> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js:60 > + strictEqual(commits.length, 6, "should have 6 commits");
It's weird that there are six commits because on first glance this test only parses a single commit. I know that five of these commits are hardcoded in class MockTrac. Can we extract the hardcoded recorded commits from MockTrac into some kind of constant, maybe MockTrac.EXAMPLE_TRAC_COMMITS, such that MockTrac has no recorded commits by default? Unit tests that want to make use of this set of mock commits could then set MockTrac.recordedCommits = MockTrac.EXAMPLE_TRAC_COMMITS. And we would not make use of this set of commits for this test.
Jason Marcell
Comment 3
2016-02-01 11:44:19 PST
Created
attachment 270409
[details]
Adds git branches to the timeline RSS feed Alexey suggested checking this into the repository somewhere but I'm not sure where it belongs.
Jason Marcell
Comment 4
2016-02-01 14:35:01 PST
Created
attachment 270426
[details]
Patch
Jason Marcell
Comment 5
2016-02-01 14:37:04 PST
(In reply to
comment #2
)
> Comment on
attachment 270165
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=270165&action=review
> > > Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:69 > > + return (!commit.containsBranchLocation || commit.branchName === branchName || (commit.branchName instanceof Array && commit.branchName.includes(branchName))) && filter(commit); > > This does not seem like the correct approach. In particular, its weird that > branchName could be either a String object or an Array object.
I addressed this in the latest patch. I refactored 'branchName' to be 'branches', changed the type of the variable to be an array, and updated the code that interacts with it accordingly.
> > > Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:172 > > + var gitBranches = doc.evaluate("./branches", commitElement, null, XPathResult.STRING_TYPE).stringValue; > > + if (gitBranches) { > > + result.containsBranchLocation = true; > > + result.branchName = gitBranches.split(", "); > > + } > > We need a test case for a multi-branch commit.
I added a test case and corresponding assertions for a multi-branch commit.
> > > Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js:60 > > + strictEqual(commits.length, 6, "should have 6 commits"); > > It's weird that there are six commits because on first glance this test only > parses a single commit. I know that five of these commits are hardcoded in > class MockTrac. Can we extract the hardcoded recorded commits from MockTrac > into some kind of constant, maybe MockTrac.EXAMPLE_TRAC_COMMITS, such that > MockTrac has no recorded commits by default? Unit tests that want to make > use of this set of mock commits could then set MockTrac.recordedCommits = > MockTrac.EXAMPLE_TRAC_COMMITS. And we would not make use of this set of > commits for this test.
I did this in the latest patch as well.
Daniel Bates
Comment 6
2016-02-01 15:21:16 PST
Comment on
attachment 270426
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=270426&action=review
> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:169 > + var gitBranches = doc.evaluate("./branches", commitElement, null, XPathResult.STRING_TYPE).stringValue;
I am assuming that doc.evaluate("./branches", commitElement, null, XPathResult.STRING_TYPE) always returns an object. We should add a test case for an entry that does not have <branches>.
> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js:54 > + client.open('GET', 'test-fixture-git-trac-rss.xml', false);
Nit: We use single quoted string literals here and double quoted string literals below. We should pick one quoting style for string literals and stick with it.
> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js:58 > + client.onreadystatechange = function () { > + if (client.readyState === client.DONE) > + this.trac._loaded(client.responseXML); > + }.bind(this);
Nit: We're underutilizing the the onreadystatechange listener. Since we only care if the load completed successfully, we could register a onload listener. See <
https://xhr.spec.whatwg.org/#event-handlers
> for a list of the event handlers that can be registered on XMLHttpRequest.
Jason Marcell
Comment 7
2016-02-01 16:19:26 PST
Created
attachment 270448
[details]
Patch
Daniel Bates
Comment 8
2016-02-01 16:28:28 PST
Comment on
attachment 270448
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=270448&action=review
> Tools/ChangeLog:3 > + Add code to parse the git branches out of the Trac RSS feed.
Nit: Remove the period at the end of this line so that it reflects the name of this bug.
> Tools/ChangeLog:9 > + (Trac.prototype.commitsOnBranch): Update filter to check for git branches.
Nit: git => Git
> Tools/ChangeLog:10 > + (Trac.prototype._convertCommitInfoElementToObject): Parse git branches from the Trac RSS feed. Also changed "branchName" to
Ditto.
> Tools/ChangeLog:15 > + fixture that contains XML with a git branch.
Ditto.
> Tools/ChangeLog:16 > + * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js: Added unit test to test parsing git
Ditto.
> Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js:59 > + strictEqual(commits.length, 3, "should have 2 commits");
2 => 3
Jason Marcell
Comment 9
2016-02-01 16:56:36 PST
Landed:
http://trac.webkit.org/changeset/195993
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug