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

Feature/validate#34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 11 commits intomasterfromfeature/validate
Jun 13, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
cherry-pick init commits
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
@ShMcK
ShMcK committedJun 13, 2020
commit55c4dcbaedd562bcf6f6979118424c71c6e990bd
29 changes: 29 additions & 0 deletionssrc/utils/cherryPick.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
import { exec as cpExec } from "child_process";
import { promisify } from "util";

const asyncExec = promisify(cpExec);

export const exec = (
command: string,
cwd: string
): Promise<{ stdout: string; stderr: string }> | never => {
return asyncExec(command, { cwd });
};

export function gitPCherryPick(cwd: string) {
return async function cherryPick(commits: string[]): Promise<void> {
for (const commit of commits) {
try {
const { stdout } = await exec(
`git cherry-pick -X theirs ${commit}`,
cwd
);
if (!stdout) {
console.warn(`No cherry-pick output for ${commit}`);
}
} catch (e) {
console.warn(`Cherry-pick failed for ${commit}`);
}
}
};
}
11 changes: 10 additions & 1 deletionsrc/validate.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,6 +3,7 @@ import * as fs from "fs-extra";
import * as yamlParser from "js-yaml";
import { getArg } from "./utils/args";
import gitP, { SimpleGit } from "simple-git/promise";
import { gitPCherryPick } from "./utils/cherryPick";
import { getCommits, CommitLogObject } from "./utils/commits";

async function validate(args: string[]) {
Expand DownExpand Up@@ -46,10 +47,18 @@ async function validate(args: string[]) {
await fs.emptyDir(tmpDir);
}
const tempGit: SimpleGit = gitP(tmpDir);

console.log(Object.keys(gitP));

await tempGit.init();
await tempGit.addRemote("origin", skeleton.config.repo.uri);
await tempGit.fetch("origin", skeleton.config.repo.branch);
// no js cherry pick implementation
const cherryPick = gitPCherryPick(tmpDir);

// VALIDATE TUTORIAL TESTS
if (commits.INIT) {
cherryPick(commits.INIT);
}

// run test runner setup command(s)
Expand All@@ -71,7 +80,7 @@ async function validate(args: string[]) {
console.error(e.message);
} finally {
// cleanup
await fs.emptyDir(tmpDir);
//await fs.emptyDir(tmpDir);
}
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp