Post-Apocalyptic RPG forums

Development => Programming => Topic started by: Vaporice on October 19, 2009, 09:29:21 PM



Title: General patches thread
Post by: Vaporice on October 19, 2009, 09:29:21 PM
As there's no thread for this yet, barra asked me to make this thread.
The thread is meant for those little fixes that don't really deserve a separate thread but need to be reviewed.
Just post the trac ticket here =)

my fix (a little bug in the outline renderer):
http://parpg-trac.cvsdude.com/parpg/ticket/123
A minor thing (that's what the threads for  ;D) but it was a good practice to get to know the parpg source better

(for those that don't know me, i'm making a introduction post now)


Title: Re: General patches thread
Post by: mvBarracuda on October 19, 2009, 10:43:17 PM
Thanks for the patch vaporice :-) And welcome on the forums, nice to have you around. As soon as some programmer finds the time, the patch will be reviewed and added to SVN after that if no issues show up. Enjoy the stay!


Title: Re: General patches thread
Post by: maximinus on January 29, 2010, 03:09:52 PM
No activity on this thread since October 20th. I understand the intention of the thread but it's clearly not being used, so I'm un-stickying it (is that a verb?).

If you disagree, post below..


Title: Re: General patches thread
Post by: shevegen on January 29, 2010, 03:37:01 PM
Noone wants to send patches!!!


Title: Re: General patches thread
Post by: przemo_li on March 16, 2010, 08:48:00 AM
How to send useful path ??

here is what i got with "svn diff"

Quote
[przemo@null scripts]$ cat diff_path
Index: dialogue.py
===================================================================
--- dialogue.py (revision 527)
+++ dialogue.py (working copy)
@@ -130,7 +130,6 @@
                 if end_cb:
                     end_cb()
                 logging.debug("Reached the end")
-                return
 
     def continueWithResponse(self, section_name, response):
         """Reply to a response in a section and continue executing dialogue

removed unnecessary return.


Title: Re: General patches thread
Post by: b0rland on March 16, 2010, 09:26:16 AM
That patch does work if you cut it after "=========="
It'd be more useful with paths relative to project root: you can do that by running svn diff in project root instead of under 'scripts' directory.

For more then one file, however, patches generated by svn diff aren't very good: patch program complains and you need to cut parts of them to prevent that. Typical way of generating patches is having a separate 'clean' checkout in a different directory and run:
Code:
diff -urN parpg  parpg_clean > my_fix.patch

You will probably want to review that file afterwards and make sure it only has the changes you wanted to submit.


Title: Re: General patches thread
Post by: przemo_li on March 16, 2010, 09:32:10 AM
so you mean

cd parpg_clean && svn up && cd ../parpg && svn up && cd .. && diff -urN parpg  parpg_clean > my_fix.patch && vi my_fix.patch

??


Title: Re: General patches thread
Post by: b0rland on March 16, 2010, 10:11:14 AM
right. Sorry, forgot to mention what 'parpg' and 'parpg_clean' are :).  As might or might not be obvious from the names, parpg_clean is supposed to be clean and fresh svn checkout and parpg is your working copy with your changes and also updated to a fresh svn version.


Title: Re: General patches thread
Post by: b0rland on March 16, 2010, 10:41:21 AM
Re this specific patch, why do you thing 'return' isn't needed? Note that it's under while True, so unless this return is called, it will iterate over and over, even if EndException is triggered.


Title: Re: General patches thread
Post by: przemo_li on March 18, 2010, 11:21:12 AM
I got it. Sorry.


used my command and got too big diff patch :( :
Code:
[przemo@null Development]$ wc -l my_fix.patch
424749 my_fix.patch


Title: Re: General patches thread
Post by: mvBarracuda on March 19, 2010, 02:23:04 PM
The whole patch submission process is described in detail at the wiki. Check out this articles:
http://wiki.parpg.net/How_to_Submit_a_Patch
http://wiki.parpg.net/Patches


Title: Re: General patches thread
Post by: przemo_li on March 19, 2010, 09:43:21 PM
Hmm, I've found that UT for console requires whole game loaded. So far someone just initialized console class with None wich cause error and ut fails. IMHO the best is to comment out all tests. So they want be counted in tests, but code will wait for better times. Hand test should be enough.

So here is patch that comment out whole tests/test_console.py
 revision is: "Updated to revision 535."

Code:
[przemo@null parpg]$ svn diff
Index: tests/test_console.py
===================================================================
--- tests/test_console.py       (revision 535)
+++ tests/test_console.py       (working copy)
@@ -16,33 +16,35 @@
 #   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
 
 
-import unittest
-from scripts.console import Console
+#import unittest
+#from scripts.console import Console
 
-class test_console(unittest.TestCase):
-    def setUp(self):
-        self.con=Console(None)
-        self.invalString="Invalid command, enter help for more information"
-        pass
-    
-    def tearDown(self):
-        pass
-
-    def testConsoleCommandHelp(self):
-        """ Test the help console command """
-        
-        self.assertNotEqual(self.con.handleHelp("help"),self.invalString)
-        self.assertNotEqual(self.con.handleConsoleCommand("help"),
-                            self.invalString)
-
-    def testConsoleCommandPython(self):
-        """ Test the python console command """
-        self.assertEqual(self.con.handlePython("python 1+1"),"2")
-        self.assertEqual(self.con.handleConsoleCommand("python 1+1"),"2")
-      
-    def testInvalid(self):
-        """Test an invalid console command """
-
-        self.assertEqual(self.con.handleConsoleCommand("invalid"),
-                         self.invalString)
-
+#class test_console(unittest.TestCase):
+#    def setUp(self):
+# FIXME        # Below wont work as it would require running whole game
+# all test must be done ingame till any better idea
+#      self.con=Console(None)
+#        self.invalString="Invalid command, enter help for more information"
+#        pass
+#    
+#    def tearDown(self):
+#        pass
+#
+#    def testConsoleCommandHelp(self):
+#        """ Test the help console command """
+#        
+#        self.assertNotEqual(self.con.handleHelp("help"),self.invalString)
+#        self.assertNotEqual(self.con.handleConsoleCommand("help"),
+#                            self.invalString)
+#
+#    def testConsoleCommandPython(self):
+#        """ Test the python console command """
+#        self.assertEqual(self.con.handlePython("python 1+1"),"2")
+#        self.assertEqual(self.con.handleConsoleCommand("python 1+1"),"2")
+#      
+#    def testInvalid(self):
+#        """Test an invalid console command """
+#
+#        self.assertEqual(self.con.handleConsoleCommand("invalid"),
+#                         self.invalString)
+#
[przemo@null parpg]$ svn diff >> no_console_tests.patch

PS why tests/test_* ? "from tests import test_console" looks ugly :|, and test are auto detected so name makes no difference.