本文介绍了在没有URL/Subversion后端的情况下将Fogbugz与TortoiseSVN集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了TotroiseSVN,并且我的大多数存储库都可以从C:\ subversion \ 签入和签出,还可以从网络共享中签入和签出(我最初发布此文档时就忘记了这一点)问题).

I've got TotroiseSVN installed and have a majority of my repositories checking in and out from C:\subversion\ and a couple checking in and out from a network share (I forgot about this when I originally posted this question).

这意味着我本来就没有"subversion"服务器.

This means that I don't have a "subversion" server per-se.

如何集成TortoiseSVN和Fogbugz?

How do I integrate TortoiseSVN and Fogbugz?

插入的斜体

推荐答案

我一直在研究此问题,并设法使其正常运行.有几个小问题,但是可以解决.

I've been investigating this issue and have managed to get it working. There are a couple of minor problems but they can be worked-around.

此问题分为三个不同的部分,如下所示:

There are 3 distinct parts to this problem, as follows:

  1. TortoiseSVN部分-使TortoiseSVN将Bugid和超链接插入svn日志中

  1. The TortoiseSVN part - getting TortoiseSVN to insert the Bugid and hyperlink in the svn log

FogBugz部分-使FogBugz插入SVN信息和相应的链接

The FogBugz part - getting FogBugz to insert the SVN info and corresponding links

WebSVN部分-确保FogBugz的链接确实有效

The WebSVN part - ensuring the links from FogBugz actually work

第1部分的说明在另一个答案中,尽管它实际上做了超出要求的内容.有关钩子的内容实际上是第2部分的内容,并且已指出-它开箱即用"不起作用

Instructions for part 1 are in another answer, although it actually does more than required. The stuff about the hooks is actually for part 2, and as is pointed out - it doesn't work "out of the box"

只需确认一下,我们正在考虑使用TorniseSVN WITHOUT SVN服务器(即基于文件的存储库)

Just to confirm, we are looking at using TortoiseSVN WITHOUT an SVN server (ie. file-based repositories)

我正在使用UNC路径访问存储库,但它也适用于本地驱动器或映射驱动器.

I'm accessing the repositories using UNC paths, but it also works for local drives or mapped drives.

所有这一切都适用于TortoiseSVN v1.5.3和SVN Server v1.5.2(您需要安装SVN Server,因为第2部分需要服务器软件包中的svnlook.exe.您实际上没有将其配置为以SVN服务器)甚至可以只从另一台计算机复制svnlook.exe并将其放在路径中的某个位置.

All of this works with TortoiseSVN v1.5.3 and SVN Server v1.5.2 (You need to install SVN Server because part 2 needs svnlook.exe which is in the server package. You don't actually configure it to work as an SVN Server) It may even be possible to just copy svnlook.exe from another computer and put it somewhere in your path.

创建TortoiseSVN属性是获得SVN日志中的链接所必需的.

Creating the TortoiseSVN properties is all that is required in order to get the links in the SVN log.

以前的说明可以正常工作,为方便起见,我在这里引用它们:

Previous instructions work fine, I'll quote them here for convenience:

  1. 右键单击要使用的已签出项目的根目录.

  1. Right click on the root directory of the checked out project you want to work with.

选择"TortoiseSVN->属性"

Select "TortoiseSVN -> Properties"

通过单击新建..."并分别在属性名称"和属性值"中插入以下内容来添加五个属性值对:(确保您分别为每个属性勾选递归应用属性")

Add five property value pairs by clicking "New..." and inserting the following in "Property Name" and "Property Value" respectively: (make sure you tick "Apply property recursively" for each one)

