Merge branch 'maint'

* maint:
  Prepare for 1.7.11.6
  Make the ciabot scripts completely self-configuring in the normal case.
  Improved documentation for the ciabot scripts.
This commit is contained in:
Junio C Hamano 2012-08-24 13:13:53 -07:00
commit efa646213a
5 changed files with 140 additions and 23 deletions

View file

@ -0,0 +1,34 @@
Git v1.7.11.6 Release Notes
===========================
Fixes since v1.7.11.5
---------------------
This is primarily documentation and low-impact code clarification.
- "ciabot" script (in contrib/) has been updated with extensive
documentation.
- The "--rebase" option to "git pull" can be abbreviated to "-r",
but we didn't document it.
- It was generally understood that "--long-option"s to many of our
subcommands can be abbreviated to the unique prefix, but it was not
easy to find it described for new readers of the documentation set.
- The "--topo-order", "--date-order" (and the lack of either means
the default order) options to "rev-list" and "log" family of
commands were poorly described in the documentation.
- Older parts of the documentation described as if having a regular
file in .git/refs/ hierarchy were the only way to have branches and
tags, which is not true for quite some time.
- A utility shell function test_seq has been added as a replacement
for the 'seq' utility found on some platforms.
- Fallback 'getpass' implementation made unportable use of stdio API.
- "git commit --amend" let the user edit the log message and then
died when the human-readable committer name was given
insufficiently by getpwent(3).

54
contrib/ciabot/INSTALL Normal file
View file

@ -0,0 +1,54 @@
= Installation instructions =
Two scripts are included. The Python one (ciabot.py) is faster and
more capable; the shell one (ciabot.sh) is a fallback in case Python
gives your git hosting site indigestion. (I know of no such sites.)
It is no longer necessary to modify the script in order to put it
in place; in fact, this is now discouraged. It is entirely
configurable with the following git config variables:
ciabot.project = name of the project
ciabot.repo = name of the project repo for gitweb/cgit purposes
ciabot.xmlrpc = if true, ship notifications via XML-RPC
ciabot.revformat = format in which the revision is shown
The revformat variable may have the following values
raw -> full hex ID of commit
short -> first 12 chars of hex ID
describe -> describe relative to last tag, falling back to short
ciabot.project defaults to the directory name of the repository toplevel.
ciabot.repo defaults to ciabot.project lowercased.
ciabot.xmlrpc defaults to True
ciabot.revformat defaults to 'describe'.
This means that in the normal case you need not do any configuration at all,
however setting ciabot.project will allow the hook to run slightly faster.
Once you've set these variables, try your script with -n to see the
notification message dumped to stdout and verify that it looks sane.
To live-test these scripts, your project needs to have been registered with
the CIA site. Here are the steps:
1. Open an IRC window on irc://freenode/commits or your registered
project IRC channel.
2. Run ciabot.py and/or ciabot.sh from any directory under git
control.
You should see a notification on the channel for your most recent commit.
After verifying correct function, install one of these scripts either
in a post-commit hook or in an update hook.
In post-commit, run it without arguments. It will query for
current HEAD and the latest commit ID to get the information it
needs.
In update, call it with a refname followed by a list of commits:
You want to reverse the order git rev-list emits because it lists
from most recent to oldest.
/path/to/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac)

View file

@ -8,5 +8,4 @@ You probably want the Python version; it's faster, more capable, and
better documented. The shell version is maintained only as a fallback
for use on hosting sites that don't permit Python hook scripts.
You will find installation instructions for each script in its comment
header.
See the file INSTALL for installation instructions.

View file

