summaryrefslogtreecommitdiffstats
path: root/hg-commit
blob: 2f6ea9af511139c10b2060d871df08497e35d46d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash

MUTTDIR=$(dirname $0)

$MUTTDIR/check_sec.sh
if [ -f $MUTTDIR/doc/manual.xml ] ; then
  ( cd $MUTTDIR/doc/ && make validate )
fi

lrev=$(hg log --limit 1 --template '{rev}' ChangeLog)
trev=$(hg tip --template '{rev}')
if [ $lrev = $trev ]
then
  exec hg commit "$@"
fi

# Include ChangeLog if given any explicit file names
i=0
while [[ $i -lt $# ]]
do
  i=$((i+1))
  case "${!i}" in
    # no-argument options
    -A) continue ;;
    # one-argument options
    -?) i=$((i+1)); continue ;;
    # one-argument options with no space
    -*) continue ;;
    *) cl=ChangeLog ;;
  esac
done

{
  hg log --no-merges --style=./hg-changelog-map -r tip:$lrev
  hg cat ChangeLog
} > ChangeLog
${VISUAL:-${EDITOR-:vi}} ChangeLog

hg commit "$@" $cl