1

我希望能够使用 Windows 命令行下载与 Code Collaborator 中的更改列表相关的补丁。如果您单击外部差异,这些是您在 Web GUI 中获得的文件。它们具有扩展名“.collabdiff”,实际上是压缩档案,其中包含每个文件的“之前”和“之后”文件夹。我打算使用这些来使用 Subversion Merge 进行三向合并。

我的第一种方法是使用 Code Collaborator 命令行实用程序,例如

ccollab admin wget externaldiff?reviewid=%2^&changelistid=%3 > %OutputFile%

不幸的是,这似乎只需要 ASCII 数据,因为屏幕上出现了很多文本,并且有很多哔哔声。

我的下一个方法是直接使用外部链接。为此,我重用了我在网上找到的一段 PowerShell 脚本:

::
:: GetCodeCollaboratorChangeList.cmd
::
:: Downloads a review change list from Code Collaborator.
::
:: %1   Code Collaborator Server
:: %2   Review Id
:: %3   Change List Id
::
@ECHO ON

    SETLOCAL

    SET OutputFile=%~dp0ChangeList_%2_%3.collabdiff

    ECHO Creating %OutputFile%.

    :: Sadly, the following line expects that ASCII text should be returned, but the URL returns binary text.
    :: It beeps a little, and not much text gets redirected.
    ::ccollab admin wget externaldiff?reviewid=%2^&changelistid=%3 > %OutputFile%

    :: So instead, we have to use our own download code.
    SET URL="%1/externaldiff?reviewid=%2&changelistid=%3"

    SET S=""
    SET S="%S:~1,-1% $webclient = New-Object System.Net.WebClient;"
    SET S="%S:~1,-1% $webclient.DownloadFile('%URL:~1,-1%','%OutputFile%');"

    PowerShell.exe -ExecutionPolicy unrestricted -noprofile -command "& {%S:~1,-1%}"

EXIT /B

可悲的是,我收到以下错误:

Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (500) Internal Server Error."
At line:1 char:74
+ & { $webclient = New-Object System.Net.WebClient; $webclient.DownloadFile <<<< ('http://server1/externaldiff?reviewid=8077&changelistid=52915','C:\Documents and Settings\Administrator\Desktop\ChangeList_8077_52915.collabdiff');}
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

获取 URL 并将其粘贴到浏览器中(而不是单击链接)时,您会看到以下页面:

HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

java.lang.NullPointerException
    com.smartbear.ccollab.datamodel.DataModelUtils.getDefaultPrevVersionToDiff(DataModelUtils.java:379)
    com.smartbear.ccollab.datamodel.DataModelUtils.getDefaultPrevVersionToDiff(DataModelUtils.java:351)
    com.smartbear.ccollab.rpc.ExternalDiffConfigServlet.getVersionsToDiff(ExternalDiffConfigServlet.java:373)
    com.smartbear.ccollab.rpc.ExternalDiffConfigServlet.service(ExternalDiffConfigServlet.java:140)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    com.smartbear.ccollab.AuthTicketFilter.doFilter(AuthTicketFilter.java:74)
    com.smartbear.ccollab.CollabCleanupFilter.doFilter(CollabCleanupFilter.java:30)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20-patched logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.20-patched

我尝试修改代码以分别修改 QueryString 和 BaseAddress 属性,并调用.DownloadFile('/externaldiff, ...)但错误没有变化。

关于如何下载这些文件有什么建议吗?

4

1 回答 1

0

试试:
ccollab admin wget 'diff?context=10&reviewid=REVIEWID'
例如:
ccollab admin wget 'diff?context=10&reviewid=12345'

于 2014-11-21T08:06:51.847 回答