-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unhandled error when a bad revision is provided to changedSince
#7112
Changes from all commits
835dff3
1d1af68
896df1d
e1ee284
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,22 @@ const findChangedFilesUsingCommand = async ( | |
args: Array<string>, | ||
cwd: Path, | ||
): Promise<Array<Path>> => { | ||
const result = await execa('git', args, {cwd}); | ||
try { | ||
const result = await execa('git', args, {cwd}); | ||
|
||
return result.stdout | ||
.split('\n') | ||
.filter(s => s !== '') | ||
.map(changedPath => path.resolve(cwd, changedPath)); | ||
return result.stdout | ||
.split('\n') | ||
.filter(s => s !== '') | ||
.map(changedPath => path.resolve(cwd, changedPath)); | ||
} catch (e) { | ||
const errorMsg = e.message.split('\n')[1]; | ||
|
||
console.error(`\n\n${errorMsg}\n`); | ||
|
||
process.exit(0); | ||
|
||
return []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's mainly to pass the flow tests, though eslint also complained. |
||
} | ||
}; | ||
|
||
const adapter: SCMAdapter = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,12 +45,22 @@ const adapter: SCMAdapter = { | |
} | ||
args.push(...includePaths); | ||
|
||
const result = await execa('hg', args, {cwd, env}); | ||
try { | ||
const result = await execa('hg', args, {cwd, env}); | ||
|
||
return result.stdout | ||
.split('\n') | ||
.filter(s => s !== '') | ||
.map(changedPath => path.resolve(cwd, changedPath)); | ||
} catch (e) { | ||
const errorMsg = e.message.split('\n')[1]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of doing this, you should use |
||
|
||
return result.stdout | ||
.split('\n') | ||
.filter(s => s !== '') | ||
.map(changedPath => path.resolve(cwd, changedPath)); | ||
console.error(`\n\n${errorMsg}\n`); | ||
|
||
process.exit(0); | ||
|
||
return []; | ||
} | ||
}, | ||
|
||
getRoot: async (cwd: Path): Promise<?Path> => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should exit with code 1, not 0