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

Appearance settings

Latest commit

 

History

History
History
executable file
·
56 lines (48 loc) · 1.56 KB

File metadata and controls

executable file
·
56 lines (48 loc) · 1.56 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env node
const shell = require('shelljs');
shell.config.fatal = true;
const util = require('./utils/git_util');
if (require.main === module) {
main(process.argv.splice(2)).then(
(v) => process.exitCode,
(e) => console.error(process.exitCode = 1, e)
);
}
async function main(args) {
let forceWithLease = '';
let prNumber = 0;
let printHelp = false;
args.forEach((arg) => {
if (prNumber == 0 && arg > 0) {
prNumber = arg;
} else if (arg == '--help') {
printHelp = true;
} else if (arg == '--force-with-lease') {
forceWithLease = ' --force-with-lease';
} else {
shell.echo('Unexpected argument: ', arg);
}
});
if (!prNumber) {
const branch = util.getCurrentBranch();
const maybePr = branch.split('/')[1];
if (maybePr > 0) {
shell.echo(`PR number not specified. Defaulting to #${maybePr}.`);
prNumber = maybePr;
}
}
if (!prNumber || printHelp) {
shell.echo(`Push the current HEAD into an existing pull request.`);
shell.echo(``);
shell.echo(`${process.argv[1]} [PR_NUMBER] [--force-with-lease]`);
shell.echo(``);
shell.echo(` --force-with-lease Continues even \if change can\'t be fast-forwarded.`);
shell.echo(` [PR_NUMBER] If not present the script guesses the PR from the branch name.`);
return 1;
}
const prInfo = await util.githubPrInfo(prNumber);
const prPushCmd = `git push${forceWithLease} ${prInfo.repository.gitUrl} HEAD:${prInfo.branch}`;
shell.echo(`>>> ${prPushCmd}`);
shell.exec(prPushCmd);
return 0;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.