[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

start-commit.bat

From: Masaru Tsuchiyama <m.tmatma_at_gmail.com>
Date: 2007-11-08 00:56:13 CET

Hello

Issue 2991 is supported on trunk.
Then I tried this on Windows, but encountered a problem.

CAPABILITIES parameter is a comma-separated list,
but it seems that windows shell(cmd.exe) separates it by comma
and passes them as separate parameters.

1. create test repository
        D:\tmp> svnadmin create test

2. create start-commit.bat at d:\tmp2\tmp\hooks.
        # start-commit.bat
            echo "%1" > out.txt
        echo "%2" >> out.txt
        echo "%3" >> out.txt

        exit 1

3. checkout from the repository
        D:\tmp>svn co file:///D:/tmp/test tmptmp
        Checked out revision 0.

4. add a file to working copy.
        D:\tmp\tmptmp>dir > dir.txt

        D:\tmp\tmptmp>svn add dir.txt
        A dir.txt

5. commit it
        D:\tmp\tmptmp>svn ci -m "add dir.txt"
        svn: Commit failed (details follow):
        svn: 'start-commit' hook failed (exited with a non-zero exitcode
        of 1). No error output was produced by the hook.

6. check out.txt
        D:\tmp\tmptmp>type out.txt
        "D:\tmp\test"
        "tsuchiyama"
        "depth"

7. change start-commit.bat
        # start-commit.bat
            echo "%1" > out.txt
        echo "%2" >> out.txt
        echo "%3" >> out.txt
        echo "%4" >> out.txt
        echo "%5" >> out.txt

        exit 1

8. commit again
        D:\tmp\tmptmp>svn ci -m "add dir.txt"
        svn: Commit failed (details follow):
        svn: 'start-commit' hook failed (exited with a non-zero exitcode
        of 1). No error output was produced by the hook.

9. check out.txt
        D:\tmp\tmptmp>type out.txt
        "D:\tmp\test"
        "tsuchiyama"
        "depth"
        "mergeinfo"
        "log-revprops"

I make test.bat.
        echo "%1"
        echo "%2"
        echo "%3"
        echo "%4"
        echo "%5"

Run with 5 parameters.
        D:\tmp\tmptmp>test.bat 1 2 3 4 5

        D:\tmp\tmptmp>echo "1"
        "1"

        D:\tmp\tmptmp>echo "2"
        "2"

        D:\tmp\tmptmp>echo "3"
        "3"

        D:\tmp\tmptmp>echo "4"
        "4"

        D:\tmp\tmptmp>echo "5"
        "5"

Run with 3 parametes (last parameter is separated with comma)
        D:\tmp\tmptmp>test.bat 1 2 3,4,5

        D:\tmp\tmptmp>echo "1"
        "1"

        D:\tmp\tmptmp>echo "2"
        "2"

        D:\tmp\tmptmp>echo "3"
        "3"

        D:\tmp\tmptmp>echo "4"
        "4"

        D:\tmp\tmptmp>echo "5"
        "5"

Run with 3 parametes (last parameter is separated with colon)
        D:\tmp\tmptmp>test.bat 1 2 3:4:5

        D:\tmp\tmptmp>echo "1"
        "1"

        D:\tmp\tmptmp>echo "2"
        "2"

        D:\tmp\tmptmp>echo "3:4:5"
        "3:4:5"

        D:\tmp\tmptmp>echo ""
        ""

        D:\tmp\tmptmp>echo ""
        ""

-- 
Masaru Tsuchiyama <m.tmatma@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 8 00:56:19 2007

This is an archived mail posted to the Subversion Dev mailing list.