/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to processors/generic_processor.py

  • Committer: Ian Clatworthy
  • Date: 2009-02-18 01:09:34 UTC
  • mto: (0.64.117 trunk)
  • mto: This revision was merged to the branch mainline in revision 6631.
  • Revision ID: ian.clatworthy@canonical.com-20090218010934-dn6xdnq78u1egdf7
move escape_commit_message into helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
705
705
           timestamp=committer[2],
706
706
           timezone=committer[3],
707
707
           committer=who,
708
 
           message=self._escape_commit_message(self.command.message),
 
708
           message=helpers.escape_commit_message(self.command.message),
709
709
           revision_id=self.revision_id,
710
710
           properties=rev_props,
711
711
           parent_ids=self.parents)
713
713
            lambda file_id: self._get_lines(file_id),
714
714
            lambda revision_ids: self._get_inventories(revision_ids))
715
715
 
716
 
    def _escape_commit_message(self, message):
717
 
        """Replace xml-incompatible control characters."""
718
 
        # It's crap that we need to do this at this level (but we do)
719
 
        # Code copied from bzrlib.commit.
720
 
        
721
 
        # Python strings can include characters that can't be
722
 
        # represented in well-formed XML; escape characters that
723
 
        # aren't listed in the XML specification
724
 
        # (http://www.w3.org/TR/REC-xml/#NT-Char).
725
 
        message, _ = re.subn(
726
 
            u'[^\x09\x0A\x0D\u0020-\uD7FF\uE000-\uFFFD]+',
727
 
            lambda match: match.group(0).encode('unicode_escape'),
728
 
            message)
729
 
        return message
730
 
 
731
716
    def modify_handler(self, filecmd):
732
717
        if filecmd.dataref is not None:
733
718
            data = self.cache_mgr.fetch_blob(filecmd.dataref)