How To Create Patch For Stendhal: Difference between revisions

Content deleted Content added
imported>Kymara
Tortoise CVS
imported>Hendrik Brummermann
No edit summary
 
(80 intermediate revisions by 3 users not shown)
Line 1:
{{Navigation for Stendhal Top|Developing}}
{{Navigation for Stendhal Developers}}
 
 
<div style="border:10px solid #A00; padding: 2em">
'''Warning''': This page is outdated. We prefer Pull Requests on Codeberg or GitHub.
</div>
 
 
 
If you want to contribute to Stendhal with some changes to some files you can ease us integrating the changes if you create a patch file for your changes.
 
Line 4 ⟶ 14:
 
There are a few neat ways to make a patch file. We are going to describe here how to create a patch on each of this ways.
 
Once you have tested your patch please add it to our [http://sourceforge.net/tracker/?func=add&group_id=1111&atid=301111 sourceforge tracker].
 
As a prerequisite for both ways of creating a patch is a checked out version of Stendhal.
 
== Common best practices for patchespull requests and CVSpatches ==
* Keep your local copy of Stendhal regularly up to date with CVS HeadGit to avoid merge conflicts
* Discuss your plans with the team at {{irc-arianne}}
* Update your local copy before you test your changes locally
* Test your changes locally
* Open the patch file in a text editor and review it, to check it is really adding the changes you mean to add, and nothing else
{{TODO|list more best practice tips}}
 
== EclipseCreating waypatches ==
=== Eclipse ===
WhenIf you use [[Stendhal on Eclipse|Eclipse]] it is quite easy for you to create a patch against current head version in CVS. Before creating a patch you should update your local copy of the sources to the most recent version. You do this by right clicking on the project folder, and in the context menu which appears select ''Team'' and ''Update''. If files have been edited outside Eclipse, please right click on the project folder and click ''Refresh''.
 
After updating your Stendhal project you can start the patch creation by right clicking on the project. In the appearing context menu which appears select ''Team'' and ''Create Patch'' in the team submenu. This will open up a wizard for creating patches.
 
[[File:How-to-create-patch-01.PNG]]
Line 32 ⟶ 44:
After clicking on finish you will not get any further notice but the patch file should now be available in the previously selected folder.
 
=== Command line way ===
In your stendhal code development folder type:
 
Line 40 ⟶ 52:
 
cvs add newfile
 
or for a binary file like an image or tmx map file
 
cvs add -kb newbinaryfile
 
{{TODO|Verify this is possible with anon access ? }}
Line 52 ⟶ 68:
cvs diff -uNawbB > descriptive_name.patch
 
=== Tortoise CVS way ===
[http://www.tortoisecvs.org/ Tortoise CVS] is a Windows GUI front end for CVS. So, if you are using Tortoise CVS already, you can create a patch. Right-click on the stendhal code development folder in CVS, and choose '''CVS -> Make patch ...''' from the context menu.
 
== Reading patch files ==
Eek, what is all this text below?
 
The patch file contains a section for each file that should be changed. That section starts with lines that contain the file name and path of first the old (---) and then the new (+++) version and some additional information.
 
Then follow sets of changes. They start with a line that contains, enclosed in @@, the line or line range from,no-of-lines in the file before (with a -) and after (with a +) the changes. After that come the lines from the file. Lines starting with a - are deleted, lines starting with a + are added. Each line modified by the patch is surrounded with 3 lines of context before and after. A line change needs both an addition + and a deletion -.
 
After all the changes related to one file, comes the next file definitions (--- and +++) and the next file's changes, with the @@ and + or - as above.
 
<source lang="java">
Index: src/games/stendhal/client/gui/j2d/entity/RPEntity2DView.java
===================================================================
RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/client/gui/j2d/entity/RPEntity2DView.java,v
retrieving revision 1.40
diff -u -r1.40 RPEntity2DView.java
--- src/games/stendhal/client/gui/j2d/entity/RPEntity2DView.java 24 Oct 2009 22:11:04 -0000 1.40
+++ src/games/stendhal/client/gui/j2d/entity/RPEntity2DView.java 20 Nov 2009 23:50:47 -0000
@@ -19,6 +19,7 @@
import games.stendhal.client.sprite.AnimatedSprite;
import games.stendhal.client.sprite.Sprite;
import games.stendhal.client.sprite.SpriteStore;
+import games.stendhal.common.Debug;
import games.stendhal.common.Direction;
import java.awt.Color;
@@ -602,8 +603,7 @@
drawIdeas(g2d, x, y, height);
}
- // Enable this to debug entity view area
- if (false) {
+ if (Debug.SHOW_ENTITY_VIEW_AREA) {
g2d.setColor(Color.cyan);
g2d.drawRect(x, y, width, height);
}
Index: src/games/stendhal/common/Debug.java
===================================================================
RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/common/Debug.java,v
retrieving revision 1.79
diff -u -r1.79 Debug.java
--- src/games/stendhal/common/Debug.java 12 Nov 2009 21:48:35 -0000 1.79
+++ src/games/stendhal/common/Debug.java 20 Nov 2009 23:50:47 -0000
@@ -39,5 +39,8 @@
*/
boolean SHOW_LIST_SIZES = false;
-
+ /**
+ * it shows entity's view area
+ */
+ boolean SHOW_ENTITY_VIEW_AREA = false;
}
</source>