~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Aaron Bentley
  • Date: 2006-07-10 15:45:43 UTC
  • mto: This revision was merged to the branch mainline in revision 1848.
  • Revision ID: abentley@panoramicfeedback.com-20060710154543-07d80f02e1995c45
push handles file-ids with single- and double-quotes correctly (fixes #52227)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2152
2152
        versionedfile.clear_cache()
2153
2153
 
2154
2154
 
 
2155
_unsafe_entities = None
 
2156
 
 
2157
 
2155
2158
# Copied from xml.sax.saxutils
 
2159
# ADHB xml.sax.saxutils is horrendously broken!  apos and quot are predefined
 
2160
# according to XML 1.0 section 4.6
2156
2161
def _unescape_xml(data):
2157
 
    """Unescape &, <, and > in a string of data.
 
2162
    """Unescape predefined entities in a string of data.
2158
2163
    """
 
2164
    global _unsafe_entities
 
2165
    if _unsafe_entities is None:
 
2166
        _unsafe_entities = re.compile('\&(?!amp;|lt;|gt;|apos;|quot;)[^;]*')
 
2167
    unsafe = _unsafe_entities.search(data)
 
2168
    assert unsafe is None, 'Unhandled entity: %s' % unsafe.group(0)
2159
2169
    data = data.replace("&lt;", "<")
2160
2170
    data = data.replace("&gt;", ">")
 
2171
    data = data.replace("&quot;", '"')
 
2172
    data = data.replace("&apos;", "'")
2161
2173
    # must do ampersand last
2162
2174
    return data.replace("&amp;", "&")