[py-dev] svnwc.auth patchlet

Jasper Spaans jspaans at thehealthagency.com
Tue Apr 1 17:23:22 CEST 2008


Hi py-dev,

I'm currently exploring the py.path module, and am trying to get it  
svnwc to work with svn locking. The following would be nice to have,  
as the current version doesn't provide a method to find out if a file  
has been locked:

--- path/svn/wccommand.py~      2008-04-01 17:13:09.000000000 +0200
+++ path/svn/wccommand.py       2008-04-01 17:13:09.000000000 +0200
@@ -644,7 +644,10 @@
          if 'lastchangeddate' in d:
              self.mtime = parse_wcinfotime(d['lastchangeddate'])
              self.time = self.mtime * 1000000
-
+        if 'lockowner' in d:
+            self.lock = { 'owner': d['lockowner'],
+                          'mtime': parse_wcinfotime(d['lockcreated']) }
+
      def __eq__(self, other):
          return self.__dict__ == other.__dict__


Proof of concept of the output:
 >>> import py
 >>> x = py.path.svnwc('/tmp/svnstoragetest-TMUVVD/root.xml')
 >>> dir(x.info())
['__doc__', '__eq__', '__init__', '__module__', 'created_rev', 'kind',  
'last_author', 'lock', 'mtime', 'path', 'rev', 'size', 'time', 'url']
 >>> x.info().lock
{'owner': 'foo', 'mtime': 1207067232}


Cheers,
-- 
Jasper Spaans
http://www.thehealthagency.com/




More information about the Pytest-dev mailing list