Announcement

Collapse
No announcement yet.

Pre commit hook to check svn externals and report back if they are not relative path

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pre commit hook to check svn externals and report back if they are not relative path

    Hi,

    We are using svn multisite and we are having hard time with the svn externals as users are adding externals with the hard coded path. So we want to do a pre commit hook to reject if the svn externals are not relative path.

    We found a similar one at disabling-creation-of-svn-externals-is-this-possible in the forum but the REPONAME=$(${ECHO} ${REPOS} | rev | cut -d / -f1 | rev) is not giving the path of the svn externals.

    Any help with this regards is very much appreciated.

    SVNLOOK=/usr/bin/svnlook
    GREP=/bin/grep
    PRINTF=/usr/bin/printf
    MKTEMP=/bin/mktemp
    RM=/bin/rm
    REPONAME=$(${ECHO} ${REPOS} | rev | cut -d / -f1 | rev)

    # Block all users from creating svn:externals in this repo
    SVN_TMP=$(${MKTEMP})
    SVN_TMP_DIRS=$(${MKTEMP})
    ${SVNLOOK} dirs-changed --transaction "${TXN}" "${REPOS}" > ${SVN_TMP_DIRS}
    while read LINE; do
    ${SVNLOOK} propget --verbose --transaction "${TXN}" "${REPOS}" svn:externals ${LINE} | ${GREP} -q "svn:externals"
    if [ $? == 0 ] ; then
    ${PRINTF} "\nMyCompanyName - SVN pre-commit hook message:\nThe policies of this SVN repo (${REPONAME}) prohibit the creation of svn:external properties.\n" > ${SVN_TMP}
    ${CAT} ${SVN_TMP} 1>&2
    ${RM} -f ${SVN_TMP} ${SVN_TMP_DIRS}
    exit 1
    fi
    done < ${SVN_TMP_DIRS}
    ${RM} -f ${SVN_TMP} ${SVN_TMP_DIRS}

  • #2
    Victor, I hope you reached out to WANdisco support before now - I just found your posting.

    First, if you're using "SVN MultiSite" then you need to use a pre-replication hook, not a pre-commit hook.

    Beyond that, did you figure out the problem with your script?

    Comment

    Working...
    X