Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit55c4dcb

Browse files
committed
cherry-pick init commits
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent40a57fb commit55c4dcb

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

‎src/utils/cherryPick.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import{execascpExec}from"child_process";
2+
import{promisify}from"util";
3+
4+
constasyncExec=promisify(cpExec);
5+
6+
exportconstexec=(
7+
command:string,
8+
cwd:string
9+
):Promise<{stdout:string;stderr:string}>|never=>{
10+
returnasyncExec(command,{ cwd});
11+
};
12+
13+
exportfunctiongitPCherryPick(cwd:string){
14+
returnasyncfunctioncherryPick(commits:string[]):Promise<void>{
15+
for(constcommitofcommits){
16+
try{
17+
const{ stdout}=awaitexec(
18+
`git cherry-pick -X theirs${commit}`,
19+
cwd
20+
);
21+
if(!stdout){
22+
console.warn(`No cherry-pick output for${commit}`);
23+
}
24+
}catch(e){
25+
console.warn(`Cherry-pick failed for${commit}`);
26+
}
27+
}
28+
};
29+
}

‎src/validate.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as fs from "fs-extra";
33
import*asyamlParserfrom"js-yaml";
44
import{getArg}from"./utils/args";
55
importgitP,{SimpleGit}from"simple-git/promise";
6+
import{gitPCherryPick}from"./utils/cherryPick";
67
import{getCommits,CommitLogObject}from"./utils/commits";
78

89
asyncfunctionvalidate(args:string[]){
@@ -46,10 +47,18 @@ async function validate(args: string[]) {
4647
awaitfs.emptyDir(tmpDir);
4748
}
4849
consttempGit:SimpleGit=gitP(tmpDir);
50+
51+
console.log(Object.keys(gitP));
52+
4953
awaittempGit.init();
54+
awaittempGit.addRemote("origin",skeleton.config.repo.uri);
55+
awaittempGit.fetch("origin",skeleton.config.repo.branch);
56+
// no js cherry pick implementation
57+
constcherryPick=gitPCherryPick(tmpDir);
5058

5159
// VALIDATE TUTORIAL TESTS
5260
if(commits.INIT){
61+
cherryPick(commits.INIT);
5362
}
5463

5564
// run test runner setup command(s)
@@ -71,7 +80,7 @@ async function validate(args: string[]) {
7180
console.error(e.message);
7281
}finally{
7382
// cleanup
74-
awaitfs.emptyDir(tmpDir);
83+
//await fs.emptyDir(tmpDir);
7584
}
7685
}
7786

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp