()
| 128 | }); |
| 129 | } |
| 130 | async _createDiffAtext(){ |
| 131 | const bulkSize = 100; |
| 132 | |
| 133 | // get the cleaned startAText |
| 134 | let atext = await this._createClearStartAtext(this._fromRev); |
| 135 | |
| 136 | let superChangeset = null; |
| 137 | |
| 138 | for (let rev = this._fromRev + 1; rev <= this._toRev; rev += bulkSize) { |
| 139 | // get the bulk |
| 140 | const {changesets, authors} = await this._getChangesetsInBulk(rev, bulkSize); |
| 141 | |
| 142 | const addedAuthors = []; |
| 143 | |
| 144 | // run through all changesets |
| 145 | for (let i = 0; i < changesets.length && (rev + i) <= this._toRev; ++i) { |
| 146 | let changeset = changesets[i]; |
| 147 | |
| 148 | // skip clearAuthorship Changesets |
| 149 | if (this._isClearAuthorship(changeset)) { |
| 150 | continue; |
| 151 | } |
| 152 | |
| 153 | changeset = this._extendChangesetWithAuthor(changeset, authors[i], this._pad.pool); |
| 154 | |
| 155 | // add this author to the authorarray |
| 156 | addedAuthors.push(authors[i]); |
| 157 | |
| 158 | // compose it with the superChangset |
| 159 | if (superChangeset == null) { |
| 160 | superChangeset = changeset; |
| 161 | } else { |
| 162 | superChangeset = compose(superChangeset, changeset, this._pad.pool); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | // add the authors to the PadDiff authorArray |
| 167 | this._addAuthors(addedAuthors); |
| 168 | } |
| 169 | |
| 170 | // if there are only clearAuthorship changesets, we don't get a superChangeset, |
| 171 | // so we can skip this step |
| 172 | if (superChangeset) { |
| 173 | const deletionChangeset = this._createDeletionChangeset(superChangeset, atext, this._pad.pool); |
| 174 | |
| 175 | // apply the superChangeset, which includes all addings |
| 176 | atext = applyToAText(superChangeset, atext, this._pad.pool); |
| 177 | |
| 178 | // apply the deletionChangeset, which adds a deletions |
| 179 | atext = applyToAText(deletionChangeset, atext, this._pad.pool); |
| 180 | } |
| 181 | |
| 182 | return atext; |
| 183 | } |
| 184 | async getHtml(){ |
| 185 | // cache the html |
| 186 | if (this._html != null) { |
no test coverage detected