From 9e9f1d722ede232b88969a4e7e574c109a5f9447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Tue, 31 May 2016 06:39:48 +0200 Subject: simplify initialization of ElementTree --- MgaRepo/git.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'MgaRepo') diff --git a/MgaRepo/git.py b/MgaRepo/git.py index 49b13db..28cc9c2 100644 --- a/MgaRepo/git.py +++ b/MgaRepo/git.py @@ -33,11 +33,8 @@ class GIT(VCS): retval, result = execcmd(*cmd) if retval: return retval - parser = ElementTree.XMLParser() - result = "".join(result.split("\n")) - parser.feed(result) - log = parser.close() - logentries = log.getiterator("logentry") + xmllog = ElementTree.fromstring(result) + logentries = xmllog.getiterator("logentry") revisions = [] topurl = dirname(url) trunk = basename(url) @@ -114,11 +111,8 @@ class GIT(VCS): retval, result = execcmd(*cmd) if retval: return retval - parser = ElementTree.XMLParser() - result = "".join(result.split("\n")) - parser.feed(result) - log = parser.close() - logentries = log.getiterator("logentry") + xmllog = ElementTree.fromstring(result) + logentries = xmllog.getiterator("logentry") revisions = [] for entry in logentries: revisions.append(int(entry.attrib["revision"])) -- cgit v1.2.1