aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2017-09-01 13:16:12 -0400
committerRuss Cox <rsc@swtch.com>2017-09-01 13:25:20 -0400
commit6cb3a2b9c3cf191c613985fc893c8a88a9b6d76f (patch)
tree11256313e8339c4f805028381bca890d99885e11 /bin
parenta83f4518e6dca293847ffad0e234619ad1109406 (diff)
downloadplan9port-6cb3a2b9c3cf191c613985fc893c8a88a9b6d76f.tar.gz
plan9port-6cb3a2b9c3cf191c613985fc893c8a88a9b6d76f.tar.bz2
plan9port-6cb3a2b9c3cf191c613985fc893c8a88a9b6d76f.zip
codereview: delete, now using GitHub pull requests
Diffstat (limited to 'bin')
-rwxr-xr-xbin/codereview147
1 files changed, 0 insertions, 147 deletions
diff --git a/bin/codereview b/bin/codereview
deleted file mode 100755
index ffa0e3cd..00000000
--- a/bin/codereview
+++ /dev/null
@@ -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
-}