mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-29 10:28:04 +03:00
feat: allow switching branches on local dbseeds
This commit is contained in:
@@ -42,6 +42,14 @@ export class DatabaseSeedsRepo {
|
||||
this.shouldDestroy = shouldDestroy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch this repository to a new branch. This operation may
|
||||
* fail if there are uncommitted changes.
|
||||
*/
|
||||
switchBranch(newBranch: string) {
|
||||
return asyncExec(`git switch '${newBranch}'`, this.baseDir);
|
||||
}
|
||||
|
||||
private CollectionNameToPath(collectionName: SeedsCollections) {
|
||||
return path.join(this.baseDir, `${collectionName}.json`);
|
||||
}
|
||||
@@ -224,7 +232,11 @@ export async function PullDatabaseSeeds(
|
||||
: "staging"
|
||||
) {
|
||||
if (fetchFromLocalPath) {
|
||||
return new DatabaseSeedsRepo(fetchFromLocalPath);
|
||||
const local = new DatabaseSeedsRepo(fetchFromLocalPath);
|
||||
|
||||
await local.switchBranch(branch);
|
||||
|
||||
return local;
|
||||
}
|
||||
|
||||
if (!ServerConfig.SEEDS_CONFIG) {
|
||||
|
||||
Reference in New Issue
Block a user