Forum Discussion
Is there an answer to this?
What version of Collaborator are you using?
There should be a download icon (folder) next to the [After] and the [Before] combo boxes, and on the reviews I tested it downloads the correct version of the file.
This goes for binary source files, pdf, xlsx etc as well.
Running on 9.2.9200
- straussc10 years agoNew Contributor
There is a before and after download icon when I'm looking at individual files, but I want to be able to download all of before files at once, and all of the after files at once. Sometimes we have rather large code reviews, and I don't want to have to download each file individually.
- francois_roux10 years agoOccasional Contributor
makes sense.
Not sure if that functionality is there. However, you should be able to develop an app to get them yourself. The files are saved with the GUID as name, so you just need to figure out which revision uses which GUIDs. Should be straightforward looking at the DB schema and I've done some other scripts which archived the files for certain reviews (which effectively moved all files for the review).
Then your app can copy the selected files and rename them to what they need to be. Might take a day or two to develop the app, but it certainly should be possible.
Still, it would be a good feature to add (if it's not already there)
- MJackson10 years agoStaff
One way to do this, if I understand correctly what your goal is, is via calls to the JSON api (provided you are running a recent 9.x build). The ReviewService.getVersions method will retrieve all of the information about review materials added to a review over time (e.g. commit date to chronologically place them in time, path information, md5, and so on for each file).
From this point you have two options, depending on whether or not you have access somehow directly to the content cache (this is [collab install point]/tomcat/collaborator-content-cache by default):
1) If you do, the file's MD5 hash is used to determine where the file is stored on the filesystem; the first six characters of it in hexadecimal representation are used in couplets to form three subdirectories, and in the final subdirectory the original file content is stored in a file whose name is the MD5 hash. e.g. a text file consisting of "hello world<nl>" has an md5 sum of 6f5902ac237024bdd0c176cb93063dc4, and thus would be found in the 6f/59/02/ subdirectory of the content cache with filename 6f5902ac237024bdd0c176cb93063dc4. Path information can be reconstructed from the API result as mentioned above.
2) If you do not, you can use the CLI client's wget command to hit an internal URL that will retrieve the original file content for a given version ID: admin wget "/data/server?versionid=12345" (this id is in the API result as well). You will have to pipe the output of that to a target file (i.e. by default it is simply displayed on stdout).
An example of the API call and (truncated, as the review was very large) response:
request:
[{"command" : "SessionService.authenticate",
"args" : {"login" : "mjackson","ticket" : "eb51e4aa9d8aa59fffa467473586e1cd"}
},
{"command": "ReviewService.getVersions",
"args": { "reviewId": 12345 }
}]response snippet:
[{ "result" : { "changelists" : [ { "id" : 54177, "scmToken" : "GIT", "commitInfo" : { "scmId" : "", "author" : "(none)", "hostGuid" : "da7d80fe910b0580ba87bcdc2db0cc36", "local" : true, "comment" : "Local changes", "date" : "2015-06-26T13:36:39-05:00" }, "versions" : [ { "id" : 143445, "scmPath" : "ccollab-modulename/src/main/java/com/smartbear/ccollab/a/long/path/to/a/Filename.java", "scmVersionName" : "472f6f87f0fa30d0dd2d945881f6f7bd767e6e5e", "md5" : "8b4ccdd185ef5bb50b10af1f339090ac", "localPath" : "/home/aries/Workspace/SmartBear/collab/another/really/long/path/to/a/Filename.java", "action" : "ADDED", "source" : "LOCAL" } ] }
So in the above example the version id 143445 or file MD5 472f6f87f0fa30d0dd2d945881f6f7bd767e6e5e could be used as described above to get at the original file content from Collaborator.
A third approach, though involving external tools, is that if your files were/are stored in an SCM, would be to get the SCM version identifier information from the API (the scmVersionName attribute shown above) and directly pull the files from your SCM instead of Collaborator.
We are also working on some new features that may be relevant to this question, but of course I shouldn't talk about that too much until they're ready for public consumption. :)
Related Content
Recent Discussions
- 2 months ago