How to apply a patch file to your local copy of ReactOS's Subversion repository with the command line tools. REQUIREMENTS * a Subversion working copy of ReactOS (trunk) * a patch file * ReactOS Build Environment (RosBE) 2.1.1 * Subversion version 1.7 or higher installed by RosBE * familiarity with the Windows Command Prompt NOTE: Patching a working copy whose source files affected by the patch have already been modified is beyond the scope of these instructions. PROCEDURE To find out which version of Subversion that RosBE is using, type svn --version --quiet at the RosBE command prompt. Press RETURN. NOTE: Be careful to type svn here, not ssvn. RosBE 2.1.1 uses Subversion 1.8.5. Obtain the patch file. Download the patch file to the root directory of the drive which holds the working copy of ReactOS. In these instructions example.patch represents the patch file and target_file1.c and target_file2.c represent the files that example.patch modifies. The directory drivers\input\device represent the directory in which the files to be modified are located in the example ReactOS working copy. In RosBE, change to the directory containing your working copy of ReactOS. Verify that this is the correct directory by entering the command: ssvn status (Be sure to type ssvn here.) If Subversion responds with "is not a working copy" the directory does not contain your working copy of the ReactOS trunk code. Switch to the correct directory. The patch command of Subversion has an option for testing the patch operation without making any changes to the local repository. It is the --dry-run option. Enter: svn patch \example.patch --dry-run (Be sure to type svn here and for all remaining Subversion commands in these instructions.) Subversion should respond: U drivers\input\device\target_file1.c U drivers\input\device\target_file2.c The letter U on the left side of the screen means the file named on that line will be updated. The letters that could appear are: A Added D Deleted U Updated C Conflict G Merged (with local uncommitted changes) The file example.patch is intended to update (modify) files that are already in the local repository. Therefore the letter U should be the only one on the left side of the screen. To see all the options available to the patch command enter: svn help patch If everything is in order, patch the repository. Enter: svn patch \example.patch Subversion should respond just as it did with the --dry-run option but this time Subversion made the changes that it reports. U drivers\input\device\target_file1.c U drivers\input\device\target_file2.c Verify that these files have been modified by the patch. Enter svn status If all went well, Subversion will respond: M drivers\input\device\target_file1.c M drivers\input\device\target_file2.c The M at the far left means that the file has been modified. If other files in the working copy have been modified or added they will be included in this list. The patch is now installed in your Subversion working copy. Compile ReactOS and try it out with the patch. PROCEDURE TO REMOVE THE PATCH There are two ways to remove the patch. The patch can be reversed in order to return the working copy to its state before the patch was made or the patch can be removed and the patched files in the working copy reverted to match the source repository. TO REVERSE (UNDO) THE PATCH If no changes have been made to the working copy since the patch was made and you want to reverse the patch, enter: svn patch \example.patch --reverse-diff Subversion responds G drivers\input\device\target_file1.c G drivers\input\device\target_file1.c The G indicates that the changes (the reverse of the original patch) were merged cleanly into the target files. To verify that the patch's modifications were removed, enter: svn status The files that had been patched should no longer be in the list. TO REVERT THE PATCHED FILES TO THEIR UNMODIFIED STATE: Another way to reverse (undo) the patch is to revert the patched files to their unmodified state. This will restore the patched files to the way they were when freshly downloaded into the local repository. NOTE: The svn revert command will not revert changes that have already been committed. To do this, enter: svn revert drivers\input\device\target_file1.c then enter: svn revert drivers\input\device\target_file1.c Test that these files in your local working copy are no longer considered by Subversion to be modified. Enter: svn status The files patched earlier should no longer be identified as modified by Subversion.