[py-svn] r32271 - in py/dist/py/path/svn: . testing
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed Sep 13 18:09:53 CEST 2006
Author: cfbolz
Date: Wed Sep 13 18:09:50 2006
New Revision: 32271
Modified:
py/dist/py/path/svn/testing/test_wccommand.py
py/dist/py/path/svn/wccommand.py
Log:
improve the blame method: actually use a read on the url to get at the real
content to avoid parsing problems.
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 18:09:50 2006
@@ -114,6 +114,12 @@
for l1, l2 in zip(p.readlines(), [l[2] for l in lines]):
assert l1 == l2
assert [l[1] for l in lines] == ['hpk'] * len(lines)
+ p = self.root.join('samplefile')
+ lines = p.blame()
+ assert sum([l[0] for l in lines]) == len(lines)
+ for l1, l2 in zip(p.readlines(), [l[2] for l in lines]):
+ assert l1 == l2
+ assert [l[1] for l in lines] == ['hpk'] * len(lines)
def test_join_abs(self):
s = str(self.root.localpath)
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 18:09:50 2006
@@ -294,15 +294,14 @@
def blame(self):
out = self._svn('blame')
result = []
- lines = out.splitlines()
- for i, line in enumerate(lines):
- m = rex_blame.match(line)
+ blamelines = out.splitlines()
+ reallines = py.path.svnurl(self.url).readlines()
+ for i, (blameline, line) in enumerate(zip(blamelines, reallines)):
+ m = rex_blame.match(blameline)
if not m:
raise ValueError("output line %r of svn blame does not match "
"expected format" % (line, ))
- rev, name, line = m.groups()
- if i < len(lines) - 1:
- line = line + "\n"
+ rev, name, _ = m.groups()
result.append((int(rev), name, line))
return result
More information about the pytest-commit
mailing list