Commits

holger krekel committed 5afa5d2

try to fix failures related to subversion 1.7.

Comments (0)

Files changed (6)

 
 - fix issue7: source.getstatementrange() now raises proper error
   if no valid statement can be found
+- fix issue8: fix code and tests of svnurl/svnwc to work on subversion 1.7 - 
+  note that path.status(updates=1) will not properly work svn-17's status 
+  --xml output is broken.
 
 Changes between 1.4.4 and 1.4.5
 ==================================================
 
 (c) Holger Krekel and others, 2004-2010
 """
-__version__ = '1.4.6.dev1'
+__version__ = '1.4.6.dev3'
 
 from py import _apipkg
 

py/_path/svnurl.py

                 e = sys.exc_info()[1]
                 if e.err.find('non-existent in that revision') != -1:
                     raise py.error.ENOENT(self, e.err)
+                elif e.err.find("E200009:") != -1:
+                    raise py.error.ENOENT(self, e.err)
                 elif e.err.find('File not found') != -1:
                     raise py.error.ENOENT(self, e.err)
                 elif e.err.find('not part of a repository')!=-1:

py/_path/svnwc.py

         except py.process.cmdexec.Error:
             e = sys.exc_info()[1]
             strerr = e.err.lower()
-            if strerr.find('file not found') != -1:
+            if strerr.find('not found') != -1:
+                raise py.error.ENOENT(self)
+            elif strerr.find("E200009:") != -1:
                 raise py.error.ENOENT(self)
             if (strerr.find('file exists') != -1 or
                 strerr.find('file already exists') != -1 or
+                strerr.find('w150002:') != -1 or
                 strerr.find("can't create directory") != -1):
                 raise py.error.EEXIST(self)
             raise
         out = self._authsvn('lock').strip()
         if not out:
             # warning or error, raise exception
-            raise Exception(out[4:])
+            raise ValueError("unknown error in svn lock command")
 
     def unlock(self):
         """ unset a previously set lock """
                 modrev = '?'
                 author = '?'
                 date = ''
+            elif itemstatus == "replaced":
+                pass
             else:
                 #print entryel.toxml()
                 commitel = entryel.getElementsByTagName('commit')[0]
             raise  ValueError("Not a versioned resource")
             #raise ValueError, "Not a versioned resource %r" % path
         self.kind = d['nodekind'] == 'directory' and 'dir' or d['nodekind']
-        self.rev = int(d['revision'])
+        try:
+            self.rev = int(d['revision'])
+        except KeyError:
+            self.rev = None
+
         self.path = py.path.local(d['path'])
         self.size = self.path.size()
         if 'lastchangedrev' in d:
         name='py',
         description='library with cross-python path, ini-parsing, io, code, log facilities',
         long_description = open('README.txt').read(),
-        version='1.4.6.dev1',
+        version='1.4.6.dev3',
         url='http://pylib.org',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

testing/path/test_svnwc.py

 import py
 import os, sys
+import pytest
 from py._path.svnwc import InfoSvnWCCommand, XMLWCStatus, parse_wcinfotime
 from py._path import svnwc as svncommon
 from svntestbase import CommonSvnTests
         assert r.join('sampledir/otherfile').basename in [item.basename
                                                     for item in s.unchanged]
 
+    @pytest.mark.xfail(reason="svn-1.7 has buggy 'status --xml' output")
     def test_status_update(self, path1):
         r = path1
         try:
             s = r.status(updates=1, rec=1)
             # Comparing just the file names, because paths are unpredictable
             # on Windows. (long vs. 8.3 paths)
+            py.std.pprint.pprint(s.allpath())
             assert r.join('anotherfile').basename in [item.basename for
                                                     item in s.update_available]
             #assert len(s.update_available) == 1
         p = path1.join("samplefile")
         p.remove()
         p.ensure(dir=0)
-        p.add()
         try:
             s = path1.status()
             assert p.basename in [item.basename for item in s.replaced]
         otherrepo, otherrepourl, otherwc = repowc2
         d = path1.ensure('sampledir', dir=1)
         try:
-            d.remove()
-            d.add()
             d.update()
             d.propset('svn:externals', 'otherwc %s' % (otherwc.url,))
             d.update()
     def test_status_deleted(self, path1):
         d = path1.ensure('sampledir', dir=1)
         d.remove()
-        d.add()
+        d.ensure(dir=1)
         path1.commit()
         d.ensure('deletefile', dir=0)
         d.commit()
         somefile = root.join('somefile')
         somefile.ensure(file=True)
         # not yet added to repo
-        py.test.raises(py.process.cmdexec.Error, 'somefile.lock()')
+        py.test.raises((py.process.cmdexec.Error, ValueError), 'somefile.lock()')
         somefile.write('foo')
         somefile.commit('test')
         assert somefile.check(versioned=True)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.