Programming Reference:Patches
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.
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.
- With TortoiseSVN, right-click the BCI2000 folder to which you want to apply the patch, and choose TortoiseSVN->Apply Patch... Then, choose the downloaded patch file.
- When using a Unix-based operating system, cd to the BCI2000 top level directory. Then, execute
patch < /path/to/downloaded/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
Windows (TortoiseSVN)
- 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.
Command-line SVN
- 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.