| Summary: | [github] Compare not exposed via CommitService | ||
|---|---|---|---|
| Product: | [Technology] EGit | Reporter: | Taylor Leese <tleese22> |
| Component: | Core | Assignee: | Kevin Sawicki <kevin> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | tleese22 |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Taylor Leese
Proposed fix pushed to: http://egit.eclipse.org/r/#change,4917 This had been fixed in master in commit 728081f97dd6a64cba68794101a18fac983f8e7e CommitService.compare is the new method. There is a 1.2.1-SNAPSHOT version with this fix available here: https://oss.sonatype.org/index.html#nexus-search;quick~org.eclipse.egit.github.core Awesome. Thanks for the quick turnaround. I will give it a try today. After getting back a RepositoryCommitCompare and calling getFile, what is the best way to get the raw file specified by CommitFile.getRawUrl. I'm not clear on how to do this with the SDK or if it's possible? I tried making an OAuth request to the raw url, but I've been getting 406's so not sure if I'm doing something wrong or if it's not possible? Basically, I want to get the RepositoryCommitCompare and get the raw files for all changed files. You can use a DataService and call: DataService.getBlob(IRepositoryIdProvider repository, String sha) with the SHA-1 returned from CommitFile.getSha The contents of the Blob object returned will be base64 encoded and you can call: EncodingUtils.fromBase64 to get the raw content as a byte array Actually, that was exactly what I tried initially, but it seems to give back metadata regarding the file rather than the actual raw file. For example, I get something back like this (update is the commit message): tree ab700454826a8c36b8fa9443d4edd2d28b263a7f parent 04b6fe63be718cea4ffa2b6af98e3cb7714714a3 author Taylor Leese <taylor@stackmob.com> 1325209880 -0800 committer Taylor Leese <taylor@stackmob.com> 1325209880 -0800 update Are you sure you used the sha from the CommitFile and not the RepsitoryCommit? Yes, I'm using the CommitFile. Code is something like this (scala):
val compare = commitService.compare(repo, c, repoCommit.getSha)
val files = compare.getFiles
val rawList = files map { f => (f.getFilename, dataService.getBlob(repo, f.getSha)) }
Is the repository you are using public and could you provide the URL for the the blob in question? The repository is actually private (stackmob org). Blob URL: https://github.com/stackmob/github-integration-testing/blob/fa7c1b1f0e5d8167d3bdace3d9d2a94499bac79b/README |