Skip to content

Commit efa6462

Browse files
committed
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.
2 parents 851f7e6 + 871e293 commit efa6462

File tree

5 files changed

+140
-23
lines changed

5 files changed

+140
-23
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Git v1.7.11.6 Release Notes
2+
===========================
3+
4+
Fixes since v1.7.11.5
5+
---------------------
6+
7+
This is primarily documentation and low-impact code clarification.
8+
9+
- "ciabot" script (in contrib/) has been updated with extensive
10+
documentation.
11+
12+
- The "--rebase" option to "git pull" can be abbreviated to "-r",
13+
but we didn't document it.
14+
15+
- It was generally understood that "--long-option"s to many of our
16+
subcommands can be abbreviated to the unique prefix, but it was not
17+
easy to find it described for new readers of the documentation set.
18+
19+
- The "--topo-order", "--date-order" (and the lack of either means
20+
the default order) options to "rev-list" and "log" family of
21+
commands were poorly described in the documentation.
22+
23+
- Older parts of the documentation described as if having a regular
24+
file in .git/refs/ hierarchy were the only way to have branches and
25+
tags, which is not true for quite some time.
26+
27+
- A utility shell function test_seq has been added as a replacement
28+
for the 'seq' utility found on some platforms.
29+
30+
- Fallback 'getpass' implementation made unportable use of stdio API.
31+
32+
- "git commit --amend" let the user edit the log message and then
33+
died when the human-readable committer name was given
34+
insufficiently by getpwent(3).

contrib/ciabot/INSTALL

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
= Installation instructions =
2+
3+
Two scripts are included. The Python one (ciabot.py) is faster and
4+
more capable; the shell one (ciabot.sh) is a fallback in case Python
5+
gives your git hosting site indigestion. (I know of no such sites.)
6+
7+
It is no longer necessary to modify the script in order to put it
8+
in place; in fact, this is now discouraged. It is entirely
9+
configurable with the following git config variables:
10+
11+
ciabot.project = name of the project
12+
ciabot.repo = name of the project repo for gitweb/cgit purposes
13+
ciabot.xmlrpc = if true, ship notifications via XML-RPC
14+
ciabot.revformat = format in which the revision is shown
15+
16+
The revformat variable may have the following values
17+
raw -> full hex ID of commit
18+
short -> first 12 chars of hex ID
19+
describe -> describe relative to last tag, falling back to short
20+
21+
ciabot.project defaults to the directory name of the repository toplevel.
22+
ciabot.repo defaults to ciabot.project lowercased.
23+
ciabot.xmlrpc defaults to True
24+
ciabot.revformat defaults to 'describe'.
25+
26+
This means that in the normal case you need not do any configuration at all,
27+
however setting ciabot.project will allow the hook to run slightly faster.
28+
29+
Once you've set these variables, try your script with -n to see the
30+
notification message dumped to stdout and verify that it looks sane.
31+
32+
To live-test these scripts, your project needs to have been registered with
33+
the CIA site. Here are the steps:
34+
35+
1. Open an IRC window on irc://freenode/commits or your registered
36+
project IRC channel.
37+
38+
2. Run ciabot.py and/or ciabot.sh from any directory under git
39+
control.
40+
41+
You should see a notification on the channel for your most recent commit.
42+
43+
After verifying correct function, install one of these scripts either
44+
in a post-commit hook or in an update hook.
45+
46+
In post-commit, run it without arguments. It will query for
47+
current HEAD and the latest commit ID to get the information it
48+
needs.
49+
50+
In update, call it with a refname followed by a list of commits:
51+
You want to reverse the order git rev-list emits because it lists
52+
from most recent to oldest.
53+
54+
/path/to/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac)

contrib/ciabot/README

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ You probably want the Python version; it's faster, more capable, and
88
better documented. The shell version is maintained only as a fallback
99
for use on hosting sites that don't permit Python hook scripts.
1010

11-
You will find installation instructions for each script in its comment
12-
header.
11+
See the file INSTALL for installation instructions.

contrib/ciabot/ciabot.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
# usage: ciabot.py [-V] [-n] [-p projectname] [refname [commits...]]
1111
#
1212
# This script is meant to be run either in a post-commit hook or in an
13-
# update hook. If there's nothing unusual about your hosting setup,
14-
# you can specify the project name and repo with config variables and
15-
# avoid having to modify this script. Try it with -n to see the
16-
# notification mail dumped to stdout and verify that it looks
17-
# sane. With -V it dumps its version and exits.
13+
# update hook. Try it with -n to see the notification mail dumped to
14+
# stdout and verify that it looks sane. With -V it dumps its version
15+
# and exits.
1816
#
1917
# In post-commit, run it without arguments. It will query for
2018
# current HEAD and the latest commit ID to get the information it
@@ -27,12 +25,17 @@
2725
# /path/to/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac)
2826
#
2927
# Configuration variables affecting this script:
30-
# ciabot.project = name of the project (required)
28+
#
29+
# ciabot.project = name of the project
3130
# ciabot.repo = name of the project repo for gitweb/cgit purposes
3231
# ciabot.xmlrpc = if true (default), ship notifications via XML-RPC
3332
# ciabot.revformat = format in which the revision is shown
3433
#
35-
# The ciabot.repo value defaults to ciabot.project lowercased.
34+
# ciabot.project defaults to the directory name of the repository toplevel.
35+
# ciabot.repo defaults to ciabot.project lowercased.
36+
#
37+
# This means that in the normal case you need not do any configuration at all,
38+
# but setting the project name will speed it up slightly.
3639
#
3740
# The revformat variable may have the following values
3841
# raw -> full hex ID of commit
@@ -102,7 +105,7 @@
102105
# Identify the generator script.
103106
# Should only change when the script itself gets a new home and maintainer.
104107
generator = "http://www.catb.org/~esr/ciabot.py"
105-
version = "3.5"
108+
version = "3.6"
106109

