English 中文(简体)
我们能够使用vn hooks改变缺省承诺模板
原标题:Can we change the default svn commit template using svn hooks

I primarily wanted to change my default commit template(svn-commit.tmp) on the fly when I do a svn commit. I got the knew from forums that setting the SVN_EDITOR would help

setenv SVN_EDITOR "rm svn-commit.tmp && cp $REPO/hooks/log.tmpl svn-commit.tmp && emacs"

But this would happen only if the user sets the SVN_EDITOR in his user environment as above. So is there any other explicit way that when I do a svn commit, I will open a template file from a different location rather than the default one. The commit template would be more specific to repositories and the date of commit. So is there a way where I can set some property on the svn repository to invoke a different commit template. I should enforce it to all(repository specific) and it should not be user-specific like setting the SVN_EDITOR. Even if we are setting the SVN_EDITOR can this setting be called when we do a svn commit by calling some hooks. I understand that pre & post commit hooks will be called only after the commit is submitted.

我们只使用野蛮的指挥客户。

问题回答

有两个可能的途径可以走下去,这取决于您必须使用的颠覆客户:

  • TortoiseSVN: use the client hooks for that purpose
  • SVN command client: use a shell script and some svn properties

TortoiseSVN Client Hooks

当你看一看托维索拉尼的“Clientside Hook 方言”章时 帮助,请见以下章节:

启动承诺

在放映方言之前发出。 如果忽略一个版本的档案,并影响需要承诺和(或)发出信息的档案清单,你可能希望利用这一资料。 然而,你应该指出,由于 h是在早期阶段被点击,所以无法提供被选定作 commit的物体的完整清单。

h有以下论点:

  • PATH: A path to a temporary file which contains all the paths for which the operation was started. Each path is on a separate line in the temp file.
  • MESSAGEFILE: Path to a file containing the log message for the commit. The file contains the text in UTF-8 encoding. After successful execution of the start-commit hook, the log message is read back, giving the hook a chance to modify it.
  • CWD: The current working directory with which the script is run. This is set to the common root directory of all affected paths.

因此,根据目录,你有实施小幅文字的成分,以改变雕塑模板。 然而,你们必须注意如何部署客户,因为每个用户必须自行安装。

SVN command client script and svn:template-file property

  1. Define a shell script that will call the real subversion command inside.
  2. Define a svn property on directories with a useful name (like template-file) and search from the starting directory upwards a directory that has that svn property set.
  3. Use the found property as the file name to look up the contents (possibly should be an URL, so no local installation of these templates necessary).
  4. If none is found, use the default template.

然而,你也必须在客户上安装这一文字。 没有任何颠覆机制允许使用不同的模板,而不必在客户上再安装。

这里是我创建的。 它试图使用TortoiseSVN模板,否则就会在全球Gite config中找到一个模板,否则就会回到模板中。

请注意,使用标准TortoiseSVN模板财产并不意味着必须安装TortoiseSVN。





相关问题
Best practices for Subversion and Visual Studio projects

I ve recently started working on various C# projects in Visual Studio as part of a plan for a large scale system that will be used to replace our current system that s built from a cobbling-together ...

Changing username in SVN+SSH URI on the fly in working copy

I am using SVN+SSH to check out a working copy of repository from an SVN server on which all developers are members of a developer group and have full read/write permissions on the repository ...

ASP.NET MVC: How should it work with subversion?

So, I have an asp.net mvc app that is being worked on by multiple developers in differing capacities. This is our first time working on a mvc app and my first time working with .NET. Our app does not ...

How to search for file in subversion server?

Is there a way to search for a file in a subversion repository? Something similar to Unix find command, with which I can find the location of a file in a repository. I know there is svn list, but ...

热门标签