Skip to content

Commit

Permalink
feat(git-node): add git-node status
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Aug 18, 2020
1 parent 95300fd commit ebc8fb2
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
38 changes: 38 additions & 0 deletions components/git/status.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
'use strict';

const path = require('path');
const fs = require('fs');

const { readJson } = require('./../../lib/file');
const { getNcuDir } = require('./../../lib/config');

const CLI = require('../../lib/cli');

const cli = new CLI();

function handler() {
const ncuDir = getNcuDir(process.cwd());
const landPath = path.join(ncuDir, 'land');

if (fs.existsSync(landPath)) {
const { state, prid, config } = readJson(landPath);
const { username, branch, upstream } = config;

cli.ok('Landing session in progress');
cli.separator();
cli.table('PR:', `https:/github.com/nodejs/node/pull/${prid}`);
cli.table('State:', state);
cli.table('Username:', username);
cli.table('Upstream:', upstream);
cli.table('Branch:', branch);
} else {
cli.warn('No landing session in progress');
}
}

module.exports = {
command: 'status',
describe: 'Return status and information about' +
'the current git-node land session.',
handler: handler
};
28 changes: 28 additions & 0 deletions docs/git-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ A custom Git command for managing pull requests. You can run it as
- [`git node v8 minor`](#git-node-v8-minor)
- [`git node v8 backport <sha..>`](#git-node-v8-backport-sha)
- [General options](#general-options)
- [`git node status`](#git-node-status)
- [Example](#example)
- [`git node wpt`](#git-node-wpt)
- [Example](#example-2)

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

## `git node status`

Return status and information about the current git-node land session. Shows the following information:

- PR URL (`https:/github.com/nodejs/node/<prid>`)
- `git-node` landing session status, one of:
- `APPLYING`
- `STARTED`
- `AMENDING`
- Current username
- Current upstream
- Current target branch for the landing session

### Example

```sh
node on git:master ❯ git node status 11:32AM
✔ Landing session in progress
--------------------------------------------------------------------------------
PR: https:/github.com/nodejs/node/pull/34800
State: AMENDING
Username: codebytere
Upstream: upstream
Branch: master
```

## `git node wpt`

Update or patch the Web Platform Tests in core.
Expand Down

0 comments on commit ebc8fb2

Please sign in to comment.