Visual SVN Server:提交前/提交后挂钩指南

发布于 2024-11-03 03:45:42 字数 841 浏览 0 评论 0原文

考虑到这里的评论,这可能是最好的维基百科: 分享常见/有用的 SVN 预提交挂钩

我正在使用 Visual Windows 7 计算机上的 SVN 2.1.7。我们有来自不同国家/地区的开发人员,我们可以通过运行更改的本地副本,然后通过 ftp 手动上传到正在处理的每个网站的服务器来管理代码更改。

这是一个非常耗时的过程,但比修复实时网站上的错误要少耗时,因此这是朝着正确方向迈出的一步。

在 Visual SVN 网站上,它提到了提交后和提交前挂钩,但未能显示可以访问的位置,即使它提到有一个 GUI。安装的版本中没有 GUI 的迹象,甚至没有选项,所以我首先无法找到访问它的位置。

假设它可以通过脚本来完成,我已经用谷歌搜索并来到SO寻找一些关于它可能在哪里以及如何完成的指导,但它似乎比我希望的要复杂得多。

有谁有关于如何在 Windows 上执行以下任务(未安装 perl)的经验或指导(包括示例脚本)?

a) 创建预提交命令/文件并将其执行附加到存储库/提交给它 b) 创建一个提交后命令/文件并将其执行附加到存储库/提交给它

,在我的例子中,这是一项特定任务: c) 如何在 PC 上安装本地 Visual SVN,以便将提交的文件发送到远程 CentOS 共享托管服务器(不是 VPS/Dedi 或云托管,并且 SVN 无法安装在这些计算机上)。

这是一个很棒的软件,但是似乎要高效地使用它的障碍相当高,因为不清楚您需要问什么问题或在哪里寻找。希望您可以帮助那些陷入同样困境的人提供一个更好的起点。

谢谢 :)

This may be best as a wiki, given comments on here:
Share common / useful SVN pre-commit hooks

I'm using Visual SVN 2.1.7 on a Windows 7 machine. We have developers committing from various countries and we can manage the code changes by running local copies of the changes and then uploading manually via ftp to the server for each website that's being worked on.

This is an incredibly time consuming process, but less time-consuming than fixing bugs on live sites, so it's a step in the right direction.

On the Visual SVN website it makes a mention of post-commit and pre-commit hooks but fails to show where that can be accessed, even though it mentions there is a GUI. There's no sign of a GUI or even an option in the installed version, so I can't locate, firstly, where to access it.

Assuming it can be done via scripting, I have googled and come to SO to look for some guidance on where it might be and how it might be done, but it seems to be a lot more complicated than I'd hoped.

Does anyone have any experience or guidance, including sample scripts, for how to perform the following tasks on Windows (without perl installed)?

a) Create a pre-commit command/file and attach its execution to a repository/commits to it
b) Create a post-commit command/file and attach its execution to a repository/commits to it

and in my case, one specific task:
c) How to have a local Visual SVN installation on a PC that can send committed files to remote CentOS shared hosted server (not VPS/Dedi or Cloud hosted and SVN can't be installed on those machines)

It's a great piece of software but it seems like the barrier is quite high to being efficient with it because it's unclear what questions you need to ask or where to look. Hopefully, you can help provide a better starting point for those stuck in the same way.

Thanks :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

虐人心 2024-11-10 03:45:42

访问钩子:

1.启动VisualSVN服务器管理器

2.打开存储库的属性

3.选择“Hooks”选项卡

4.编辑需要的hook

挂钩是约定而不是基于配置。您不必将它们“挂钩”。创建一个 pre-commit 挂钩,这样您就可以在提交之前运行一个挂钩。创建一个 post-commit 挂钩,这样您就有了一个在提交后运行的挂钩。

以下是您可以在提交后脚本中根据需要执行的步骤:

您将存储库路径和修订版作为参数提交给提交后挂钩,因此请使用类似 repo=%1 的内容和 rev=%2 来获取这些值。

提交后复制文件的一种方法是在您的服务器上有一个工作副本,在提交后在提交后挂钩中对此工作副本发出 svn update ,然后复制文件。您可以通过使用 获取更改的文件来选择性地复制文件svnlook 已更改。 svnlook 需要修订并使用您之前设置的 rev 变量。

脚本本身可以是任何语言。

Access to hooks:

1.Start VisualSVN Server Manager

2.Open Properties for your repository

3.Select Hooks tab

4.Edit the needed hook

Hooks are convention rather than configuration based. You don't have to "hook" them up. Create a pre-commit hook and you have a hook running before commits. Create a post-commit hook and you have a hook that runs after a commit.

Here are the steps you can do in your post-commit script for what you need:

You get the repo path and revision commited as arguments to the post-commit hook, so use something like repo=%1 and rev=%2 to get these values.

One way to copy files after commit would be to have a working copy on your server, issue an svn update on this working copy after your commit in your post-commit hook and then copy over the files. You can selectively copy over files by getting the files that changed using svnlook changed. svnlook needs a revision and use the rev variable that you set earlier.

The script itself can be in any language.

下壹個目標 2024-11-10 03:45:42

存储库挂钩 部分://www.visualsvn.com/server/documentation/" rel="nofollow noreferrer">VisualSVN 服务器 |文档页面。

通常,可以从 VisualSVN 中配置挂钩服务器管理器控制台或使用Add-SvnRepositoryHook PowerShell cmdlet。

有一个钩子脚本列表(.cmd 脚本):
挂钩选项卡

和一个简单的编辑器:
Hooks 编辑器

如果需要,您始终可以在您喜欢的文本编辑器(例如,此屏幕截图中的 Notepad++)中打开挂钩脚本,或使用可执行文件作为挂钩:
Notepad++

There is a dedicated Repository Hooks section on the VisualSVN Server | Documentation page.

Typically, the hooks can be configured from within the VisualSVN Server Manager console or using the Add-SvnRepositoryHook PowerShell cmdlet.

There is a list of hook scripts (.cmd scripts):
Hooks tab

And a simple editor:
Hooks editor

If needed, you can always open the hook script in your favorite text editor (e.g., Notepad++ as on this screenshot) or use an executable file as your hook:
Notepad++

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文