<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Teach dashboard code to compare non-integer revisions."
   href="https://bugs.webkit.org/show_bug.cgi?id=152345#c29">Comment # 29</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Teach dashboard code to compare non-integer revisions."
   href="https://bugs.webkit.org/show_bug.cgi?id=152345">bug 152345</a>
              from <span class="vcard"><a class="email" href="mailto:jmarcell&#64;apple.com" title="Jason Marcell &lt;jmarcell&#64;apple.com&gt;"> <span class="fn">Jason Marcell</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=152345#c26">comment #26</a>)
<span class="quote">&gt; Comment on <span class=""><a href="attachment.cgi?id=270457&amp;action=diff" name="attach_270457" title="Patch">attachment 270457</a> <a href="attachment.cgi?id=270457&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=270457&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=270457&amp;action=review</a>
&gt; 
&gt; &gt; Tools/ChangeLog:20
&gt; &gt; +        (Trac.prototype.commitsOnBranchLaterThanRevision): Finds revisions on a branch great later than the specified revision.
&gt; 
&gt; Nit: This sentence does not read well.
&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:290
&gt; &gt; +            indexA = trac.indexOfRevision(a.revision[repositoryName]);
&gt; 
&gt; This will define a global variable named indexA. We should make this a local
&gt; variable as you did for variable trac.
&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:291
&gt; &gt; +            indexB = trac.indexOfRevision(b.revision[repositoryName]);
&gt; 
&gt; Ditto.
&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:73
&gt; &gt; +    _commitsOnBranch: function(branchName, filter)
&gt; &gt;      {
&gt; &gt; +        if (!filter)
&gt; &gt; +            filter = function(commit) { return true; };
&gt; &gt;          return this.recordedCommits.filter(function(commit, index, array) {
&gt; &gt;              return (!commit.containsBranchLocation || commit.branches.includes(branchName)) &amp;&amp; filter(commit, index, array);
&gt; &gt;          });
&gt; &gt;      },
&gt; 
&gt; We always pass a filter to this function and that filter only looks at the
&gt; index position. So, I suggest we remove the filter argument and have this
&gt; function take optional begin and end index positions:
&gt; 
&gt; _commitsOnBranch(branchName, beginPosition, endPosition)
&gt; {
&gt;     beginPosition = beginPosition || 0;
&gt;     endPosition = endPosition || this.recordedCommits.length - 1;</span >

What if endPosition is 0? Maybe we should instead do something like:

if (endPosition === undefined)
    endPosition = this.recordedCommits.length - 1;

<span class="quote">&gt;     let commits = [];</span >

Why are you using 'let' instead of 'var'?

<span class="quote">&gt;     for (let i = beginPosition; i &lt;= endPosition; ++i) {
&gt;         let commit = this.recordedCommits[i]
&gt;         if (!commit.containsBranchLocation ||
&gt; commit.branches.includes(branchName))
&gt;             commits.push(commit);
&gt;     }
&gt;     return commits;
&gt; },
&gt; 
&gt; This will allow us to remove the need to iterate over the entire array of
&gt; recorded commits once we know either a begin or end position (or both).
&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:82
&gt; &gt; +        var indexToBeLaterThan = this.indexOfRevision(revision);
&gt; &gt; +        function selectCommitsLaterThanRevision(commit, index, allCommits) {
&gt; &gt; +            return index &gt; indexToBeLaterThan;
&gt; &gt; +        }
&gt; &gt; +        var commits = this._commitsOnBranch(branchName, selectCommitsLaterThanRevision.bind(this));
&gt; &gt; +        return commits;
&gt; 
&gt; Then we can implement this as:
&gt; 
&gt; let indexToBeLaterThan = this.indexOfRevision(revision);
&gt; console.assert(indexToBeLaterThan !== -1, revision + &quot; is not in the list of
&gt; recorded commits&quot;);
&gt; if (indexToBeLaterThan === -1)
&gt;     return [];
&gt; return this._commitsOnBranch(branchName, null, indexToBeLaterThan + 1);
&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:93
&gt; &gt; +        var indexOfFirstRevision = this.indexOfRevision(firstRevision);
&gt; &gt; +        var indexOfLastRevision = this.indexOfRevision(lastRevision);
&gt; &gt; +        function selectCommitsInRange(commit, index, allCommits) {
&gt; &gt; +            return index &gt;= indexOfFirstRevision &amp;&amp; index &lt;= indexOfLastRevision;
&gt; &gt; +        }
&gt; &gt; +        var commits = this._commitsOnBranch(branchName, selectCommitsInRange.bind(this));
&gt; &gt; +        return commits;
&gt; 
&gt; And we can implement this as:
&gt; 
&gt; let indexOfFirstRevision = this.indexOfRevision(firstRevision);
&gt; console.assert(indexOfFirstRevision !== -1, firstRevision + &quot; is not in the
&gt; list of recorded commits&quot;);
&gt; if (indexOfFirstRevision === -1)
&gt;     return [];
&gt; let indexOfLastRevision = this.indexOfRevision(lastRevision);
&gt; console.assert(indexOfLastRevision !== -1, indexOfLastRevision + &quot; is not in
&gt; the list of recorded commits&quot;);
&gt; if (indexOfLastRevision === -1)
&gt;     return [];
&gt; return this._commitOnBranch(branchName, null, indexOfFirstRevision,
&gt; indexOfLastRevision);
&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:177
&gt; &gt; +Array.prototype.indexOfObjectPassingTest = function(predicate)
&gt; &gt; +{
&gt; &gt; +    for (var i = 0; i &lt; this.length; ++i) {
&gt; &gt; +        if (predicate(this[i]))
&gt; &gt; +            return i;
&gt; &gt; +    }
&gt; &gt; +
&gt; &gt; +    return -1;
&gt; &gt; +};
&gt; 
&gt; This function is only used by Trac.indexOfRevision(). Unless you plan to
&gt; make use of this function in a near future patch, I suggest that we inline
&gt; the implementation of this function into Trac.indexOfRevision() and remove
&gt; this function.</span ></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>