FogBugz 6 - Multiple Repositories - Multiple Source Control Systems - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com 2012-02-09T09:05:34Z http://fogbugz.stackexchange.com/feeds/question/346 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://fogbugz.stackexchange.com/questions/346/fogbugz-6-multiple-repositories-multiple-source-control-systems FogBugz 6 - Multiple Repositories - Multiple Source Control Systems FogBugz KB 2009-10-15T20:09:51Z 2010-07-12T15:25:04Z <p>Does FogBugz 6 support integration with multiple source control systems?</p> http://fogbugz.stackexchange.com/questions/346/fogbugz-6-multiple-repositories-multiple-source-control-systems/347#347 Answer by FogBugz KB for FogBugz 6 - Multiple Repositories - Multiple Source Control Systems FogBugz KB 2009-10-15T20:15:41Z 2010-07-12T15:25:04Z <h2>FogBugz 7</h2> <p>FogBugz 7 <a href="http://www.fogcreek.com/FogBugz/docs/70/topics/advanced/Sourcecontrolintegration.html" rel="nofollow">supports multiple repositories</a>, just create them in <code>Admin -&gt; Source Control</code> and download the scripts from there. FogBugz identifies the repos by ixRepository, not <code>sRepo</code>.</p> <h2>FogBugz 6</h2> <p>FogBugz has a very open and configurable source control integration system.&nbsp; Many users might have multiple repositories or multiple systems and they want to know how to set it up so FogBugz can link to all of them.</p> <p>FogBugz 6.1 and higher supports multiple repositories within a single source control system. This will even work for FogBugz On Demand users, unlike the other suggestion below. FogBugz 6.1 added the sRepo field to the CVS table for FogBugz which can be used in the Source Control URLs. To do so, add the sRepo argument to the trigger script for your source control system (on the line where the URL with sFile and sPrev and sNew is constructed). To refer to the sRepo value in the Source Control URL, use ^REPO. For instance, if you were using Mercurial and entered the fully-qualified repository URL as sRepo, then the corresponding Source Control URL for logs would be: ^REPO/log/^R2/^FILE</p> <p>If you are running FogBugz on your Server, or are using multiple source control systems, another way to do this is to have a director script gather your FogBugz requests when you click on links and figure out where to send the user to, based on the repository of that checked in file. This method will work on FogBugz 4 and higher.</p> <ol> <li>Download this script (<a href="http://www.fogcreek.com/fogbugz/kb/howto/repo.asp.zip" rel="nofollow">windows</a>, <a href="http://www.fogcreek.com/fogbugz/kb/howto/repo.php.zip" rel="nofollow">unix</a>, <a href="http://www.fogcreek.com/fogbugz/kb/howto/repo.php.zip" rel="nofollow">mac</a>)</li> <li>Modify the rgRepos array at the top of the file<br />Add the name of the repository and the two urls, first the log url then the diff url.&nbsp; These urls should be in the same format that FogBugz would have taken them in.&nbsp; (see your Site page in FogBugz for examples)</li> <li>Then replace the Source Control urls in FogBugz (on the Site page) with<br />LOG: repo.asp?LOG=1&amp;FILE=^FILE&amp;R1=^R1&amp;R2=^R2<br />DIFF: repo.asp?DIFF=1&amp;FILE=^FILE&amp;R1=^R1&amp;R2=^R2</li> <li>Have your hook scripts pass the repository in prepended to the FILE parameter<br />At the bottom of the hook scripts you will see a request to CVSSUBMIT and you should see something that says "sFile=" &amp; sFile which you would just change to "sFile=repo1:" &amp; sFile for repo1's hook script.</li></ol> <p>Example for two Source Control Systems</p> <ul> <li>I have a subversion repository and a VSS repository.</li> <li>My subversion repository has a WebSVN interface at&nbsp;<br /><a href="http://company.com/subversion/" rel="nofollow">http://company.com/subversion/</a></li> <li>My VSS repository can use FogBugz as its Web interface.</li> <li>First I follow all the instructions for connecting to Subversion <a href="http://www.fogcreek.com/FogBugz/docs/70/topics/advanced/SourceControlIntegration.html" rel="nofollow">here</a>&nbsp;and verify that it works.</li> <li>Then I follow all the instructions for connecting to VSS <a href="http://www.fogcreek.com/FogBugz/docs/70/topics/advanced/SourceControlIntegration.html" rel="nofollow">here</a>&nbsp;and verify that it works.</li> <li>I download the above script and edit the rgRepos array so it says the following using the URLs on the Site page from FogBugz:<br /><br/><code>Dim rgRepos: rgRepos = Array( "SVN", _<br /></code><code>"http://company.com/subversion/filedetails.php?rep=0&amp;path=^FILE&amp;rev=0&amp;sc=1", _<br /></code><code>"http://company.com/subversion/diff.php?rep=0&amp;path=^FILE&amp;rev=^R2&amp;sc=1", _<br />"VSS", _<br />"http://your.fogbugz.server/default.asp?pg=pgShowVSSFileHist&amp;FILE=^FILE", _<br />"http://your.fogbugz.server/default.asp?pg=pgShowVSSFileDiff&amp;FILE=^FILE&amp;R1=^R1&amp;R2=^R2" )</code><br/></li><br/> <li>I change the source controls in FogBugz:<br />LOG: repo.asp?LOG=1&amp;FILE=^FILE&amp;R1=^R1&amp;R2=^R2<br />DIFF: repo.asp?DIFF=1&amp;FILE=^FILE&amp;R1=^R1&amp;R2=^R2</li> <li>I modify logBugDataSVN.vbs to include SVN: as a prefix to the filename<br /><code>&nbsp;&nbsp;&nbsp;http.Open "GET", BUGZ_URL_FINAL &amp; CVSSUBMIT &amp; _<br />&nbsp;&nbsp;&nbsp;&nbsp;"?ixBug=" &amp; ixBug &amp; "&amp;sFile=" &amp; sFile &amp; "&amp;sPrev=" &amp; sPrev &amp; "&amp;sNew=" &amp; sNew &amp; sTrialClause, False<br /></code>becomes<code><br />&nbsp;&nbsp;&nbsp;http.Open "GET", BUGZ_URL_FINAL &amp; CVSSUBMIT &amp; _<br />&nbsp;&nbsp;&nbsp;&nbsp;"?ixBug=" &amp; ixBug &amp; "&amp;sFile=<strong>SVN:</strong>" &amp; sFile &amp; "&amp;sPrev=" &amp; sPrev &amp; "&amp;sNew=" &amp; sNew &amp; sTrialClause, False<br /></code></li> <li>I modify vss_fbupdate.wsf to include VSS: as a prefix to the filename<br/><br/> <code>&nbsp;&nbsp;http.Open "GET", BUGZ_URL_FINAL &amp; CVSSUBMIT &amp; _<br />&nbsp;&nbsp;&nbsp;"?ixBug=" &amp; sBug &amp; "&amp;sFile=" &amp; DBFolder &amp; ":$/" &amp; Mid(ItemName, 2) &amp; "&amp;sPrev=" &amp; sPrevVersion &amp; "&amp;sNew=" &amp; ItemVersion &amp; sTrialClause, False<br /></code><br />becomes<code><br /><br/>&nbsp;&nbsp;http.Open "GET", BUGZ_URL_FINAL &amp; CVSSUBMIT &amp; _<br />&nbsp;&nbsp;&nbsp;"?ixBug=" &amp; sBug &amp; "&amp;sFile=<strong>VSS:</strong>" &amp; DBFolder &amp; ":$/" &amp; Mid(ItemName, 2) &amp; "&amp;sPrev=" &amp; sPrevVersion &amp; "&amp;sNew=" &amp; ItemVersion &amp; sTrialClause, False</code><br /></li></ul> http://fogbugz.stackexchange.com/questions/346/fogbugz-6-multiple-repositories-multiple-source-control-systems/2919#2919 Answer by nickd for FogBugz 6 - Multiple Repositories - Multiple Source Control Systems nickd 2010-04-30T14:56:12Z 2010-04-30T14:56:12Z <p>What I found differs from above a little. This is with FogBugz 6 with Subversion on Ubuntu 9.10 through Apache with WebSVN 2.2.1</p> <p>The <code>logBugDataSVN.pl</code> distributed with 6.1 doesn't need to be changed because I use the repository parameter in the URLs, but I did have to add <code>#! /bin/sh</code> to the top of the supplied <code>post-commit</code> script. I also made the invocation of <code>svnlook</code> include an explicit path because there is no environment when invoked through the web server.</p> <p>I added the repository name to the two urls</p> <pre><code>repo.asp?LOG=1&amp;FILE=^FILE&amp;R1=^R1&amp;R2=^R2&amp;REPO=^REPO repo.asp?DIFF=1&amp;FILE=^FILE&amp;R1=^R1&amp;R2=^R2&amp;REPO=^REPO </code></pre> <p>and changed the URLs in <code>repo.asp</code> like this:</p> <pre><code>Dim rgRepos: rgRepos = Array( _ "repos", _ "http://myserver/websvn/filedetails.php?repname=^REPO&amp;path=/^FILE&amp;rev=^R2", _ "http://myserver/websvn/diff.php?repname=^REPO&amp;path=/^FILE&amp;rev=^R2", _ ) </code></pre> <p>to work with my version of WebSVN. I also made <code>sRepo</code> default to the repository from the DB.</p> <pre><code>Dim sRepo: sRepo = Request("REPO") </code></pre> <p>The only thing left then was to ensue that the repository made it into the redirect URL</p> <pre><code>If Request("LOG") = "1" Then Response.Redirect Replace(Replace(Replace(Replace(_ rgRepos(i+1),"^FILE", sFile),_ "^R1", Request("R1")),_ "^R2", Request("R2")),_ "^REPO", sRepo) Else Response.Redirect Replace(Replace(Replace(Replace(_ rgRepos(i+2), "^FILE", sFile),_ "^R1", Request("R1")),_ "^R2", Request("R2")),_ "^REPO", sRepo) End If </code></pre>