Rev 83: Merge Jelmers inventory fix. in http://people.canonical.com/~robertc/baz2.0/plugins/search/trunk
Robert Collins
robertc at robertcollins.net
Sun Nov 7 05:11:42 GMT 2010
At http://people.canonical.com/~robertc/baz2.0/plugins/search/trunk
------------------------------------------------------------
revno: 83 [merge]
revision-id: robertc at robertcollins.net-20101107051142-8j6flo6um0ybkaqu
parent: robertc at robertcollins.net-20100521093411-pb076irrtisek4eb
parent: jelmer at samba.org-20101107011956-9vwakupbc2wzz5ss
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Sun 2010-11-07 18:11:42 +1300
message:
Merge Jelmers inventory fix.
modified:
inventory.py inventory.py-20080614043027-u57i4xjlc5ginuft-1
=== modified file 'inventory.py'
--- a/inventory.py 2008-06-29 22:33:07 +0000
+++ b/inventory.py 2010-11-07 01:19:56 +0000
@@ -31,6 +31,7 @@
r'(?:.* parent_id="(?P<parent_id>[^"]+)")?'
)
+_escape_re = lazy_regex.lazy_compile("[&'\"<>]")
_unescape_re = lazy_regex.lazy_compile("&|'|"|<|>")
_unescape_map = {
'&': '&',
@@ -41,6 +42,15 @@
}
def _unescape_replace(match, map=_unescape_map):
return map[match.group()]
+escape_map = {
+ "&":'&',
+ "'":"'", # FIXME: overkill
+ "\"":""",
+ "<":"<",
+ ">":">",
+ }
+def _escape_replace(match, map=escape_map):
+ return map[match.group()]
def paths_from_ids(xml_inventory, serializer, file_ids):
@@ -49,11 +59,9 @@
raise ValueError("Cannot process with serializer %r" % serializer)
search = _file_ids_name_regex.search
# escaped ids to match against the xml:
- escape_re = xml_serializer.escape_re
- _escape_replace = xml_serializer._escape_replace
escaped_to_raw_ids = {}
for file_id in file_ids:
- escaped_to_raw_ids[escape_re.sub(_escape_replace, file_id)] = file_id
+ escaped_to_raw_ids[_escape_re.sub(_escape_replace, file_id)] = file_id
unresolved_ids = set(escaped_to_raw_ids)
# TODO: only examine lines we need to, break early, track unprocessed
found_ids = {}
More information about the bazaar-commits
mailing list