Patches contain modifications to the BCI2000 source code that may affect a few files, or many. Typically, such modifications are made in order to add some configuration option to a BCI2000 module, or you make a small modification to an analysis tool in order to make it easier to use. Patches are shared in form of text files that contain the differences between the unchanged source code, and your modified source code.
Reading a Patch
A patch is a plain text file that describes original lines in source files (prepended with -), and their replacements by the patch (prepended with +). So you may read a patch in order to learn how someone modified BCI2000, even if you don't intend to apply it. Typically, web browsers will display a patch as text when you click its "download" link.
Applying a Patch
Applying a patch will apply the modifications recorded in the patch file, to your version of the source code. To apply a patch, follow these steps:
- Download the patch file to your BCI2000 directory. Typically, you can do this by right-clicking its "Download" link, and choose "Save file..." from the context menu.
- With TortoiseSVN, right-click the patch file, and choose "TortoiseSVN->Apply Patch..." from the context menu. TortoiseMerge appears, with a floating window on top. Right-click the first entry in the floating window, and choose "Patch all" from the context menu.
- When using a Unix-based operating system, cd to the BCI2000 top level directory. Then, execute
patch < ThePatchFile.patch.
- When application of the patch fails, open the patch file with a text editor, and determine the SVN revision against which the patch was created. Then, do a new checkout of that revision, and apply the patch there.
Creating a Patch
- If you added new files to the BCI2000 source code, make sure to add them to SVN by right-clicking and choosing "TortoiseSVN->Add..." from the context menu.
- Right-click your BCI2000 folder and choose "TortoiseSVN->Create Patch..." from the context menu.
- In the list of modified files, deselect those that contain changes unrelated to your modification, and click OK.
- In the File Save dialog, save the patch to any location, and provide a name that gives some idea about the modification.
- Make sure to call
svn addon all files that you added to the source code.
- CD to the BCI2000 directory, and execute
svn diff > MyModification.patch.
Uploading a Patch
No special permission is required to upload a patch. Everyone with a BCI2000 user account may log into the wiki, edit the patches page, and upload a patch. In order to upload a patch, please follow these steps:
- Make sure you are logged into the wiki. Use the "log in" link at the top right of the wiki page in order to log in. When prompted for a user account and password, use your BCI2000 user account.
- Click the "Upload file" link from the wiki toolbox to the left. In the upload page, choose your patch file, and put a few lines of description into the "Summary" field. Then, click "upload".
- The file's wiki page appears. You may edit your summary here.
- On top of the wiki page, there is a link to the actual file on the server. Copy that link into the clipboard.
- Edit the Contributions:Patches wiki page to contain the summary, and links to your contributed patch. Paste the link to the actual file from the clipboard.