svn - 同步 Subversion 和 Harvest SCM 存储库?

标签 svn scripting integration harvest-scm

如果使用 Subversion 跨团队同步工作并使用 Harvest 作为企业记录系统,您将如何集成 Subversion 和 CA Harvest SCM?

我正在研究的一种方法是创建一个脚本,将 SVN 标签加载到 Harvest 中,但我很好奇是否有其他人以前做过类似的事情,或者有更好的方法来解决这个问题。

最佳答案

我最终创建了一个脚本来将 Subversion 同步到 Harvest。我们不必以相反的方式进行同步,但更改脚本来实现这一点并不困难。您可以在此处查看脚本 -> http://developerdad.com/2011/03/28/synchronize-subversion-to-ca-allfusion-harvest/

我们现在正在 Jenkins(以前称为 Hudson)CI 服务器中使用此脚本,因此在运行每个生产版本时都会创建一个新的 Harvest 包(由 Jenkins 设置的 %JOB_NAME% 变量命名)。

更新

网站上上下下,所以脚本如下:

@echo off

REM ###########################################################################
REM #
REM # Script file to move changes from Subversion to Harvest
REM #
REM ###########################################################################

if "%1" == "" goto usage

setlocal

set PROJECT_STAGE=-b "" -en "" -st ""
set VIEW=-vp ""
set CREDENTIALS=-usr "" -pw ""
set SUBVERSION_REPO=svn:////trunk/

REM Clean up any build artifacts if present
call ant clean

REM Create Harvest package
hcp %1 %PROJECT_STAGE% %CREDENTIALS%

REM Delete the checked-out Subversion code
REM Note: You will need to remove everything (except this file of course), so more rmdir or del statements may be required below
rmdir /S /Q project

REM Check out the files in Harvest to modify
hco * %PROJECT_STAGE% %CREDENTIALS% %VIEW% -p "%1" -pn "Check Out Files for Update" -up -r -s * -op pc -cp %CD%

REM Delete the checked-out Harvest code
REM Note: You will need to remove everything (except this file of course), so more rmdir or del statements may be required below
rmdir /S /Q project

REM Replace with the latest code from Subversion repository
svn co %SUBVERSION_REPO% .

REM Delete the .svn directories
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *svn') do (
  rd /s /q "%%i"
)

REM What are the updates for Harvest?  Check them into Harvest
hci * %PROJECT_STAGE% %CREDENTIALS% %VIEW% -p "%1" -pn "Check In Modified Files" -s * -ur -de "Added in Subversion" -if ne -op pc -cp %CD%

REM Remove the log files from Harvest
REM Note: You may need to change or remove this statement depending on whether you want the Harvest logs checked in
hdv *.log %PROJECT_STAGE% %CREDENTIALS% %VIEW% -pn "Delete Versions"

REM What removals from Harvest do we need to process? (What files were deleted in Subversion?)
hsv %PROJECT_STAGE% %CREDENTIALS% %VIEW% -p "%1" -it r -s "*"

REM This will not work if the file path has spaces in it.  You can use %%j %%k ... in the -vp switch for one space in your project name (For example, if you have 2 spaces, it should be -vp %%j %%k %%l)
for /f "tokens=1-5 skip=3" %%i in (hsv.log) do (
    if not "%%i"=="hsv" (
        hci "%%i" %PROJECT_STAGE% %CREDENTIALS% -vp "%%j" -p "%1" -pn "Check In Modified Files" -ro -cp %CD%
        hri "%%i" %PROJECT_STAGE% %CREDENTIALS% -vp "%%j" -p "%1"
    )
)

REM remove read-only attribute from all files
attrib -r -h * /s

REM delete all harvest.sig files
del /f /s /q harvest.sig

endlocal

goto end

:usage

echo USAGE:
echo -----------------------------------------------------------------------------
echo "svn2harvest {package_name}"
echo -----------------------------------------------------------------------------

:end

关于svn - 同步 Subversion 和 Harvest SCM 存储库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/965379/

相关文章:

svn - VisualSVN 服务器上的 Tortoise 客户端

c# - Visual Studios 2015 中的 "Restore NuGet Packages"未执行任何操作

java - 将 Java 与 .NET 集成?

php - 简单的sagepay支付php

git - 智能 : Force read-only when on master branch

SVN:将主干的特定修订版合并到分支中

perl - 按位异或 Bash 中的字符串

php - 如何将可能的 URI 与 PHP 中的其他内容分开?

msbuild 脚本中的日期格式?

jquery - Pikachoose/Fancybox 集成 - 灯箱上的导航箭头