@ -10,11 +10,9 @@
# usage: ciabot.py [-V] [-n] [-p projectname] [refname [commits...]]
#
# This script is meant to be run either in a post-commit hook or in an
# update hook. If there's nothing unusual about your hosting setup,
# you can specify the project name and repo with config variables and
# avoid having to modify this script. Try it with -n to see the
# notification mail dumped to stdout and verify that it looks
# sane. With -V it dumps its version and exits.
# update hook. Try it with -n to see the notification mail dumped to
# stdout and verify that it looks sane. With -V it dumps its version
# and exits.
#
# In post-commit, run it without arguments. It will query for
# current HEAD and the latest commit ID to get the information it
@ -27,12 +25,17 @@
# /path/to/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac)
#
# Configuration variables affecting this script:
# ciabot.project = name of the project (required)
#
# ciabot.project = name of the project
# ciabot.repo = name of the project repo for gitweb/cgit purposes
# ciabot.xmlrpc = if true (default), ship notifications via XML-RPC
# ciabot.revformat = format in which the revision is shown
#
# The ciabot.repo value defaults to ciabot.project lowercased.
# ciabot.project defaults to the directory name of the repository toplevel.
# ciabot.repo defaults to ciabot.project lowercased.
#
# This means that in the normal case you need not do any configuration at all,
# but setting the project name will speed it up slightly.
#
# The revformat variable may have the following values
# raw -> full hex ID of commit
@ -102,7 +105,7 @@
# Identify the generator script.
# Should only change when the script itself gets a new home and maintainer.
generator = "http://www.catb.org/~esr/ciabot.py"
version = "3.5"
version = "3.6"
def do(command):
return commands.getstatusoutput(command)[1]
@ -192,10 +195,17 @@ def report(refname, merged, xmlrpc=True):
print "ciabot.py: version", version
sys.exit(0)
# Cough and die if user has not specified a project
# The project variable defaults to the name of the repository toplevel.
if not project:
sys.stderr.write("ciabot.py: no project specified, bailing out.\n")
sys.exit(1)
here = os.getcwd()
while True:
if os.path.exists(os.path.join(here, ".git")):
project = os.path.basename(here)
break
elif here == '/':
sys.stderr.write("ciabot.py: no .git below root!\n")
sys.exit(1)
here = os.path.dirname(here)
if not repo:
repo = project.lower()

View file

@ -21,11 +21,9 @@
# usage: ciabot.sh [-V] [-n] [-p projectname] [refname commit]
#
# This script is meant to be run either in a post-commit hook or in an
# update hook. If there's nothing unusual about your hosting setup,
# you can specify the project name and repo with config variables and
# avoid having to modify this script. Try it with -n to see the
# notification mail dumped to stdout and verify that it looks
# sane. With -V it dumps its version and exits.
# update hook. Try it with -n to see the notification mail dumped to
# stdout and verify that it looks sane. With -V it dumps its version
# and exits.
#
# In post-commit, run it without arguments. It will query for
# current HEAD and the latest commit ID to get the information it
@ -44,11 +42,16 @@
# most recent to least - better to ship notifactions from oldest to newest.
#
# Configuration variables affecting this script:
# ciabot.project = name of the project (makes -p option unnecessary)
#
# ciabot.project = name of the project
# ciabot.repo = name of the project repo for gitweb/cgit purposes
# ciabot.revformat = format in which the revision is shown
#
# The ciabot.repo defaults to ciabot.project lowercased.
# ciabot.project defaults to the directory name of the repository toplevel.
# ciabot.repo defaults to ciabot.project lowercased.
#
# This means that in the normal case you need not do any configuration at all,
# but setting the project name will speed it up slightly.
#
# The revformat variable may have the following values
# raw -> full hex ID of commit
@ -64,10 +67,27 @@
# shpped from an update in their actual order.)
#
# The project as known to CIA. You can also hardwire this or set it with a
# -p option.
# The project as known to CIA. You can set this with a -p option,
# or let it default to the directory name of the repo toplevel.
project=$(git config --get ciabot.project)
if [ -z $project ]
then
here=`pwd`;
while :; do
if [ -d $here/.git ]
then
project=`basename $here`
break
elif [ $here = '/' ]
then
echo "ciabot.sh: no .git below root!"
exit 1
fi
here=`dirname $here`
done
fi
# Name of the repo for gitweb/cgit purposes
repo=$(git config --get ciabot.repo)
[ -z $repo] && repo=$(echo "${project}" | tr '[A-Z]' '[a-z]')
@ -100,7 +120,7 @@ urlprefix="http://${host}/cgi-bin/cgit.cgi/${repo}/commit/?id="
# Identify the script. The 'generator' variable should change only
# when the script itself gets a new home and maintainer.
generator="http://www.catb.org/~esr/ciabot/ciabot.sh"
version=3.4
version=3.5
# Addresses for the e-mail
from="CIABOT-NOREPLY@${hostname}"