107110
def do(command):
108111
return commands.getstatusoutput(command)[1]
@@ -192,10 +195,17 @@ def report(refname, merged, xmlrpc=True):
192195
print "ciabot.py: version", version
193196
sys.exit(0)
194197

195-
# Cough and die if user has not specified a project
198+
# The project variable defaults to the name of the repository toplevel.
196199
if not project:
197-
sys.stderr.write("ciabot.py: no project specified, bailing out.\n")
198-
sys.exit(1)
200+
here = os.getcwd()
201+
while True:
202+
if os.path.exists(os.path.join(here, ".git")):
203+
project = os.path.basename(here)
204+
break
205+
elif here == '/':
206+
sys.stderr.write("ciabot.py: no .git below root!\n")
207+
sys.exit(1)
208+
here = os.path.dirname(here)
199209

200210
if not repo:
201211
repo = project.lower()

contrib/ciabot/ciabot.sh

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
# usage: ciabot.sh [-V] [-n] [-p projectname] [refname commit]
2222
#
2323
# This script is meant to be run either in a post-commit hook or in an
24-
# update hook. If there's nothing unusual about your hosting setup,
25-
# you can specify the project name and repo with config variables and
26-
# avoid having to modify this script. Try it with -n to see the
27-
# notification mail dumped to stdout and verify that it looks
28-
# sane. With -V it dumps its version and exits.
24+
# update hook. Try it with -n to see the notification mail dumped to
25+
# stdout and verify that it looks sane. With -V it dumps its version
26+
# and exits.
2927
#
3028
# In post-commit, run it without arguments. It will query for
3129
# current HEAD and the latest commit ID to get the information it
@@ -44,11 +42,16 @@
4442
# most recent to least - better to ship notifactions from oldest to newest.
4543
#
4644
# Configuration variables affecting this script:
47-
# ciabot.project = name of the project (makes -p option unnecessary)
45+
#
46+
# ciabot.project = name of the project
4847
# ciabot.repo = name of the project repo for gitweb/cgit purposes
4948
# ciabot.revformat = format in which the revision is shown
5049
#
51-
# The ciabot.repo defaults to ciabot.project lowercased.
50+
# ciabot.project defaults to the directory name of the repository toplevel.
51+
# ciabot.repo defaults to ciabot.project lowercased.
52+
#
53+
# This means that in the normal case you need not do any configuration at all,
54+
# but setting the project name will speed it up slightly.
5255
#
5356
# The revformat variable may have the following values
5457
# raw -> full hex ID of commit
@@ -64,10 +67,27 @@
6467
# shpped from an update in their actual order.)
6568
#
6669

67-
# The project as known to CIA. You can also hardwire this or set it with a
68-
# -p option.
70+
# The project as known to CIA. You can set this with a -p option,
71+
# or let it default to the directory name of the repo toplevel.
6972
project=$(git config --get ciabot.project)
7073

74+
if [ -z $project ]
75+
then
76+
here=`pwd`;
77+
while :; do
78+
if [ -d $here/.git ]
79+
then
80+
project=`basename $here`
81+
break
82+
elif [ $here = '/' ]
83+
then
84+
echo "ciabot.sh: no .git below root!"
85+
exit 1
86+
fi
87+
here=`dirname $here`
88+
done
89+
fi
90+
7191
# Name of the repo for gitweb/cgit purposes
7292
repo=$(git config --get ciabot.repo)
7393
[ -z $repo] && repo=$(echo "${project}" | tr '[A-Z]' '[a-z]')
@@ -100,7 +120,7 @@ urlprefix="http://${host}/cgi-bin/cgit.cgi/${repo}/commit/?id="
100120
# Identify the script. The 'generator' variable should change only
101121
# when the script itself gets a new home and maintainer.
102122
generator="http://www.catb.org/~esr/ciabot/ciabot.sh"
103-
version=3.4
123+
version=3.5
104124

105125
# Addresses for the e-mail
106126
from="CIABOT-NOREPLY@${hostname}"

0 commit comments

Comments
 (0)