Clean up documentation; add --version.

Move manual gerrit remote setup docs from README to man page
(that's advanced usage).

Remove rendundant documentation from the README.

Add --version option.

Add documentation on contributing.

Change-Id: I624b56a629a6120e91ef1bfa0f4bb801b60b9d5d
This commit is contained in:
James E. Blair 2011-10-27 15:18:52 -04:00
parent 90dacb29cd
commit b8b908af1f
3 changed files with 65 additions and 32 deletions

@ -2,20 +2,19 @@
A git command for submitting branches to Gerrit
git-review is a tool that helps submitting git branches to gerrit for review
git-review is a tool that helps submitting git branches to gerrit for
review.
## Setup
git-review, by default, looks for a git remote called gerrit, and submits the current branch to HEAD:refs/for/master at that remote.
If the "gerrit" remote does not exist, git-review looks for a file called .gitreview at the root of the repository with information about the gerrit remote.
If you want to manually create a gerrit remote, for example, to set it to the OpenStack Compute (nova) project (assuming you have previously signed in to the [OpenStack Gerrit server](https://review.openstack.org) with your Launchpad account), you would do:
USERNAME=jsmith # Launchpad username here
PROJECT=openstack/nova
git remote add gerrit ssh://$USERNAME@review.openstack.org:29418/$PROJECT.git
git-review, by default, looks for a git remote called gerrit, and
submits the current branch to HEAD:refs/for/master at that remote.
If the "gerrit" remote does not exist, git-review looks for a file
called .gitreview at the root of the repository with information about
the gerrit remote. Assuming that file is present, git-review should
be able to automatically configure your repository the first time it
is run.
## Usage
@ -23,7 +22,7 @@ Hack on some code, then:
git review
If you want to submit that code to a different target branch, then:
If you want to submit that code to a branch other than "master", then:
git review branchname
@ -35,14 +34,17 @@ If you want to supply a review topic:
git review -t topic/awesome-feature
If you want to submit your change to a branch other than master:
git review milestone-proposed
If you want to skip the automatic rebase -i step:
If you want to skip the automatic "git rebase -i" step:
git review -R
If you want to download change 781 from gerrit to review it:
git review -d 781
## Contributing
To get the latest code or for information about contributing, visit
the project homepage at:
https://launchpad.net/git-review

@ -50,13 +50,21 @@ OPTIONS
.. options:: --setup, -s
Just run throught the repo setup commands and then exit before attempting
Just run through the repo setup commands and then exit before attempting
to submit anything.
.. option:: --verbose, -v
Turns on more verbose output.
.. option:: --help, -h
Print usage information and exit.
.. option:: --version
Print version information and exit.
PROJECT CONFIGURATION
---------------------
@ -68,3 +76,17 @@ information about your gerrit installation in it. The format is::
host=review.example.com
port=29418
project=project.git
MANUAL CONFIGURATION
--------------------
If there is no existing remote named "gerrit", and no ".gitreview"
file in the current repository, you may need to manually create a git
remote called "gerrit". To do so, execute a command like::
USERNAME=jsmith
PROJECT=foobar
git remote add gerrit ssh://$USERNAME@review.example.com:29418/$PROJECT.git
Set USERNAME to your gerrit username, and PROJECT to the project name
in gerrit.

@ -1,18 +1,20 @@
#!/usr/bin/env python
# Copyright 2011 OpenStack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
COPYRIGHT = """\
Copyright (C) 2011 OpenStack LLC.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
See the License for the specific language governing permissions and
limitations under the License."""
import commands
import optparse
@ -399,8 +401,10 @@ def main():
parser.add_option("-s", "--setup", dest="setup", action="store_true",
help="Just run the repo setup commands but don't "
"submit anything")
parser.add_option("--version", dest="version", action="store_true",
help="Print version number and exit")
parser.set_defaults(dry=False, rebase=True, verbose=False, update=False,
setup=False, remote="gerrit")
setup=False, version=False, remote="gerrit")
branch = "master"
(options, args) = parser.parse_args()
@ -413,6 +417,11 @@ def main():
remote = options.remote
status = 0
if options.version:
print '%s, version %s' % (os.path.split(sys.argv[0])[-1], version)
print COPYRIGHT
sys.exit(0)
needs_update = latest_is_newer()
check_remote(remote)