[py-svn] r32265 - in py/dist/py: path/svn path/svn/testing test/rsession

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Sep 13 16:34:22 CEST 2006


Author: cfbolz
Date: Wed Sep 13 16:34:20 2006
New Revision: 32265

Modified:
   py/dist/py/path/svn/testing/test_wccommand.py
   py/dist/py/path/svn/wccommand.py
   py/dist/py/test/rsession/rsession.py
Log:
make info method not crash on empty repositories


Modified: py/dist/py/path/svn/testing/test_wccommand.py
==============================================================================
--- py/dist/py/path/svn/testing/test_wccommand.py	(original)
+++ py/dist/py/path/svn/testing/test_wccommand.py	Wed Sep 13 16:34:20 2006
@@ -2,6 +2,8 @@
 from py.__.path.svn.testing.svntestbase import CommonSvnTests, getrepowc
 from py.__.path.svn.wccommand import InfoSvnWCCommand
 from py.__.path.svn.wccommand import parse_wcinfotime
+from py.__.path.svn import svncommon
+
 try:
     svnversion = py.path.local.sysfind('svn')
 except py.error.ENOENT:
@@ -265,3 +267,17 @@
         assert info.url == 'http://codespeak.net/svn/py/dist/py/path/svn/wccommand.py'
         assert info.rev == 28124
         assert info.time == 1149021926000000.0
+
+class TestWCSvnCommandPathEmptyRepo(object):
+
+    def setup_class(cls):
+        repo = py.test.ensuretemp("emptyrepo")
+        wcdir = py.test.ensuretemp("emptywc")
+        py.process.cmdexec('svnadmin create "%s"' %
+                svncommon._escape_helper(repo))
+        wc = py.path.svnwc(wcdir)
+        wc.checkout(url='file://%s' % repo)
+        cls.wc = wc
+
+    def test_info(self):
+        self.wc.info().rev = 0

Modified: py/dist/py/path/svn/wccommand.py
==============================================================================
--- py/dist/py/path/svn/wccommand.py	(original)
+++ py/dist/py/path/svn/wccommand.py	Wed Sep 13 16:34:20 2006
@@ -520,7 +520,9 @@
         self.size = self.path.size()
         if 'lastchangedrev' in d:
             self.created_rev = int(d['lastchangedrev'])
+        if 'lastchangedauthor' in d:
             self.last_author = d['lastchangedauthor']
+        if 'lastchangeddate' in d:
             self.mtime = parse_wcinfotime(d['lastchangeddate'])
             self.time = self.mtime * 1000000
 

Modified: py/dist/py/test/rsession/rsession.py
==============================================================================
--- py/dist/py/test/rsession/rsession.py	(original)
+++ py/dist/py/test/rsession/rsession.py	Wed Sep 13 16:34:20 2006
@@ -307,8 +307,8 @@
 
     def getpkgdir(path):
         path = py.path.local(path)
-        pkgpath = path.pypkgpath() 
-        assert pkgpath is not None, (
-               "no pkgdir for global scoped file %s" %(path,))
-        return pkgpath 
-    getpkgdir = staticmethod(getpkgdir) 
+        pkgpath = path.pypkgpath()
+        if pkgpath is None:
+            pkgpath = path
+        return pkgpath
+    getpkgdir = staticmethod(getpkgdir)



More information about the pytest-commit mailing list