Perf dashboard shouldn't show the full git hash
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Jul 2014 04:59:32 +0000 (04:59 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 19 Jul 2014 04:59:32 +0000 (04:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135083

Reviewed by Benjamin Poulain.

Detect Git/Mercurial hash by checking the length.

If it's a hash, use the first 8 characters in the label
while retaining the full length to be used in hyperlinks.

* public/js/helper-classes.js:
(.this.formattedRevisions):
(TestBuild):

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

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/js/helper-classes.js

index 7c814bd..776db3c 100644 (file)
@@ -1,3 +1,19 @@
+2014-07-18  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Perf dashboard shouldn't show the full git hash
+        https://bugs.webkit.org/show_bug.cgi?id=135083
+
+        Reviewed by Benjamin Poulain.
+
+        Detect Git/Mercurial hash by checking the length.
+
+        If it's a hash, use the first 8 characters in the label
+        while retaining the full length to be used in hyperlinks.
+
+        * public/js/helper-classes.js:
+        (.this.formattedRevisions):
+        (TestBuild):
+
 2014-05-29  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add an instruction on how to backup the database.
index 69ae5f2..8d6a746 100755 (executable)
@@ -85,19 +85,30 @@ function TestBuild(repositories, builders, platform, rawRun) {
                 previousRevision = undefined;
 
             var revisionPrefix = '';
-            var revisionDelimitor = '-';
+            var revisionDelimiter = '-';
+            var isHash = false;
             if (parseInt(currentRevision) == currentRevision) { // e.g. r12345.
                 revisionPrefix = 'r';
                 if (previousRevision)
                     previousRevision = (parseInt(previousRevision) + 1);
             } else if (currentRevision.indexOf(' ') >= 0) // e.g. 10.9 13C64.
-                revisionDelimitor = ' - ';
+                revisionDelimiter = ' - ';
+            else if (currentRevision.length == 40) // e.g. git hash
+                isHash = true;
 
             var labelForThisRepository;
-            if (previousRevision)
-                labelForThisRepository = revisionPrefix + previousRevision + revisionDelimitor + revisionPrefix + currentRevision;
-            else
-                labelForThisRepository = '@ ' + revisionPrefix + currentRevision;
+            if (isHash) {
+                formattedCurrentHash = currentRevision.substring(0, 8);
+                if (previousRevision)
+                    labelForThisRepository = previousRevision.substring(0, 8) + '..' + formattedCurrentHash;
+                else
+                    labelForThisRepository = '@ ' + formattedCurrentHash;
+            } else {
+                if (previousRevision)
+                    labelForThisRepository = revisionPrefix + previousRevision + revisionDelimiter + revisionPrefix + currentRevision;
+                else
+                    labelForThisRepository = '@ ' + revisionPrefix + currentRevision;
+            }
 
             var url;
             var repository = repositories[repositoryName];