Rev 2536: Make merge directives robust against broken bundles in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jun 19 20:43:23 BST 2007


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

------------------------------------------------------------
revno: 2536
revision-id: pqm at pqm.ubuntu.com-20070619194321-g3qy7rh361kdvstd
parent: pqm at pqm.ubuntu.com-20070619024533-oand7e7ns9eyis9x
parent: aaron.bentley at utoronto.ca-20070619052015-y7r2d7i5sihpfadm
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-06-19 20:43:21 +0100
message:
  Make merge directives robust against broken bundles
modified:
  bzrlib/merge_directive.py      merge_directive.py-20070228184838-ja62280spt1g7f4x-1
  bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.29
    merged: aaron.bentley at utoronto.ca-20070619052015-y7r2d7i5sihpfadm
    parent: abentley at panoramicfeedback.com-20070618135514-gitkdic3nfyak3ip
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Tue 2007-06-19 01:20:15 -0400
    message:
      Make merge directives robust against broken bundles
=== modified file 'bzrlib/merge_directive.py'
--- a/bzrlib/merge_directive.py	2007-06-08 21:48:42 +0000
+++ b/bzrlib/merge_directive.py	2007-06-19 19:43:21 +0000
@@ -108,7 +108,8 @@
             patch = ''.join(patch_lines)
             try:
                 bundle_serializer.read_bundle(StringIO(patch))
-            except errors.NotABundle:
+            except (errors.NotABundle, errors.BundleNotSupported,
+                    errors.BadBundle):
                 patch_type = 'diff'
             else:
                 patch_type = 'bundle'

=== modified file 'bzrlib/tests/test_merge_directive.py'
--- a/bzrlib/tests/test_merge_directive.py	2007-04-19 07:17:16 +0000
+++ b/bzrlib/tests/test_merge_directive.py	2007-06-19 05:20:15 +0000
@@ -265,6 +265,16 @@
         self.assertContainsRe(md1.patch, '\\+content_c')
         self.assertNotContainsRe(md1.patch, '\\+content_a')
 
+    def test_broken_bundle(self):
+        tree_a, tree_b, branch_c = self.make_trees()
+        md1 = merge_directive.MergeDirective.from_objects(
+            tree_a.branch.repository, 'rev2a', 500, 120, tree_b.branch.base,
+            public_branch=branch_c.base)
+        lines = md1.to_lines()
+        lines = [l.replace('\n', '\r\n') for l in lines]
+        md2 = merge_directive.MergeDirective.from_lines(lines)
+        self.assertEqual('rev2a', md2.revision_id)
+
     def test_signing(self):
         time = 453
         timezone = 7200




More information about the bazaar-commits mailing list