aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/svn.py
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2006-10-20 15:47:57 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2006-10-20 15:47:57 +0000
commitdad24be156b4bce751224cda8609bb0229c00c39 (patch)
tree885915def67c3b70f241e5d52d85bddd1ed2a5e6 /RepSys/svn.py
parent5b7a9a57193f550a4fed126f485adc36540e527c (diff)
downloadmgarepo-dad24be156b4bce751224cda8609bb0229c00c39.tar
mgarepo-dad24be156b4bce751224cda8609bb0229c00c39.tar.gz
mgarepo-dad24be156b4bce751224cda8609bb0229c00c39.tar.bz2
mgarepo-dad24be156b4bce751224cda8609bb0229c00c39.tar.xz
mgarepo-dad24be156b4bce751224cda8609bb0229c00c39.zip
- SVN.log now contains information about the changed paths
Diffstat (limited to 'RepSys/svn.py')
-rw-r--r--RepSys/svn.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/RepSys/svn.py b/RepSys/svn.py
index e83b072..bc565b0 100644
--- a/RepSys/svn.py
+++ b/RepSys/svn.py
@@ -11,6 +11,7 @@ class SVNLogEntry:
self.revision = revision
self.author = author
self.date = date
+ self.changed = []
self.lines = []
def __cmp__(self, other):
@@ -248,7 +249,7 @@ class SVN:
return None
def log(self, url, start=None, end=0, limit=None, **kwargs):
- cmd = ["log", url]
+ cmd = ["log", "-v", url]
if start is not None or end != 0:
if start is not None and type(start) is not type(0):
try:
@@ -273,17 +274,32 @@ class SVN:
return None
revheader = re.compile("^r(?P<revision>[0-9]+) \| (?P<author>[^\|]+) \| (?P<date>[^\|]+) \| (?P<lines>[0-9]+) (?:line|lines)$")
+ changedpat = re.compile(r"^\s+(?P<action>[^\s]+) (?P<path>[^\s]+)(?: \([^\s]+ (?P<from_path>[^:]+)(?:\:(?P<from_rev>[0-9]+))?\))?$")
logseparator = "-"*72
linesleft = 0
entry = None
log = []
- emptyline = 0
+ appendchanged = 0
+ changedheader = 0
for line in output.splitlines():
- if emptyline:
- emptyline = 0
- continue
line = line.rstrip()
- if linesleft == 0:
+ if not line:
+ appendchanged = 0
+ if changedheader:
+ appendchanged = 1
+ changedheader = 0
+ elif appendchanged:
+ m = changedpat.match(line)
+ if m:
+ changed = m.groupdict().copy()
+ from_rev = changed.get("from_rev")
+ if from_rev is not None:
+ try:
+ changed["from_rev"] = int(from_rev)
+ except (ValueError, TypeError):
+ raise Error, "invalid revision number in svn log"
+ entry.changed.append(changed)
+ elif linesleft == 0:
if line != logseparator:
m = revheader.match(line)
if m:
@@ -294,7 +310,7 @@ class SVN:
entry = SVNLogEntry(int(m.group("revision")),
m.group("author"), timetuple)
log.append(entry)
- emptyline = 1
+ changedheader = 1
else:
entry.lines.append(line)
linesleft -= 1