我希望能够使用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, ...)
,但错误没有变化。
有关于如何下载这些文件的建议吗?
答案 0 :(得分:0)
尝试:
ccollab admin wget'diff?context = 10&amp; reviewid = REVIEWID'
例如:
ccollab admin wget'diff?context = 10&amp; reviewid = 12345'