I'm looking for a part-time remote job.

Hire me


I'm the author of:

Mastering Redmine is a comprehensive guide with tips, tricks and best practices, and an easy-to-learn structure.

Check the book's project or

Buy the book

Social pages of the book:

By buying this book you also donate to Redmine (see this page).


Follow me:

copy-hooks.sh

The script - Andriy Lesyuk, 13 Nov 2011 19:38

Download (825 Bytes)

 
1
#!/bin/sh
2

    
3
SCM_REPO_PATH=$1
4
SCM_TYPE=$2
5
SCM_PROJECT=$3
6

    
7
SCM_REPO_NAME=$(basename $SCM_REPO_PATH)
8
SCM_REPO_ROOT=$(dirname $SCM_REPO_PATH)
9

    
10
SVN_HOOKS=
11
GIT_HOOKS=
12
MERCURIAL_HGRC=
13

    
14
[ -d "$SCM_REPO_PATH" ] || exit 1
15

    
16
case "$SCM_TYPE" in
17
    svn)
18
        if [ -d "$SVN_HOOKS" ]; then
19
            mkdir -p "$SCM_REPO_PATH/hooks"
20
            cp -aR $SVN_HOOKS/* "$SCM_REPO_PATH/hooks"
21
        fi
22
        ;;
23
    git)
24
        if [ -d "$GIT_HOOKS" ]; then
25
            mkdir -p "$SCM_REPO_PATH/hooks"
26
            cp -aR $GIT_HOOKS/* "$SCM_REPO_PATH/hooks"
27
        fi
28
        ;;
29
    mercurial)
30
        if [ -f "$MERCURIAL_HGRC" ]; then
31
            mkdir -p "$SCM_REPO_PATH/.hg"
32
            cp "$MERCURIAL_HGRC" "$SCM_REPO_PATH/.hg/hgrc"
33
        fi
34
        ;;
35
    *)
36
        echo "SCM not supported: $SCM_TYPE" >&2
37
        ;;
38
esac
39

    
40
exit 0
Terms of use | Privacy policy