bugtraq:label    BugzID:
bugtraq:message  BugzID: %BUGID%
bugtraq:number   true
bugtraq:url      http://[your fogbugz URL here]/default.asp?%BUGID%
bugtraq:warnifnoissue   false

  • 单击确定"

  • Click "OK"

    正如Jeff所说,您需要为每个工作副本执行此操作,因此请遵循他的指示来迁移属性.

    As Jeff says, you'll need to do that for each working copy, so follow his instructions for migrating the properties.

    就是这样.现在,当您提交时,TortoiseSVN将添加一个链接到相应的FogBugz bugID.如果只需要这些,就可以在这里停止.

    That's it. TortoiseSVN will now add a link to the corresponding FogBugz bugID when you commit. If that's all you want, you can stop here.

    为此,我们需要设置钩子脚本.基本上,每次提交后都会调用批处理文件,然后依次调用VBS脚本,它将脚本提交到FogBugz.在这种情况下,VBS脚本实际上可以正常工作,因此我们不需要对其进行修改.

    For this to work we need to set up the hook scripts. Basically the batch file is called after each commit, and this in turn calls the VBS script which does the submission to FogBugz. The VBS script actually works fine in this situation so we don't need to modify it.

    问题在于该批处理文件被编写为用作 server 钩子,但是我们需要一个 client 钩子.

    The problem is that the batch file is written to work as a server hook, but we need a client hook.

    SVN服务器使用以下参数调用提交后挂钩:

    SVN server calls the post-commit hook with these parameters:

    <repository-path> <revision>
    

    TortoiseSVN使用以下参数调用提交后挂钩:

    TortoiseSVN calls the post-commit hook with these parameters:

    <affected-files> <depth> <messagefile> <revision> <error> <working-copy-path>
    

    这就是为什么它不起作用的原因-参数错误.我们需要修改批处理文件,以便将正确的参数传递给VBS脚本.

    So that's why it doesn't work - the parameters are wrong. We need to amend the batch file so it passes the correct parameters to the VBS script.

    您会注意到TSVN没有通过存储库路径,这是一个问题,但是在以下情况下它确实可以工作:

    You'll notice that TSVN doesn't pass the repository path, which is a problem, but it does work in the following circumstances:

    • 存储库名称和工作副本名称相同
    • 您在工作副本的根目录而不是子文件夹中进行提交.

    我将查看是否可以解决此问题,如果可以,我会在这里发帖.

    I'm going to see if I can fix this problem and will post back here if I do.

    这是我修改后的批处理文件,它可以正常工作(请原谅多余的注释...)

    Here's my amended batch file which does work (please excuse the excessive comments...)

    您需要设置挂钩目录和存储库目录以匹配您的设置.

    You'll need to set the hook and repository directories to match your setup.

    rem @echo off
    rem   SubVersion -> FogBugz post-commit hook file
    rem   Put this into the Hooks directory in your subversion repository
    rem   along with the logBugDataSVN.vbs file
    
    rem   TSVN calls this with args <PATH> <DEPTH> <MESSAGEFILE> <REVISION> <ERROR> <CWD>
    rem   The ones we're interested in are <REVISION> and <CWD> which are %4 and %6
    
    rem   YOU NEED TO EDIT THE LINE WHICH SETS RepoRoot TO POINT AT THE DIRECTORY
    rem   THAT CONTAINS YOUR REPOSITORIES AND ALSO YOU MUST SET THE HOOKS DIRECTORY
    
    setlocal
    
    rem   debugging
    rem echo %1 %2 %3 %4 %5 %6 > c:\temp\test.txt
    
    rem   Set Hooks directory location (no trailing slash)
    set HooksDir=\\myserver\svn\hooks
    
    rem   Set Repo Root location (ie. the directory containing all the repos)
    rem   (no trailing slash)
    set RepoRoot=\\myserver\svn
    
    rem   Build full repo location
    set Repo=%RepoRoot%\%~n6
    
    rem   debugging
    rem echo %Repo% >> c:\temp\test.txt
    
    rem   Grab the last two digits of the revision number
    rem   and append them to the log of svn changes
    rem   to avoid simultaneous commit scenarios causing overwrites
    set ChangeFileSuffix=%~4
    set LogSvnChangeFile=svn%ChangeFileSuffix:~-2,2%.txt
    
    set LogBugDataScript=logBugDataSVN.vbs
    set ScriptCommand=cscript
    
    rem   Could remove the need for svnlook on the client since TSVN
    rem   provides as parameters the info we need to call the script.
    rem   However, it's in a slightly different format than the script is expecting
    rem   for parsing, therefore we would have to amend the script too, so I won't bother.
    rem @echo on
    svnlook changed -r %4 %Repo% > %temp%\%LogSvnChangeFile%
    svnlook log -r %4 %Repo% | %ScriptCommand% %HooksDir%\%LogBugDataScript% %4 %temp%\%LogSvnChangeFile% %~n6
    
    del %temp%\%LogSvnChangeFile%
    endlocal
    

    我将假设存储库位于\\myserver\svn\,工作副本都位于`C:\ Projects \

    I'm going to assume the repositories are at \\myserver\svn\ and working copies are all under `C:\Projects\

    1. 进入您的FogBugz帐户,然后单击其他"->配置源代码控制集成"

    1. Go into your FogBugz account and click Extras -> Configure Source Control Integration

    下载用于Subversion的VBScript文件(不必理会批处理文件)

    Download the VBScript file for Subversion (don't bother with the batch file)

    创建一个文件夹来存储挂钩脚本.我将其放置在与存储库相同的文件夹中.例如. \\myserver\svn\hooks\

    Create a folder to store the hook scripts. I put it in the same folder as my repositories. eg. \\myserver\svn\hooks\

    重命名VBscript以删除文件名末尾的.safe.

    Rename VBscript to remove the .safe at the end of the filename.

    将我的批处理文件版本保存到您的hooks目录中,作为post-commit-tsvn.bat

    Save my version of the batch file in your hooks directory, as post-commit-tsvn.bat

    右键单击任何目录.

    选择"TortoiseSVN>设置"(在上一步的右键菜单中)

    Select "TortoiseSVN > Settings" (in the right click menu from the last step)

    选择挂钩脚本"

    单击添加"并按如下所示设置属性:

    Click "Add" and set the properties as follows:

    • 挂钩类型:提交后挂钩

    • Hook Type: Post-Commit Hook

    工作副本路径:C:\Projects(或所有项目的根目录).

    Working Copy Path: C:\Projects (or whatever your root directory for all of your projects is.)

    要执行的命令行:\\myserver\svn\hooks\post-commit-tsvn.bat(这需要指向您在步骤3中放置钩子目录的位置)

    Command Line To Execute: \\myserver\svn\hooks\post-commit-tsvn.bat (this needs to point to wherever you put your hooks directory in step 3)

    勾选等待脚本完成"

    单击确定"两次.

    下次提交并输入Bugid时,它将提交给FogBugz.链接不起作用,但至少存在修订信息,您可以在TortoiseSVN中手动查找日志.

    Next time you commit and enter a Bugid, it will be submitted to FogBugz. The links won't work but at least the revision info is there and you can manually look up the log in TortoiseSVN.

    注意:您会注意到存储库根目录已硬编码到批处理文件中.结果,如果您从不具有相同根目录的存储库中签出(例如,一个在本地驱动器上,一个在网络上),那么您将需要在TSVN中的Hook Scripts下使用2个批处理文件和2个相应的条目.设置.这样做的方法是拥有2个单独的工作副本树-每个存储库根目录一棵.

    NOTE: You'll notice that the repository root is hard-coded into the batch file. As a result, if you check out from repositories that don't have the same root (eg. one on local drive and one on network) then you'll need to use 2 batch files and 2 corresponding entries under Hook Scripts in the TSVN settings. The way to do this would be to have 2 separate Working Copy trees - one for each repository root.

    Errr,我还没有做到这一点:-)

    Errr, I haven't done this :-)

    通过阅读WebSVN文档,似乎WebSVN实际上并未与SVN服务器集成,它的行为就像任何其他SVN客户端一样,但是具有Web界面.从理论上讲,它应该可以与基于文件的存储库一起正常工作.我还没有尝试过.

    From reading the WebSVN docs, it seems that WebSVN doesn't actually integrate with the SVN server, it just behaves like any other SVN client but presents a web interface. In theory then it should work fine with a file-based repository. I haven't tried it though.

    这篇关于在没有URL/Subversion后端的情况下将Fogbugz与TortoiseSVN集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 08-15 13:14