[py-svn] r23262 - in py/dist/py/path/svn: . testing

hpk at codespeak.net hpk at codespeak.net
Sun Feb 12 23:21:54 CET 2006


Author: hpk
Date: Sun Feb 12 23:21:51 2006
New Revision: 23262

Modified:
   py/dist/py/path/svn/testing/test_test_repo.py
   py/dist/py/path/svn/wccommand.py
Log:
commit() returns None if there was nothing to commit
and the revision number of the commit otherwise.



Modified: py/dist/py/path/svn/testing/test_test_repo.py
==============================================================================
--- py/dist/py/path/svn/testing/test_test_repo.py	(original)
+++ py/dist/py/path/svn/testing/test_test_repo.py	Sun Feb 12 23:21:51 2006
@@ -10,10 +10,13 @@
         self.wc.checkout(self.repo)
         assert len(self.wc.listdir()) == 0
 
-    def test_checkin(self):
+    def test_commit(self):
         p = self.wc.join("a_file")
         p.write("test file")
         p.add()
         rev = self.wc.commit("some test")
         assert p.info().rev == 1
         assert rev == 1
+        rev = self.wc.commit()
+        assert rev is None
+        

Modified: py/dist/py/path/svn/wccommand.py
==============================================================================
--- py/dist/py/path/svn/wccommand.py	(original)
+++ py/dist/py/path/svn/wccommand.py	Sun Feb 12 23:21:51 2006
@@ -278,13 +278,17 @@
 
     rex_commit = re.compile(r'.*Committed revision (\d+)\.$', re.DOTALL)
     def commit(self, message=""): 
+        """commit() returns None if there was nothing to commit
+           and the revision number of the commit otherwise.
+        """
         out = self._svn('commit -m %r' % message)
         try:
             del cache.info[self]
         except KeyError:
             pass
-        m = self.rex_commit.match(out)
-        return int(m.group(1))
+        if out: 
+            m = self.rex_commit.match(out)
+            return int(m.group(1))
 
     def propset(self, propname, value, *args):
         d = py.path.local.mkdtemp() 



More information about the pytest-commit mailing list