-
Notifications
You must be signed in to change notification settings - Fork 116
allow git-node land to work with full PR url (#213) #219
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
Changes from 1 commit
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ const { runPromise } = require('../../lib/run'); | |
const LandingSession = require('../../lib/landing_session'); | ||
const epilogue = require('./epilogue'); | ||
const yargs = require('yargs'); | ||
const isUrl = require('is-url'); | ||
|
||
const landOptions = { | ||
apply: { | ||
|
@@ -35,10 +36,11 @@ const landOptions = { | |
function builder(yargs) { | ||
return yargs | ||
.options(landOptions).positional('prid', { | ||
describe: 'ID of the Pull Request', | ||
type: 'number' | ||
describe: 'ID or URL of the Pull Request' | ||
}) | ||
.epilogue(epilogue) | ||
.example('git node land https://github.com/nodejs/node/pull/12344', | ||
'Land https://github.com/nodejs/node/pull/12344 in the current directory') | ||
.example('git node land 12344', | ||
'Land https://github.com/nodejs/node/pull/12344 in the current directory') | ||
.example('git node land --abort', | ||
|
@@ -59,7 +61,7 @@ const CONTINUE = 'continue'; | |
const ABORT = 'abort'; | ||
|
||
function handler(argv) { | ||
if (argv.prid && Number.isInteger(argv.prid)) { | ||
if (argv.prid && (Number.isInteger(argv.prid) || isUrl(argv.prid))) { | ||
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. We don't really need this module, do we? We can simply use a regexp to validate & capture the id: 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. @joyeecheung makes sense, also helps having less direct dependencies as they are 👍. making changes in few |
||
return land(START, argv); | ||
} | ||
const provided = []; | ||
|
@@ -124,6 +126,10 @@ async function main(state, argv, cli, req, dir) { | |
} | ||
|
||
if (state === START) { | ||
if (isUrl(argv.prid)) { | ||
argv.prid = Number(argv.prid.split('/').pop()); | ||
} | ||
|
||
if (session.hasStarted()) { | ||
cli.warn( | ||
'Previous `git node land` session for ' + | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ $ ncu-config set branch master # Assuming you are landing commits on master | |
$ git checkout master | ||
$ git node land --abort # Abort a landing session, just in case | ||
$ git node land $PRID # Start a new landing session | ||
$ git node land $URL # Start a new landing session | ||
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. Can you update this line as well? 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. @joyeecheung done, thanks for catching that |
||
|
||
$ git rebase -i upstream/master # Put "edit" on every commit that's gonna stay | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Can you put something down in the comment indicating this is an alternative way to land a PR, not a necessary step? Something like