Skip to content
This repository has been archived by the owner on Dec 31, 2019. It is now read-only.

Add -L option to list open CRs #6

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

## not yet released

## 1.8.0

- grr -r <cr|ia> support to vote on Code-Review or Integration-Approval
on projects

## 1.7.0

- grr -L support to list outstanding reviews for this project

## 1.6.0

- Update grr to use the new https://jira.joyent.us
Expand Down
54 changes: 46 additions & 8 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

/*
* Copyright 2016 Joyent, Inc.
* Copyright 2018 Joyent, Inc.
*/

/*
Expand All @@ -21,6 +21,9 @@ var VError = require('verror').VError;
var grr = require('./grr');
var pkg = require('../package.json');

var VALID_REVIEWS = {
'cr': 'Code-Review',
'ia': 'Integration-Approval'};

// ---- globals and constants

Expand Down Expand Up @@ -49,18 +52,28 @@ var options = [
{
group: 'For creating/updating CRs'
},
//{
// names: ['dry-run', 'n'],
// type: 'bool',
// help: 'Go through the motions without actually commiting or pushing.',
// 'default': false
//},
{
names: ['dry-run', 'n'],
type: 'bool',
help: 'Go through the motions without actually commiting, pushing or'
+ ' reviewing.',
'default': false
},
{
names: ['parenthetical', 'p'],
type: 'string',
help: 'Add a parenthetical comment to the commit message. Typically '
+ 'used for followup commits on an issue already commited to.'
},
{
names: ['review', 'r'],
type: 'string',
help: 'Add either "cr" or "ia" +1s to any matching issues.'
},
{ names: ['diff', 'd'],
type: 'bool',
help: 'When using -r, show the latest diffs of reviews.'
},
{
names: ['update', 'u'],
type: 'bool',
Expand All @@ -83,6 +96,14 @@ var options = [
type: 'bool',
help: 'Delete the local branch used for working with the CR. '
+ 'Typically this is used when you are done with the CR.'
},
{
group: 'Miscellaneous CR operations'
},
{
names: ['list', 'L'],
type: 'bool',
help: 'List outstanding code reviews for this component.'
}
];

Expand All @@ -101,6 +122,8 @@ function usage() {
'Usage:',
' grr [<options>] [<issue>] # create or update a CR',
' grr -D [<issue>] # delete feature branch, switch to master',
' grr -L # list outstanding CRs for this component.',
' grr -r [cr|ia] <issue> # add CR or IA +1s to matching issues.',
'',
'Options:',
help,
Expand All @@ -112,7 +135,8 @@ function usage() {
' grr TOOLS-123 # Start or update a branch and CR for this ticket',
//' grr --commit TOOLS-123 # ... also commit uncommited changes',
' grr # Update the current CR (using the cached ticket)',
' grr -D # All done. Del the branch and switch back to master'
' grr -D # All done. Del the branch and switch back to master',
' grr -r cr [-d] TOOLS-123 # Add +1 CRs for TOOLS-123 tickets'
].join('\n'));
/* END JSSTYLED */
}
Expand Down Expand Up @@ -179,6 +203,20 @@ function main(argv) {
issueArg: issueArg,
dryRun: opts.dry_run
}, mainFinish);
} else if (opts['list']) {
grr.grrList({log: log}, mainFinish);
} else if (opts['review']) {
if (!VALID_REVIEWS.hasOwnProperty(opts['review'])) {
console.error('grr: unknown review type');
process.exit(1);
}
grr.grrReview({
log: log,
issueArg: issueArg,
dryRun: opts.dry_run,
reviewArg: VALID_REVIEWS[opts.review],
diffArg: opts.diff,
verbose: opts.verbose}, mainFinish);
} else {
grr.grrUpdateOrCreate({
log: log,
Expand Down
Loading