What are the general steps that I need to follow to generate a local copy of the source (before it actually gets merged) as it would be if a pull request gets merged?
An example situation: suppose, User A forks repo_X (owned by User X) to repo_X_A, does a change to sources src/brittle.c and libs/brittle-lib.c, and raises a github pull request for the repo repo_X. Now, assuming am user X who would want to run some checks on the source before I merge it to repo_X, I want to generate the copies of these sources brittle.c and brittle-lib.c with changes (without actually merging the changes to repo_X). Can I do it programmatically?
Through GitHub APIs (esp the pull req API), I can get the list of modified files for a given pull req. Now, what do I do to generate a local copy of the sources as they would be after applying the changes in pull request?
If am right, I should be getting the diffs in .patch format (through API again), obtain the source from the repo/branch/tag, patch the diff onto it. Need pointers on how to achieve this part of applying the changes in a python program? Using python bindings for *nix patch utility?
Is this indeed the right way, or is there an easier/better/elegant way? Am trying with python-requests and github APIs.