使用post-commit钩子时SVN Commit Merge Error

时间:2014-01-28 15:07:49

标签: linux svn netbeans-7 post-commit-hook svncommit

我一直在阅读人们用post-commit钩子提出的其他类似问题。但是没有找到一个足够接近我的问题的它提供了答案:(。我有一个SVN存储库,我能够结账,当我提交时,我试图挂钩它,以便它将自动更新webroot文件夹中。

目前我的提交后脚本如下所示:

#!/bin/sh

#REPOS="$1"
#REV="$2"

cd /var/www/thecruisein.com_dev/ && /usr/bin/svn update --username anon --password anon

具有以下权限:

-rwxr--r--. 1 apache apache 122 Jan 28 10:00 post-commit

但是,当我尝试通过NetBeans将更改提交到文件时,出现以下错误:

org.apache.subversion.javahl.ClientException: E175002: Commit failed (details follow):
E175002: Processing MERGE request response failed: Element type "http:" must be followed by either attribute specifications, ">" or "/>". (/subversion/thecruisein_dev) 
E175002: MERGE request failed on '/subversion/thecruisein_dev'

我暂时禁用了SELinux(行为没有变化:(),而/ usr / bin / svn文件的权限是:

-rwxr-xr-x. 1 apache apache 181500 Apr 11  2013 /usr/bin/svn

当我完全删除提交后脚本时,事情按预期运行(除了webroot当然没有更新)。因此,启用此提交后脚本的subversion似乎存在问题。

任何帮助都会非常感激,因为我不知道下一步该转向:(

1 个答案:

答案 0 :(得分:0)

事实证明我需要在post-commit hook中执行一个编译的程序。

我编译的程序是“autoupdate”,其中包含:

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>

int main(void) {
  execl("/usr/bin/svn", "svn", "update", "/var/www/thecruisein.com_dev/", "--username", "anon", "--password", "anon",
    (const char *) NULL);
  return(EXIT_FAILURE);
}

我的提交后脚本如下所示:

#!/bin/sh

REPOS="$1"
REV="$2"

/var/svn/thecruisein_dev-autoupdate &>/dev/null

(&amp;&gt; / dev / null ---重定向任何输出以防止干扰)

已编译的C程序的文件权限如下:

-rwsr-sr-x   1 apache apache 4813 Jan 28 11:40 thecruisein_dev-autoupdate

这解决了问题并允许提交并自动显示在预期的webroot文件夹中。

相关问题