mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
codereview: delete, now using GitHub pull requests
This commit is contained in:
parent
a83f4518e6
commit
6cb3a2b9c3
5 changed files with 2 additions and 3944 deletions
|
@ -1,7 +1,3 @@
|
|||
Plan 9 from User Space uses Gerrit instead of GitHub pull requests.
|
||||
See the [codereview(1)](http://swtch.com/plan9port/man/man1/codereview.html) man page.
|
||||
|
||||
If you would like to use git directly instead of the codereview(1) wrapper, that is fine too.
|
||||
Follow the instructions on the RE2 [Contributing](https://github.com/google/re2/wiki/Contribute) wiki page,
|
||||
but use https://plan9port.googlesource.com/plan9 as the origin URL.
|
||||
Plan 9 from User Space accepts GitHub pull requests.
|
||||
|
||||
For details, see the general [GitHub documentation](https://help.github.com/articles/creating-a-pull-request/).
|
||||
|
|
147
bin/codereview
147
bin/codereview
|
@ -1,147 +0,0 @@
|
|||
#!/usr/local/plan9/bin/rc
|
||||
|
||||
git=git
|
||||
show=false
|
||||
fn gitshow {
|
||||
echo '%' git $*
|
||||
git $*
|
||||
}
|
||||
if(! ~ $#* 0 && ~ $1 -v) {
|
||||
git=gitshow
|
||||
show=true
|
||||
shift
|
||||
}
|
||||
|
||||
if(~ $#* 0) {
|
||||
echo 'usage: codereview <command> <args>' >[1=2]
|
||||
exit usage
|
||||
}
|
||||
|
||||
if(~ $#PLAN9 0) {
|
||||
PLAN9=/usr/local/plan9
|
||||
}
|
||||
if(! test -d $PLAN9/lib/git) {
|
||||
echo 'codereview: cannot find $PLAN9/lib/git' >[1=2]
|
||||
exit git
|
||||
}
|
||||
|
||||
if(! test -e $PLAN9/.git/hooks/commit-msg) {
|
||||
if($show) {
|
||||
echo '% ln -s ../../lib/git/commit-msg.hook $PLAN9/.git/hooks/commit-msg'
|
||||
}
|
||||
ln -s ../../lib/git/commit-msg.hook $PLAN9/.git/hooks/commit-msg
|
||||
}
|
||||
|
||||
switch($1) {
|
||||
case help
|
||||
9 man 1 codereview
|
||||
|
||||
case pending
|
||||
shift
|
||||
if(! ~ $#* 0) {
|
||||
echo 'usage: codereview pending' >[1=2]
|
||||
exit usage
|
||||
}
|
||||
$git branch -v
|
||||
|
||||
case create
|
||||
shift
|
||||
if(~ $#* 0) {
|
||||
echo 'usage: codereview create branchname' >[1=2]
|
||||
exit usage
|
||||
}
|
||||
branch=$1
|
||||
shift
|
||||
if(! git branch -l | 9 grep '\* master$' >/dev/null) {
|
||||
echo 'codereview: create not on master branch; use codereview commit' >[1=2]
|
||||
exit master
|
||||
}
|
||||
if($show) {
|
||||
echo '% git branch '$branch' && git commit || git branch -d '$branch >[1=2]
|
||||
}
|
||||
git branch $branch && git checkout $branch && git commit -a $* || git branch -d $branch
|
||||
|
||||
case commit
|
||||
shift
|
||||
if(git branch -l | 9 grep '\* master$' >/dev/null) {
|
||||
echo 'codereview: commit on master branch; use codereview create <branchname>' >[1=2]
|
||||
exit master
|
||||
}
|
||||
if(~ `{git merge-base HEAD HEAD} `{git merge-base HEAD master}) {
|
||||
# first commit on branch, somehow.
|
||||
$git commit $*
|
||||
exit $status
|
||||
}
|
||||
$git commit --amend -a $*
|
||||
exit $status
|
||||
|
||||
case upload
|
||||
if(git branch -l | 9 grep '\* master$' >/dev/null) {
|
||||
echo 'codereview: upload on master branch' >[1=2]
|
||||
exit master
|
||||
}
|
||||
if(~ `{git merge-base HEAD HEAD} `{git merge-base HEAD master}) {
|
||||
# no commit on branch
|
||||
echo 'codereview: no commits yet on this feature branch' >[1=2]
|
||||
exit commit
|
||||
}
|
||||
if(! 9 grep 'machine plan9port-review.googlesource.com' $HOME/.netrc >/dev/null >[2=1]) {
|
||||
echo 'codereview: warning: cannot find plan9port-review in netrc' >[1=2]
|
||||
}
|
||||
if(! git status | 9 grep 'nothing to commit, working directory clean' >/dev/null) {
|
||||
echo 'codereview: warning: local changes not yet committed' >[1=2]
|
||||
git status
|
||||
}
|
||||
$git push https://plan9port-review.googlesource.com/plan9 HEAD:refs/for/master >[2=1] | 9 sed 's/.*
//'
|
||||
|
||||
case sync
|
||||
shift
|
||||
if(! ~ $#* 0) {
|
||||
echo 'usage: codereview sync' >[1=2]
|
||||
exit usage
|
||||
}
|
||||
$git fetch -q
|
||||
|
||||
branch=`{git branch -l | 9 sed -n 's/^\* //p'}
|
||||
if(~ $branch master) {
|
||||
$git merge -q --ff-only origin/master
|
||||
exit $status
|
||||
}
|
||||
|
||||
if(~ `{git merge-base HEAD HEAD} `{git merge-base HEAD master}) {
|
||||
# no commit on branch
|
||||
git merge -q --ff-only origin/master
|
||||
exit $status
|
||||
}
|
||||
|
||||
# Exactly this commit in master. Fast-forward from master and delete this branch.
|
||||
if(git branch -r --contains HEAD | 9 grep '^ *origin/master$' >/dev/null) {
|
||||
$git checkout -q master
|
||||
$git merge -q --ff-only origin/master
|
||||
$git branch -q -d $branch
|
||||
exit $status
|
||||
}
|
||||
|
||||
changeid=`{git log -n 1 | 9 sed -n 's/^ Change-Id: //p'}
|
||||
if(~ $#changeid 0) {
|
||||
echo 'codereview: cannot find change id'
|
||||
exit changeid
|
||||
}
|
||||
|
||||
if(git log --grep 'Change-Id: '$changeid origin/master | 9 grep . >/dev/null) {
|
||||
# Something like this got submitted.
|
||||
$git checkout -q master
|
||||
$git merge -q --ff-only origin/master
|
||||
echo 'Change submitted but perhaps not identical to your copy.' >[1=2]
|
||||
echo 'To remove old copy:' git branch -d $branch >[1=2]
|
||||
exit 1
|
||||
}
|
||||
|
||||
if(git branch -r --contains master | 9 grep '^ *origin/master$' >/dev/null)
|
||||
$git branch -f master origin/master
|
||||
$git rebase -q origin/master
|
||||
|
||||
case *
|
||||
echo 'codereview: unrecognized command '$1 >[1=2]
|
||||
exit usage
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
# defaultcc: plan9port-dev@googlegroups.com
|
File diff suppressed because it is too large
Load diff
|
@ -1,155 +0,0 @@
|
|||
.TH CODEREVIEW 1
|
||||
.SH NAME
|
||||
codereview \- review of submitted changes (experimental)
|
||||
.SH SYNOPSIS
|
||||
.B git
|
||||
.B diff
|
||||
.B HEAD
|
||||
.I path ...
|
||||
.PP
|
||||
.B codereview
|
||||
[
|
||||
.B -v
|
||||
]
|
||||
.B create
|
||||
.I name
|
||||
.PP
|
||||
.B codereview
|
||||
[
|
||||
.B -v
|
||||
]
|
||||
.B commit
|
||||
.PP
|
||||
.B codereview
|
||||
[
|
||||
.B -v
|
||||
]
|
||||
.B upload
|
||||
.PP
|
||||
.B codereview
|
||||
[
|
||||
.B -v
|
||||
]
|
||||
.B pending
|
||||
.PP
|
||||
.B codereview
|
||||
[
|
||||
.B -v
|
||||
]
|
||||
.B sync
|
||||
.SH DESCRIPTION
|
||||
.I Codereview
|
||||
manages the review and submission of changes to the Plan 9 from User Space project.
|
||||
It must be used from within a Plan 9 from User Space tree
|
||||
checked out via Git
|
||||
(see
|
||||
.IR git (1)).
|
||||
.PP
|
||||
A developer makes changes to a local copy of the tree,
|
||||
reviews them by using
|
||||
.I git
|
||||
.I diff
|
||||
.IR HEAD
|
||||
and then commits them to a ``feature branch''
|
||||
using
|
||||
.I codereview
|
||||
.IR create .
|
||||
Once a feature branch is created, files can still be edited, but they must then be
|
||||
incorporated into the change by using
|
||||
.I codereview
|
||||
.IR commit .
|
||||
.I Git
|
||||
requires that changes be added to a ``staging area'' before the initial commit,
|
||||
using commands such as
|
||||
.I git
|
||||
.I add
|
||||
and
|
||||
.I git
|
||||
.IR rm .
|
||||
The
|
||||
.I codereview
|
||||
.I create
|
||||
and
|
||||
.I codereview
|
||||
.I commit
|
||||
commands
|
||||
automatically move all local modifications to the staging area
|
||||
as part of the commit,
|
||||
using
|
||||
.I git
|
||||
.I commit
|
||||
.IR -a .
|
||||
.PP
|
||||
If other changes have been committed since the feature branch was created,
|
||||
.I codereview
|
||||
.I sync
|
||||
will update it to be based on the most recent copy of the repository.
|
||||
.PP
|
||||
When the code is ready for review,
|
||||
.I codereview
|
||||
.I upload
|
||||
uploads the change to
|
||||
.HR https://plan9port-review.googlesource.com/
|
||||
for review.
|
||||
In order to upload,
|
||||
.I git
|
||||
must have access to a
|
||||
.I $HOME/.netrc
|
||||
that contains a password obtained from
|
||||
.HR https://plan9port-review.googlesource.com/#/settings/http-password .
|
||||
.PP
|
||||
The most likely initial result of a code review is suggestions for
|
||||
improving the code.
|
||||
After making those changes, repeat the
|
||||
.I codereview
|
||||
.I commit
|
||||
and
|
||||
.I codereview
|
||||
.I upload
|
||||
steps.
|
||||
.PP
|
||||
Once the code is ready, it will be submitted by the reviewer using the web interface.
|
||||
At that point,
|
||||
.I codereview
|
||||
.I sync
|
||||
.PP
|
||||
The
|
||||
.I codereview
|
||||
.I pending
|
||||
command lists the active feature branches.
|
||||
.PP
|
||||
All the
|
||||
.I codereview
|
||||
commands take a leading
|
||||
.B -v
|
||||
option, which causes them to print
|
||||
.I git
|
||||
commands being executed.
|
||||
This can be useful for debugging
|
||||
.IR codereview .
|
||||
.PP
|
||||
The
|
||||
.I codereview
|
||||
command depends on a
|
||||
.I git
|
||||
``commit hook''
|
||||
script being in place to add
|
||||
.L Change-Id
|
||||
lines to the commit messages.
|
||||
.I Codereview
|
||||
installs the hook at startup, if necessary,
|
||||
by adding a symbolic link from
|
||||
.B $PLAN9/.git/hooks/commit-msg
|
||||
to
|
||||
.BR $PLAN9/lib/git/commit-msg.hook .
|
||||
.SH SEE ALSO
|
||||
.IR git (1),
|
||||
.HR http://plan9port-review.googlesource.com/
|
||||
.SH BUGS
|
||||
.I Git
|
||||
is too complicated to use.
|
||||
The
|
||||
.I codereview
|
||||
script helps, but a working understanding of
|
||||
.I git
|
||||
is still required.
|
Loading…
Reference in a new issue