从代码协作者下载.collabdiff文件
我希望能够使用Windows命令行在代码协作器中下载与更改列表关联的修补程序。 这些是您在Web GUI中获得的文件,如果您单击External Diff。 他们有一个扩展名“.collabdiff”,实际上是压缩存档,包含每个文件“之前”和“之后”的文件夹。 我打算使用这些来使用Subversion Merge进行三向合并。
我的第一个方法是使用代码协作者命令行实用程序,例如
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 SettingsAdministratorDesktopChangeList_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, ...)
但错误没有任何更改。
有没有关于如何下载这些文件的建议?
尝试:
ccollab admin wget'diff?context = 10&reviewid = REVIEWID'
例如:
ccollab admin wget'diff?context = 10&reviewid = 12345'