Skip to content

Commit ebc8fb2

Browse files
authored
feat(git-node): add git-node status
1 parent 95300fd commit ebc8fb2

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

components/git/status.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
'use strict';
2+
3+
const path = require('path');
4+
const fs = require('fs');
5+
6+
const { readJson } = require('./../../lib/file');
7+
const { getNcuDir } = require('./../../lib/config');
8+
9+
const CLI = require('../../lib/cli');
10+
11+
const cli = new CLI();
12+
13+
function handler() {
14+
const ncuDir = getNcuDir(process.cwd());
15+
const landPath = path.join(ncuDir, 'land');
16+
17+
if (fs.existsSync(landPath)) {
18+
const { state, prid, config } = readJson(landPath);
19+
const { username, branch, upstream } = config;
20+
21+
cli.ok('Landing session in progress');
22+
cli.separator();
23+
cli.table('PR:', `https:/github.com/nodejs/node/pull/${prid}`);
24+
cli.table('State:', state);
25+
cli.table('Username:', username);
26+
cli.table('Upstream:', upstream);
27+
cli.table('Branch:', branch);
28+
} else {
29+
cli.warn('No landing session in progress');
30+
}
31+
}
32+
33+
module.exports = {
34+
command: 'status',
35+
describe: 'Return status and information about' +
36+
'the current git-node land session.',
37+
handler: handler
38+
};

docs/git-node.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ A custom Git command for managing pull requests. You can run it as
2121
- [`git node v8 minor`](#git-node-v8-minor)
2222
- [`git node v8 backport <sha..>`](#git-node-v8-backport-sha)
2323
- [General options](#general-options)
24+
- [`git node status`](#git-node-status)
25+
- [Example](#example)
2426
- [`git node wpt`](#git-node-wpt)
2527
- [Example](#example-2)
2628

@@ -367,6 +369,32 @@ Options:
367369
will be used instead of cloning V8 to `baseDir`.
368370
- `--verbose`: Enable verbose output.
369371

372+
## `git node status`
373+
374+
Return status and information about the current git-node land session. Shows the following information:
375+
376+
- PR URL (`https:/github.com/nodejs/node/<prid>`)
377+
- `git-node` landing session status, one of:
378+
- `APPLYING`
379+
- `STARTED`
380+
- `AMENDING`
381+
- Current username
382+
- Current upstream
383+
- Current target branch for the landing session
384+
385+
### Example
386+
387+
```sh
388+
node on git:master ❯ git node status 11:32AM
389+
✔ Landing session in progress
390+
--------------------------------------------------------------------------------
391+
PR: https:/github.com/nodejs/node/pull/34800
392+
State: AMENDING
393+
Username: codebytere
394+
Upstream: upstream
395+
Branch: master
396+
```
397+
370398
## `git node wpt`
371399

372400
Update or patch the Web Platform Tests in core.

0 commit comments

Comments
 (0)