Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Jajcus/pyxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Konieczny <jajcus@jajcus.net>2009-01-17 21:08:21 +0300
committerJacek Konieczny <jajcus@jajcus.net>2009-01-17 21:08:21 +0300
commit5692bbe1686aa4042c8370f250d51368a7d89733 (patch)
treef400f49a3f145399767e949d3423a1fb2bfc9199 /auxtools
parent0219d3f0aebaf08987932402a09e87cd1ae9fdc4 (diff)
- svn2log.py updated to use the standard ElementTree interface instead of pyxml
Diffstat (limited to 'auxtools')
-rwxr-xr-xauxtools/svn2log.py45
1 files changed, 21 insertions, 24 deletions
diff --git a/auxtools/svn2log.py b/auxtools/svn2log.py
index fdbddfa..c6b8490 100755
--- a/auxtools/svn2log.py
+++ b/auxtools/svn2log.py
@@ -35,7 +35,7 @@ import getopt
import string
import codecs
-from xml.utils import qp_xml
+from xml.etree import ElementTree
kill_prefix_rx = None
default_domain = "localhost"
@@ -51,18 +51,15 @@ def die(msg):
sys.stderr.write(msg + "\n")
sys.exit(1)
-def attr(e, n):
- return e.attrs[("", n)]
-
def has_child(e, n):
- for c in e.children:
- if c.name == n: return 1
+ for c in e.getchildren():
+ if c.tag == n: return 1
return 0
def child(e, n):
- for c in e.children:
- if c.name == n: return c
- die("<%s> doesn't have <%s> child" % (e.name, n))
+ for c in e.getchildren():
+ if c.tag == n: return c
+ die("<%s> doesn't have <%s> child" % (e.tag, n))
def convert_path(n):
for src in reloc.keys():
@@ -148,25 +145,25 @@ class Entry:
return self.author == other.author and abs(self.tm - other.tm) < max_join_delta
def process_entry(e):
- rev = attr(e, "revision")
+ rev = e.get("revision")
if has_child(e, "author"):
- author = child(e, "author").textof()
+ author = child(e, "author").text
else:
author = "anonymous"
- m = date_rx.search(child(e, "date").textof())
- msg = child(e, "msg").textof()
+ m = date_rx.search(child(e, "date").text)
+ msg = child(e, "msg").text
if m:
tm = time.mktime(time.strptime(m.group(1), "%Y-%m-%dT%H:%M:%S"))
else:
- die("evil date: %s" % child(e, "date").textof())
+ die("evil date: %s" % child(e, "date").text)
paths = []
- for path in child(e, "paths").children:
- if path.name != "path": die("<paths> has non-<path> child")
- nam = convert_path(path.textof())
+ for path in child(e, "paths").getchildren():
+ if path.tag != "path": die("<paths> has non-<path> child")
+ nam = convert_path(path.text)
if nam != None:
- if attr(path, "action") == "D":
+ if path.get("action") == "D":
paths.append(nam + " (removed)")
- elif attr(path, "action") == "A":
+ elif path.get("action") == "A":
paths.append(nam + " (added)")
else:
paths.append(nam)
@@ -177,15 +174,15 @@ def process_entry(e):
return None
def process(fin, fout):
- parser = qp_xml.Parser()
- root = parser.parse(fin)
+ tree = ElementTree.parse(fin)
+ root = tree.getroot()
- if root.name != "log": die("root is not <log>")
+ if root.tag != "log": die("root is not <log>")
cur = None
- for logentry in root.children:
- if logentry.name != "logentry": die("non <logentry> <log> child")
+ for logentry in root.getchildren():
+ if logentry.tag != "logentry": die("non <logentry> <log> child")
e = process_entry(logentry)
if e != None:
if cur != None: