diff options
author | HampusM <hampus@hampusmat.com> | 2021-07-27 16:49:53 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-07-27 16:49:53 +0200 |
commit | fa44d81b658024685e0496150d66a51f2f5fda8c (patch) | |
tree | 38ed498ee8d070245432fec7c8ca2483254a3893 /packages/server/src/git/patch.ts | |
parent | f6a5fe05c887a658c20257d2ef6bf2780f792873 (diff) |
Improved a bunch of small things in the backend
Diffstat (limited to 'packages/server/src/git/patch.ts')
-rw-r--r-- | packages/server/src/git/patch.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/server/src/git/patch.ts b/packages/server/src/git/patch.ts index 8eaaaf1..45ffe23 100644 --- a/packages/server/src/git/patch.ts +++ b/packages/server/src/git/patch.ts @@ -168,4 +168,25 @@ export class Patch { return hunks_data.hunks; } + + /** + * Returns a patch from a diff + * + * @param diff - The diff which the patch is in + * @param index - The index of a patch + * @returns An instance of a patch + */ + public static async fromDiff(diff: Diff, index: number): Promise<Patch> { + return diff.patch(index); + } + + /** + * Returns all of the patches from a diff + * + * @param diff - A diff + * @returns An array of patch instances + */ + public static async allFromDiff(diff: Diff): Promise<Patch[]> { + return diff.patches(); + } }
\ No newline at end of file |