[py-svn] r28145 - py/dist/py/path/svn
guido at codespeak.net
guido at codespeak.net
Sat Jun 3 12:40:59 CEST 2006
Author: guido
Date: Sat Jun 3 12:40:58 2006
New Revision: 28145
Modified:
py/dist/py/path/svn/urlcommand.py
Log:
Fixed support for parsing Subversion's 1.3 ls output which has different field
sizes from 1.2.
Modified: py/dist/py/path/svn/urlcommand.py
==============================================================================
--- py/dist/py/path/svn/urlcommand.py (original)
+++ py/dist/py/path/svn/urlcommand.py Sat Jun 3 12:40:58 2006
@@ -220,27 +220,31 @@
#01234567890123456789012345678901234567890123467
# 2256 hpk 165 Nov 24 17:55 __init__.py
+# XXX spotted by Guido, SVN 1.3.0 has different aligning, breaks the code!!!
+# 1312 johnny 1627 May 05 14:32 test_decorators.py
#
class InfoSvnCommand:
- #lspattern = re.compile(r'(\D*)(\d*)\s*(\w*)\s*(
+ # the '0?' part in the middle is an indication of whether the resource is
+ # locked, see 'svn help ls'
+ lspattern = re.compile(
+ r'^ *(?P<rev>\d+) +(?P<author>\w+) +(0? *(?P<size>\d+))? '
+ '*(?P<date>\w+ +\d{2} +[\d:]+) +(?P<file>.*)$')
def __init__(self, line):
# this is a typical line from 'svn ls http://...'
#_ 1127 jum 0 Jul 13 15:28 branch/
- l = [line[:7], line[7:16], line[16:27], line[27:40], line[41:]]
- l = map(str.lstrip, l)
-
- self._name = l.pop()
+ match = self.lspattern.match(line)
+ data = match.groupdict()
+ self._name = data['file']
if self._name[-1] == '/':
self._name = self._name[:-1]
self.kind = 'dir'
else:
self.kind = 'file'
#self.has_props = l.pop(0) == 'P'
- self.created_rev = int(l[0])
- self.last_author = l[1]
- self.size = l[2] and int(l[2]) or 0
- datestr = l[3]
- self.mtime = parse_time_with_missing_year(datestr)
+ self.created_rev = data['rev']
+ self.last_author = data['author']
+ self.size = data['size'] and int(data['size']) or 0
+ self.mtime = parse_time_with_missing_year(data['date'])
self.time = self.mtime * 1000000
def __eq__(self, other):
More information about the pytest-commit
mailing list