Rev 4240: (vila) Stop-gap fix for Repository.get_revision_xml in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Apr 2 16:47:44 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4240
revision-id: pqm at pqm.ubuntu.com-20090402154740-0h1xz7luyp8mb2lz
parent: pqm at pqm.ubuntu.com-20090402144549-a1o7lbd8lp64qxnl
parent: v.ladeuil+lp at free.fr-20090402135702-z4o6v81p439b0ey8
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-04-02 16:47:40 +0100
message:
  (vila) Stop-gap fix for Repository.get_revision_xml
modified:
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 4237.1.1
    revision-id: v.ladeuil+lp at free.fr-20090402135702-z4o6v81p439b0ey8
    parent: pqm at pqm.ubuntu.com-20090402093220-mqwls6dsncdfegbq
    parent: v.ladeuil+lp at free.fr-20090402102108-g0xrarrluckwgxvs
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: trunk
    timestamp: Thu 2009-04-02 15:57:02 +0200
    message:
      Stop-gap fix for Repository.get_revision_xml
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 4232.2.1
    revision-id: v.ladeuil+lp at free.fr-20090402102108-g0xrarrluckwgxvs
    parent: pqm at pqm.ubuntu.com-20090401151438-hqulqoazddtacbls
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: 4230
    timestamp: Thu 2009-04-02 12:21:08 +0200
    message:
      Stop-gap fix for Repository.get_revision_xml.
      
      * bzrlib/repository.py:
      (Repository.get_revision_xml): Revert previous change as it breaks
      the test suite with LANG=en_US.UTF-8.
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-04-01 15:14:38 +0000
+++ b/bzrlib/repository.py	2009-04-02 10:21:08 +0000
@@ -16,6 +16,7 @@
 
 from bzrlib.lazy_import import lazy_import
 lazy_import(globals(), """
+import cStringIO
 import re
 import time
 
@@ -1635,13 +1636,20 @@
 
     @needs_read_lock
     def get_revision_xml(self, revision_id):
-        """Return the XML representation of a revision.
-
-        :param revision_id: Revision for which to return the XML.
-        :return: XML string
-        """
-        return self._serializer.write_revision_to_string(
-            self.get_revision(revision_id))
+        # TODO: jam 20070210 This shouldn't be necessary since get_revision
+        #       would have already do it.
+        # TODO: jam 20070210 Just use _serializer.write_revision_to_string()
+        # TODO: this can't just be replaced by:
+        # return self._serializer.write_revision_to_string(
+        #     self.get_revision(revision_id))
+        # as cStringIO preservers the encoding unlike write_revision_to_string
+        # or some other call down the path.
+        rev = self.get_revision(revision_id)
+        rev_tmp = cStringIO.StringIO()
+        # the current serializer..
+        self._serializer.write_revision(rev, rev_tmp)
+        rev_tmp.seek(0)
+        return rev_tmp.getvalue()
 
     def get_deltas_for_revisions(self, revisions, specific_fileids=None):
         """Produce a generator of revision deltas.




More information about the bazaar-commits mailing list