[svn r58360] factor import of xml into one method to deal more gracefully
with implementations that don't have expat. --HG-- branch : trunk
This commit is contained in:
parent
ed231f4b1b
commit
863fff7042
|
@ -9,8 +9,6 @@ svn-Command based Implementation of a Subversion WorkingCopy Path.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, sys, time, re, calendar
|
import os, sys, time, re, calendar
|
||||||
from xml.dom import minidom
|
|
||||||
from xml.parsers.expat import ExpatError
|
|
||||||
import py
|
import py
|
||||||
from py.__.path import common
|
from py.__.path import common
|
||||||
from py.__.path.svn import cache
|
from py.__.path.svn import cache
|
||||||
|
@ -481,13 +479,10 @@ if verbose is True, then the LogEntry instances also know which files changed.
|
||||||
'svn log --xml %s %s %s "%s"' % (
|
'svn log --xml %s %s %s "%s"' % (
|
||||||
rev_opt, verbose_opt, auth_opt,
|
rev_opt, verbose_opt, auth_opt,
|
||||||
self.strpath))
|
self.strpath))
|
||||||
from xml.dom import minidom
|
minidom,ExpatError = importxml()
|
||||||
from xml.parsers.expat import ExpatError
|
|
||||||
try:
|
try:
|
||||||
tree = minidom.parse(stdout)
|
tree = minidom.parse(stdout)
|
||||||
except ExpatError:
|
except ExpatError:
|
||||||
# XXX not entirely sure about this exception... shouldn't it be
|
|
||||||
# some py.error.* something?
|
|
||||||
raise ValueError('no such revision')
|
raise ValueError('no such revision')
|
||||||
result = []
|
result = []
|
||||||
for logentry in filter(None, tree.firstChild.childNodes):
|
for logentry in filter(None, tree.firstChild.childNodes):
|
||||||
|
@ -645,6 +640,7 @@ class XMLWCStatus(WCStatus):
|
||||||
# unchanged ones in the status object so this is far from ideal
|
# unchanged ones in the status object so this is far from ideal
|
||||||
rootstatus = WCStatus(rootwcpath, rev, modrev, author)
|
rootstatus = WCStatus(rootwcpath, rev, modrev, author)
|
||||||
update_rev = None
|
update_rev = None
|
||||||
|
minidom, ExpatError = importxml()
|
||||||
try:
|
try:
|
||||||
doc = minidom.parseString(data)
|
doc = minidom.parseString(data)
|
||||||
except ExpatError, e:
|
except ExpatError, e:
|
||||||
|
@ -809,3 +805,10 @@ def make_recursive_propdict(wcroot,
|
||||||
def error_enhance((cls, error, tb)):
|
def error_enhance((cls, error, tb)):
|
||||||
raise cls, error, tb
|
raise cls, error, tb
|
||||||
|
|
||||||
|
def importxml(cache=[]):
|
||||||
|
if cache:
|
||||||
|
return cache
|
||||||
|
from xml.dom import minidom
|
||||||
|
from xml.parsers.expat import ExpatError
|
||||||
|
cache.extend([minidom, ExpatError])
|
||||||
|
return cache
|
||||||
|
|
Loading…
Reference in New Issue