svn commit: r196613 - projects/jbuild/usr.bin/jdirdep
Craig Rodrigues
rodrigc at FreeBSD.org
Fri Aug 28 10:25:02 UTC 2009
Author: rodrigc
Date: Fri Aug 28 10:25:01 2009
New Revision: 196613
URL: http://svn.freebsd.org/changeset/base/196613
Log:
- add some help
- make sure that ssh-agent is running before invoking svn
- pass -F and -m flags down to svn, to facilitate specifying logs
Modified:
projects/jbuild/usr.bin/jdirdep/jcommit
Modified: projects/jbuild/usr.bin/jdirdep/jcommit
==============================================================================
--- projects/jbuild/usr.bin/jdirdep/jcommit Fri Aug 28 10:23:40 2009 (r196612)
+++ projects/jbuild/usr.bin/jdirdep/jcommit Fri Aug 28 10:25:01 2009 (r196613)
@@ -2,6 +2,76 @@
#
# $FreeBSD$
#
+## NAME:
+## jcommit - run "jbuild check-commit", then commit code to repository
+##
+## SYNOPSIS:
+## jcommit [options]
+##
+## DESCRIPTION:
+##
+## Verify that code compiles by running "jbuild check-commit".
+## If successful, commit code to repository.
+##
+## OPTIONS:
+##
+## -h
+## --help
+## This manual page is emitted.
+##
+## -F "file"
+## Read commit log message from "file".
+##
+## -m "msg"
+## Specify commit log message "msg".
+##
+
+ShowHelp()
+{
+ grep ^## $0 | sed -e 's/^##//' | ${PAGER}
+ exit 0
+}
+
+# Here is a trick to make sure that ssh-agent is running before
+# we start doing a bunch of svn operations over ssh.
+
+# Try to list identities in ssh-agent
+ssh-add -l > /dev/null 2>&1
+ret=$?
+if [ $ret -eq 2 ]
+then
+ # Couldn't open a connection to ssh-agent,
+ # so let's start one, and re-execute this script under ssh-agent.
+ exec ssh-agent $0 "$@"
+elif [ $ret -eq 1 ]
+then
+ # Couldn't find passphrase in ssh-agent, so let's
+ # prompt user for to add passphrase to ssh-agent
+ ssh-add
+ if [ $? -ne 0 ]
+ then
+ # If user does not have a valid ssh key in $HOME/.ssh,
+ # then ssh-add will fail, but not print any error messages to stdout.
+ echo "ERROR: ssh-add FAILED. You may see password prompt"
+ echo "multiple times, and possibly time out or fail."
+ echo "Please set up ssh-agent properly to avoid this:"
+ echo ""
+
+ exit 1
+ fi
+fi
+
+# parse flags
+while getopts "F:m:h" my_opt
+do
+ case $my_opt in
+ h) ShowHelp; exit 0;;
+ F) commit_msg_file="-F $OPTARG" ;;
+ m) commit_msg="-m $OPTARG" ;;
+ [?]) echo "Bad Option"; ShowHelp; exit 1 ;;
+ esac
+done
+shift $(($OPTIND-1))
srcdir=`jbuild -V .SRCTOP test`
@@ -12,4 +82,4 @@ then
fi
echo $srcdir
cd $srcdir
-svn commit
+svn commit ${commit_msg_file} ${commit_msg}
More information about the svn-src-projects
mailing list