Difference between revisions of "Patches"

From BRL-CAD
(How to create, edit or apply a patch)
(How to create a patch)
 
(2 intermediate revisions by 2 users not shown)
Line 22: Line 22:
 
== How to create a patch ==
 
== How to create a patch ==
  
In order to submit a patch it is important to have the latest version of BRL-CAD. After you have done that, you get into the brlcad  directory and run
+
In order to submit a patch it is important to have the latest version of BRL-CAD from a Subversion repository checkout. Any changes you make to files can be automatically captured in a standard file format called a '''''patch''''' file using 'svn' commands.  Running this command will tell you what files you have modified, added, or removed:
 
<pre>
 
<pre>
svn diff > ~/first.patch
+
svn status
 
</pre>
 
</pre>
This will create the patch file in your user's home. The patch is in text format
+
 
and you can read it to make sure it contains what was intended.
+
If you added any new files, they will show up as lines starting with '?'.  To include new files in the patch, run:
 +
<pre>
 +
svn add myfile.txt
 +
</pre>
 +
 
 +
If you have removed any files, they will show up as lines starting with '!'.  You can include that change in your patch by running:
 +
<pre>
 +
svn remove myfile.txt
 +
</pre>
 +
 
 +
 
 +
After you have added and/or removed files, the next most important step is to generate a patch file (aka a diff file).  Redirecting 'svn diff' output will create this file automatically:
 +
<pre>
 +
svn diff > mychanges.patch
 +
</pre>
 +
 
 +
The last step is to read the patch file you created to make sure it 1) includes all of the changes you intended and 2) does not include any changes you did not intend. A patch file is a simple text format, so you can review it using any text editor or file viewing tools (e.g., 'more mychanges.patch').  Read it to make sure it contains what was intended and only what was intended.
  
 
== How to Submit a patch ==
 
== How to Submit a patch ==
Line 40: Line 56:
 
and, if necessary, what isn't working.
 
and, if necessary, what isn't working.
  
Be sure to check out the extensive [[Documentation]] and [[Main_Page]] for tutorials and [[Contributor Quickies]] for ways to get involved!
+
Be sure to check out the extensive [[Documentation]] and [[Main_Page]] for tutorials and [[Deuces]] for ways to get involved!

Latest revision as of 22:57, 26 March 2019

How to create, edit or apply a patch[edit]

Prerequisites[edit]

To handle and apply patches, BRL-CAD uses Subversion.

You will need to install Subversion (Often abbreviated as svn).

If you're on a Debian/Ubuntu system you can get it by running:

sudo apt-get install subversion

You can obtain the latest version of BRL-CAD by running:

svn checkout https://svn.code.sf.net/p/brlcad/code/brlcad/trunk brlcad

If you are in the folder where the "brlcad" folder is and you run that command, svn will only download updated/modified files.

How to create a patch[edit]

In order to submit a patch it is important to have the latest version of BRL-CAD from a Subversion repository checkout. Any changes you make to files can be automatically captured in a standard file format called a patch file using 'svn' commands. Running this command will tell you what files you have modified, added, or removed:

svn status

If you added any new files, they will show up as lines starting with '?'. To include new files in the patch, run:

svn add myfile.txt

If you have removed any files, they will show up as lines starting with '!'. You can include that change in your patch by running:

svn remove myfile.txt


After you have added and/or removed files, the next most important step is to generate a patch file (aka a diff file). Redirecting 'svn diff' output will create this file automatically:

svn diff > mychanges.patch

The last step is to read the patch file you created to make sure it 1) includes all of the changes you intended and 2) does not include any changes you did not intend. A patch file is a simple text format, so you can review it using any text editor or file viewing tools (e.g., 'more mychanges.patch'). Read it to make sure it contains what was intended and only what was intended.

How to Submit a patch[edit]

To submit a patch to the BRL-CAD tracker you must first create a sourceforge account. Of course, if you have one already, you don't need to create another.

Now, you can submit your patch on the BRL-CAD tracker by clicking "Create Ticket".

You should use the description field to explain what you did there and, if necessary, what isn't working.

Be sure to check out the extensive Documentation and Main_Page for tutorials and Deuces for ways to get involved!