(from: string, to: string)
| 1062 | } |
| 1063 | |
| 1064 | async getDifferences(from: string, to: string) { |
| 1065 | // retry this as sometimes GitHub returns an initial 404 on cross repo compare |
| 1066 | const attempts = this.useOpenAuthoring ? 10 : 1; |
| 1067 | for (let i = 1; i <= attempts; i++) { |
| 1068 | try { |
| 1069 | const result: Endpoints['GET /repos/{owner}/{repo}/compare/{base}...{head}']['response']['data'] = |
| 1070 | await this.request(`${this.originRepoURL}/compare/${from}...${to}`); |
| 1071 | return result; |
| 1072 | } catch (e) { |
| 1073 | if (i === attempts) { |
| 1074 | console.warn(`Reached maximum number of attempts '${attempts}' for getDifferences`); |
| 1075 | throw e; |
| 1076 | } |
| 1077 | await new Promise(resolve => setTimeout(resolve, i * 500)); |
| 1078 | } |
| 1079 | } |
| 1080 | throw new APIError('Not Found', 404, API_NAME); |
| 1081 | } |
| 1082 | |
| 1083 | async rebaseSingleCommit(baseCommit: GitHubCompareCommit, commit: GitHubCompareCommit) { |
| 1084 | // first get the diff between the commits |
no test coverage detected