File tree Expand file tree Collapse file tree 11 files changed +186
-1
lines changed Expand file tree Collapse file tree 11 files changed +186
-1
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+ 'use strict' ;
3
+
4
+ const CMD = process . argv [ 2 ] ;
5
+ const path = require ( 'path' ) ;
6
+ const { execSync } = require ( 'child_process' ) ;
7
+ const fs = require ( 'fs' ) ;
8
+
9
+ if ( ! CMD ) {
10
+ console . log ( 'Run `git node help` to see how to use this' ) ;
11
+ process . exit ( 1 ) ;
12
+ }
13
+
14
+ const script = path . join ( __dirname , `git-node-${ CMD } ` ) ;
15
+ if ( ! fs . existsSync ( script ) ) {
16
+ console . log ( `No such command: git node ${ CMD } ` ) ;
17
+ process . exit ( 1 ) ;
18
+ }
19
+
20
+ execSync ( script , process . argv . slice ( 2 ) , {
21
+ stdio : 'inherit'
22
+ } ) ;
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [[ $1 -eq 0 ]] ; then
4
+ echo ' no patch number specified!'
5
+ exit 1
6
+ fi
7
+
8
+ set -x;
9
+ REV=$( git rev-parse HEAD)
10
+ SHORT_REV=${REV: 0: 7}
11
+ MSG=.ncu/msg-$SHORT_REV .txt
12
+
13
+ if [ ! -e $MSG ] ; then
14
+ git node msg $1 ;
15
+ fi ;
16
+
17
+ git show $REV -s --format=%B | git node check-msg $MSG
18
+ if [ ! $? -eq 0 ]; then
19
+ echo " commit message is already ammended"
20
+ else
21
+ git commit --amend -F $MSG
22
+ fi
23
+
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -x;
4
+
5
+ if [[ $1 -eq 0 ]] ; then
6
+ echo ' no patch number specified!'
7
+ exit 1
8
+ fi
9
+
10
+ curl -L " https://github.com/nodejs/node/pull/$1 .patch" | git am --whitespace=fix
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require ( 'fs' ) ;
4
+
5
+ const file = process . argv [ 2 ] ;
6
+ const msg = fs . readFileSync ( 0 , 'utf8' ) ;
7
+ const toAmmend = fs . readFileSync ( file , 'utf8' ) ;
8
+ const META_RE = / P R - U R L : | R e v i e w e d - B y : / ;
9
+
10
+ for ( const line of msg . split ( '\n' ) ) {
11
+ if ( line . match ( META_RE ) ) {
12
+ throw new Error ( `Found ${ line } ` ) ;
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ UPSTREAM=$( git node-rc upstream)
4
+ BRANCH=$( git rev-parse --abbrev-ref HEAD)
5
+ git rev-list $UPSTREAM /$BRANCH ...HEAD | xargs core-validate-commit
6
+
7
+ # clean up when it passes
8
+ # rm .ncu/msg-*.txt .ncu/metadata-*.txt
9
+
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ echo "
4
+ 1) To land single a commit:
5
+ git node just <PRID>
6
+
7
+ 2) To land multiple commits:
8
+ git node apply <PRID>
9
+ git rebase -i upstream/master # edit every commit that's gonna stay
10
+ # on each stay
11
+ git node ammend <PRID>
12
+ git rebase --continue
13
+ # when the rebase is done
14
+ git node final"
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [[ $1 -eq 0 ]] ; then
4
+ echo ' no patch number specified!'
5
+ exit 1
6
+ fi
7
+
8
+ set -x
9
+
10
+ # grab the patch
11
+ mkdir -p .ncu
12
+ PATCH=.ncu/patch-$1 .patch
13
+ curl -L " https://github.com/nodejs/node/pull/$1 .patch" > $PATCH
14
+ NUM_COMMITS=` cat $PATCH | grep -c " Subject: \[PATCH\]" `
15
+
16
+ if [[ ! $NUM_COMMITS -eq 1 ]] ; then
17
+ echo ' There are multiple commits in this patch, can not land using `git node just`'
18
+ exit 1
19
+ fi
20
+
21
+ # abort any previous session
22
+ git am --abort
23
+
24
+ # apply the patch
25
+ cat $PATCH | git am --whitespace=fix
26
+
27
+ # build message
28
+ git node msg $1 ;
29
+
30
+ REV=$( git rev-parse HEAD)
31
+ SHORT_REV=${REV: 0: 7}
32
+ MSG=.ncu/msg-$SHORT_REV .txt
33
+ META=.ncu/metadata-$1 .txt;
34
+
35
+ # ammend the message
36
+ git show $REV -s --format=%B | git node check-msg $MSG
37
+ if [ ! $? -eq 0 ]; then
38
+ echo " commit message is already ammended"
39
+ else
40
+ git commit --amend -F $MSG
41
+ fi
42
+
43
+ rm $MSG $PATCH $META
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [[ $1 -eq 0 ]] ; then
4
+ echo ' no patch number specified!'
5
+ exit 1
6
+ fi
7
+
8
+ mkdir -p .ncu
9
+ META=.ncu/metadata-$1 .txt;
10
+ get-metadata $1 -f $META
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [[ $1 -eq 0 ]] ; then
4
+ echo ' no patch number specified!'
5
+ exit 1
6
+ fi
7
+
8
+ META=.ncu/metadata-$1 .txt;
9
+
10
+ if [ ! -e $META ] ; then
11
+ git node meta $1 -f $META
12
+ fi ;
13
+
14
+ set -x;
15
+ UPSTREAM=$( git node-rc upstream)
16
+ BRANCH=$( git rev-parse --abbrev-ref HEAD)
17
+ REV=$( git rev-parse HEAD)
18
+ # REVS=$(git rev-list $UPSTREAM/$BRANCH...HEAD)
19
+
20
+ # for rev in $REVS; do
21
+ SHORT_REV=${REV: 0: 7}
22
+ MSG=.ncu/msg-$SHORT_REV .txt
23
+ echo -e " $( git show $rev -s --format=%B) \n\n$( cat $META ) " > $MSG ;
24
+ # done
25
+
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require ( 'fs' ) ;
4
+ const os = require ( 'os' ) ;
5
+ const path = require ( 'path' ) ;
6
+
7
+ const field = process . argv [ 2 ] ;
8
+ if ( ! field ) {
9
+ throw Error ( 'no field specified!' ) ;
10
+ }
11
+
12
+ const ncurcPath = path . join ( os . homedir ( ) , '.ncurc' ) ;
13
+ const ncurc = JSON . parse ( fs . readFileSync ( ncurcPath , 'utf8' ) ) ;
14
+ console . log ( ncurc [ field ] ) ;
You can’t perform that action at this time.
0 commit comments