(from: string, to: string)
| 1087 | } |
| 1088 | |
| 1089 | async getDifferences(from: string, to: string) { |
| 1090 | // retry this as sometimes GitHub returns an initial 404 on cross repo compare |
| 1091 | const attempts = this.useOpenAuthoring ? 10 : 1; |
| 1092 | for (let i = 1; i <= attempts; i++) { |
| 1093 | try { |
| 1094 | const result: Endpoints['GET /repos/{owner}/{repo}/compare/{base}...{head}']['response']['data'] = |
| 1095 | await this.request(`${this.originRepoURL}/compare/${from}...${to}`); |
| 1096 | return result; |
| 1097 | } catch (e) { |
| 1098 | if (i === attempts) { |
| 1099 | console.warn(`Reached maximum number of attempts '${attempts}' for getDifferences`); |
| 1100 | throw e; |
| 1101 | } |
| 1102 | await new Promise(resolve => setTimeout(resolve, i * 500)); |
| 1103 | } |
| 1104 | } |
| 1105 | throw new APIError('Not Found', 404, API_NAME); |
| 1106 | } |
| 1107 | |
| 1108 | async rebaseSingleCommit(baseCommit: GitHubCompareCommit, commit: GitHubCompareCommit) { |
| 1109 | // first get the diff between the commits |
no test coverage detected