Format revisions for display according to repository type https://bugs.webkit.org...
authorjmarcell@apple.com <jmarcell@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Feb 2016 06:07:21 +0000 (06:07 +0000)
committerjmarcell@apple.com <jmarcell@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Feb 2016 06:07:21 +0000 (06:07 +0000)
Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
(BuildbotQueueView.prototype._popoverLinesForCommitRange): Use new _formatRevisionForDisplay to display revisions according
to repository type.
(BuildbotQueueView.prototype._revisionContentWithPopoverForIteration): Ditto.
(BuildbotQueueView.prototype._formatRevisionForDisplay): Formats revisions for display according to repository type.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js: Added unit tests to test new
_formatRevisionForDisplay function.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196109 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js
Tools/ChangeLog

index 0109844..e17fb63 100644 (file)
@@ -124,7 +124,7 @@ BuildbotQueueView.prototype = {
             linkElement.className = "revision";
             linkElement.href = trac.revisionURL(commit.revisionNumber);
             linkElement.target = "_blank";
-            linkElement.textContent = "r" + commit.revisionNumber;
+            linkElement.textContent = this._formatRevisionForDisplay(commit.revisionNumber, branch.repository);
             result.appendChild(linkElement);
 
             var authorElement = document.createElement("span");
@@ -146,7 +146,7 @@ BuildbotQueueView.prototype = {
         // the queue, see _should_file_trigger_build in wkbuild.py.
         var commits = trac.commitsOnBranch(branch.name, function(commit) { return commit.revisionNumber >= firstRevisionNumber && commit.revisionNumber <= lastRevisionNumber; });
         return commits.map(function(commit) {
-            return lineForCommit(trac, commit);
+            return lineForCommit.call(this, trac, commit);
         }, this).reverse();
     },
 
@@ -221,14 +221,7 @@ BuildbotQueueView.prototype = {
         var repositoryName = repository.name;
         console.assert(iteration.revision[repositoryName]);
         var content = document.createElement("span");
-        var revision = iteration.revision[repositoryName];
-        if (repository.isSVN)
-            content.textContent = "r" + revision;
-        else if (repository.isGit) {
-            // Truncating for display. Git traditionally uses seven characters for a short hash.
-            content.textContent = revision.substr(0, 7);
-        } else
-            console.assert(false, "Should not get here; " + repository.name + " did not specify a known VCS type.");
+        content.textContent = this._formatRevisionForDisplay(iteration.revision[repositoryName], repository);
         content.classList.add("revision-number");
 
         if (previousIteration) {
@@ -340,6 +333,14 @@ BuildbotQueueView.prototype = {
     _unauthorizedAccess: function(event)
     {
         this.updateSoon();
-    }
+    },
 
+    _formatRevisionForDisplay: function(revision, repository)
+    {
+        console.assert(repository.isSVN || repository.isGit, "Should not get here; " + repository.name + " did not specify a known VCS type.");
+        if (repository.isSVN)
+            return "r" + revision;
+        // Truncating for display. Git traditionally uses seven characters for a short hash.
+        return revision.substr(0, 7);
+    }
 };
index 8fee270..366f00b 100644 (file)
@@ -173,6 +173,22 @@ test("_revisionContentWithPopoverForIteration has previousIteration", function()
     strictEqual(nodeList.length, 2, "has 2 commits");
 });
 
+test("_formatRevisionForDisplay Subversion", function()
+{
+    var repository = this.trunkBranch.repository;
+    repository.isSVN = true;
+    repository.isGit = false;
+    strictEqual(this.view._formatRevisionForDisplay(33018, repository), "r33018", "Should be r33018")
+});
+
+test("_formatRevisionForDisplay Git", function()
+{
+    var repository = this.trunkBranch.repository;
+    repository.isSVN = false;
+    repository.isGit = true;
+    strictEqual(this.view._formatRevisionForDisplay("0e498db5d8e5b5a342631", repository), "0e498db", "Should be 0e498db");
+});
+
 module("BuildBotQueue", {
     setup: function() {
         this.queue = new MockBuildbotQueue();
index cbf482e..f6db766 100644 (file)
@@ -1,3 +1,18 @@
+2016-02-03  Jason Marcell  <jmarcell@apple.com>
+
+        Format revisions for display according to repository type
+        https://bugs.webkit.org/show_bug.cgi?id=153818
+
+        Reviewed by Alexey Proskuryakov.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
+        (BuildbotQueueView.prototype._popoverLinesForCommitRange): Use new _formatRevisionForDisplay to display revisions according
+        to repository type.
+        (BuildbotQueueView.prototype._revisionContentWithPopoverForIteration): Ditto.
+        (BuildbotQueueView.prototype._formatRevisionForDisplay): Formats revisions for display according to repository type.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js: Added unit tests to test new
+        _formatRevisionForDisplay function.
+
 2016-02-03  Aakash Jain  <aakash_jain@apple.com>
 
         Logs/CoreSimulator filling up OS disk on WebKit testers