source: LMDZ6/branches/Ocean_skin/tools/fcm/templates/hook/pre-commit @ 5456

Last change on this file since 5456 was 1578, checked in by jghattas, 13 years ago
  • Add fcm in LMDZ5/tools directory

It is no longer needed to have fcm in your environement PATH variable.
Now makelmdz_fcm takes by default this fcm. It is still possible to use
another fcm, using -fcm_path argument in makelmdz_fcm.

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/bin/ksh
2
3# PRE-COMMIT HOOK
4#
5# The pre-commit hook is invoked before a Subversion txn is
6# committed.  Subversion runs this hook by invoking a program
7# (script, executable, binary, etc.) named 'pre-commit' (for which
8# this file is a template), with the following ordered arguments:
9#
10#   [1] REPOS-PATH   (the path to this repository)
11#   [2] TXN-NAME     (the name of the txn about to be committed)
12#
13# The default working directory for the invocation is undefined, so
14# the program should set one explicitly if it cares.
15#
16# If the hook program exits with success, the txn is committed; but
17# if it exits with failure (non-zero), the txn is aborted, no commit
18# takes place, and STDERR is returned to the client.   The hook
19# program can use the 'svnlook' utility to help it examine the txn.
20#
21# On a Unix system, the normal procedure is to have 'pre-commit'
22# invoke other programs to do the real work, though it may do the
23# work itself too.
24#
25#   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***
26#   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***
27#
28#   This is why we recommend using the read-only 'svnlook' utility.
29#   In the future, Subversion may enforce the rule that pre-commit
30#   hooks should not modify the versioned data in txns, or else come
31#   up with a mechanism to make it safe to do so (by informing the
32#   committing client of the changes).  However, right now neither
33#   mechanism is implemented, so hook writers just have to be careful.
34#
35# Note that 'pre-commit' must be executable by the user(s) who will
36# invoke it (typically the user httpd runs as), and that user must
37# have filesystem-level permission to access the repository.
38#
39# On a Windows system, you should name the hook program
40# 'pre-commit.bat' or 'pre-commit.exe',
41# but the basic idea is the same.
42#
43# The hook program typically does not inherit the environment of
44# its parent process.  For example, a common problem is for the
45# PATH environment variable to not be set to its usual value, so
46# that subprograms fail to launch unless invoked via absolute path.
47# If you're having unexpected problems with a hook program, the
48# culprit may be unusual (or missing) environment variables.
49#
50# Here is an example hook script, for a Unix /bin/sh interpreter.
51# For more examples and pre-written hooks, see those in
52# the Subversion repository at
53# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
54# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
55
56REPOS="$1"
57TXN="$2"
58
59# Check that the author of this commit has the rights to perform
60# the commit on the files and directories being modified.
61script=$REPOS/hooks/svnperms.py
62if [[ -x $script ]]; then
63  $script -r "$REPOS" -t "$TXN" -f ${REPOS}/hooks/svnperms.conf || exit 1
64fi
65
66# Check that the size of the transaction does not exceed 5Mb
67size=$(du -b -s $REPOS/db/transactions/$TXN.txn | cut -f 1)
68if (($size > 5242880)); then
69  echo \
70"Your changeset requires a disk space ($size bytes) exceeding our 5Mb limit.
71Please contact the FCM team if you need to bypass this restriction." >&2
72  exit 1
73fi
74
75# All checks passed, so allow the commit.
76exit 0
Note: See TracBrowser for help on using the repository browser.