Download .collabdiff file from Code Collaborator

I want to be able to download patches associated with change lists in Code Collaborator using the Windows command line. These are the files you get in the web GUI if you click on External Diff. They have an extension ".collabdiff", and are in fact zipped archives containing folders for "before" and "after" of each file. I intend to use these to do a three-way merge using Subversion Merge.

My first approach was to use the Code Collaborator command line utility, eg

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

Unfortunately, it seems that this expects ASCII data only, because a lot of text appears on the screen, and there is a lot of beeping.

My next approach was to use the external link directly. To do this, I have reused a snippet of PowerShell script I found on the web:

::
:: 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

Sadly, I get the following error:

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

When taking the URL and pasting it in the browser (rather than clicking on the link), you get the following page:

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

I have tried modifying the code to modify QueryString and BaseAddress properties separately, and called .DownloadFile('/externaldiff, ...) but there was no change in the error.

Are there any suggestions as to how I can download these files?


Try:
ccollab admin wget 'diff?context=10&reviewid=REVIEWID'
Eg:
ccollab admin wget 'diff?context=10&reviewid=12345'

链接地址: http://www.djcxy.com/p/64850.html

上一篇: 显示更新的文件以回应评论

下一篇: 从代码协作者下载.collabdiff文件