aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <proyvind@moondrake.org>2016-05-31 06:39:48 +0200
committerPer Øyvind Karlsen <proyvind@moondrake.org>2016-05-31 06:39:48 +0200
commit9e9f1d722ede232b88969a4e7e574c109a5f9447 (patch)
tree22d03587c5a56fb013dc711cd704388a0b4bb569
parent0b0958bd6a0778cbb02f4c178967ccd51e0bb5e0 (diff)
downloadmgarepo-9e9f1d722ede232b88969a4e7e574c109a5f9447.tar
mgarepo-9e9f1d722ede232b88969a4e7e574c109a5f9447.tar.gz
mgarepo-9e9f1d722ede232b88969a4e7e574c109a5f9447.tar.bz2
mgarepo-9e9f1d722ede232b88969a4e7e574c109a5f9447.tar.xz
mgarepo-9e9f1d722ede232b88969a4e7e574c109a5f9447.zip
simplify initialization of ElementTree
-rw-r--r--MgaRepo/git.py14
1 files changed, 4 insertions, 10 deletions
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"]))