aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/git/patch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src/git/patch.ts')
-rw-r--r--packages/server/src/git/patch.ts21
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