aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2020-07-25Suggestion: Try applying a change to the file (WIP)Teddy Wing
Not working yet, but the idea is to get the file referenced by the suggestion and apply the suggested change directly to it. Here, we read the original file, and write its contents to the new file, replacing the lines modified by the suggestion with the suggested change. Currently doesn't work because you can't pass file instances to `fs::rename`, only paths. I'd like to try a slightly different system so I can keep the original file's creation date. With the current system, it would be overwritten by the new temporary file created to store the change.
2020-07-25lib.rs: Skip network testTeddy Wing
2020-07-24Read a blob from a repositoryTeddy Wing
Work out the code required to get a file blob's contents from a Git repository using the 'git2' crate. We'll be using this to get the original file for patching.
2020-07-24Add test stub for patch functionalityTeddy Wing
Will test patching a file using the generated suggestion patch.
2020-07-22Try modifying diff hunk with 'unidiff'Teddy Wing
Testing out 'unidiff' to build the patch. Trying to see if it will adjust the line numbers automatically when the patch is modified. Doesn't look like it. Seems like it has a nice interface, though. Still having trouble applying the patch due to complaints of patch format errors.
2020-07-22Suggestion.suggestion: Handle "\r\n"Teddy Wing
Update the regex matcher to allow both LF line endings and CRLF.
2020-07-21suggestion_patch_generates_patch: Add attributionTeddy Wing
Describe the source of the test data.
2020-07-21Suggesstion: Implement `patch` to generate a patch for the suggestionTeddy Wing
Still working on it, but have an initial draft working. There's no file name in the diff hunk, so I'm assuming I'm going to have to add one later. Build a patch from the diff hunk and suggestion comment. 1. Remove `-` lines 2. Change `+` lines to ` ` 3. Change last line to `-` 4. Append suggestion to the diff with a `+` prefix
2020-07-19Extract diff hunk and comment body from GitHub responseTeddy Wing
Split the `Suggestion` struct into a new `Client` struct for the GitHub request, and `Suggestion` for the required response data.
2020-07-19Fetch a GitHub PR suggestion commentTeddy Wing
Add a `Suggestion` struct to represent a GitHub PR suggestion comment. Use the 'github-rs' library to fetch a given comment from the site by its ID. Converted the 'github-rs' error into a string because its `github_rs::client::Error` type is private, so I can't define an error variant source with that type.
2020-07-13Initialise a new Rust v1.44.1 projectTeddy Wing
Initialised with: $ cargo init --bin