Rev 3434: (jam) Proper fix for bug #211661, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon May 19 19:56:59 BST 2008


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

------------------------------------------------------------
revno: 3434
revision-id:pqm at pqm.ubuntu.com-20080519185645-whhuax9pml5sebk5
parent: pqm at pqm.ubuntu.com-20080519125348-0cj2omrjvzlh88xy
parent: john at arbash-meinel.com-20080519162930-ymox3xd3rjrd1qbi
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-05-19 19:56:45 +0100
message:
  (jam) Proper fix for bug #211661,
  	passing None to get_parent_map() is illegal
added:
  bzrlib/tests/repository_implementations/test_get_parent_map.py test_get_parent_map.-20080421172708-x1z6ot341osr0jq1-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
    ------------------------------------------------------------
    revno: 3373.5.5
    revision-id:john at arbash-meinel.com-20080519162930-ymox3xd3rjrd1qbi
    parent: john at arbash-meinel.com-20080509161919-j2s1ymi8cm1me5ay
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: dont_log_view_none_211661
    timestamp: Mon 2008-05-19 11:29:30 -0500
    message:
      fix the line endigs for test_get_parent_map.py
    modified:
      bzrlib/tests/repository_implementations/test_get_parent_map.py test_get_parent_map.-20080421172708-x1z6ot341osr0jq1-1
    ------------------------------------------------------------
    revno: 3373.5.4
    revision-id:john at arbash-meinel.com-20080509161919-j2s1ymi8cm1me5ay
    parent: john at arbash-meinel.com-20080503033307-eod32g60463mhx17
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: dont_log_view_none_211661
    timestamp: Fri 2008-05-09 11:19:19 -0500
    message:
      Track down another bogus location. Only triggered with --long
    modified:
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
    ------------------------------------------------------------
    revno: 3373.5.3
    revision-id:john at arbash-meinel.com-20080503033307-eod32g60463mhx17
    parent: john at arbash-meinel.com-20080421173254-8x9ynjqe0hk46xsz
    parent: pqm at pqm.ubuntu.com-20080502230043-zwk3y5idlir4uak1
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: dont_log_view_none_211661
    timestamp: Fri 2008-05-02 22:33:07 -0500
    message:
      Merge bzr.dev, resolve conflicts.
    added:
      bzrlib/tests/branch_implementations/test_check.py test_check.py-20080429151303-1sbfclxhddpz0tnj-1
      bzrlib/tests/branch_implementations/test_reconcile.py test_reconcile.py-20080429161555-qlmccuyeyt6pvho7-1
      bzrlib/tests/interrepository_implementations/test_fetch.py test_fetch.py-20080425213627-j60cjh782ufm83ry-1
    modified:
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/bundle_data.py   read_changeset.py-20050619171944-c0d95aa685537640
      bzrlib/bundle/serializer/v4.py v10.py-20070611062757-5ggj7k18s9dej0fr-1
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/hooks.py                hooks.py-20070325015548-ix4np2q0kd8452au-1
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/lockable_files.py       control_files.py-20051111201905-bb88546e799d669f
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/msgeditor.py            msgeditor.py-20050901111708-ef6d8de98f5d8f2f
      bzrlib/mutabletree.py          mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
      bzrlib/plugins/launchpad/lp_directory.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
      bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
      bzrlib/store/revision/knit.py  knit.py-20060303020652-de5fa299e941a3c7
      bzrlib/store/revision/text.py  text.py-20060303020652-e49155f0da4d14ab
      bzrlib/symbol_versioning.py    symbol_versioning.py-20060105104851-9ecf8af605d15a80
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
      bzrlib/tests/blackbox/test_hooks.py test_hooks.py-20080308163236-xljgf9j41hik1x21-1
      bzrlib/tests/blackbox/test_reconcile.py test_fix.py-20060223013051-9a188e15a5ee9451
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/branch_implementations/test_commit.py test_commit.py-20070206022134-117z1i5b644p63r0-1
      bzrlib/tests/branch_implementations/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
      bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
      bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
      bzrlib/tests/branch_implementations/test_uncommit.py test_uncommit.py-20070205180410-ge7058d9138mvq3x-1
      bzrlib/tests/interrepository_implementations/__init__.py __init__.py-20060220054744-baf49a1f88f17b1a
      bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
      bzrlib/tests/repository_implementations/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_bundle.py    test.py-20050630184834-092aa401ab9f039c
      bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_hooks.py     test_hooks.py-20070628030849-89rtsbe5dmer5npz-1
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_lockable_files.py test_lockable_files.py-20051225183927-365c7fd99591caf1
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
      bzrlib/tests/test_reconcile.py test_reconcile.py-20060225054842-50aa618584a86f26
      bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/tests/test_store.py     teststore.py-20050826022702-f6caadb647395769
      bzrlib/tests/transport_util.py transportutil.py-20070525113600-5v2igk89s8fensom-1
      bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
      bzrlib/tests/tree_implementations/test_inv.py test_inv.py-20070312023226-0cdvk5uwhutis9vg-1
      bzrlib/tests/tree_implementations/test_test_trees.py test_tree_trees.py-20060720091921-3nwi5h21lf06vf5p-1
      bzrlib/tests/workingtree_implementations/test_basis_inventory.py test_basis_inventory.py-20051218151655-3650468941091309
      bzrlib/tests/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      doc/default.css                default.css-20060622101119-tgwtdci8z769bjb9-1
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
      doc/developers/network-protocol.txt networkprotocol.txt-20070903044232-woustorrjbmg5zol-1
      doc/en/user-guide/controlling_registration.txt controlling_registra-20071121073725-0corxykv5irjal00-3
      doc/en/user-guide/hooks.txt    hooks.txt-20070829200551-7nr6e5a1io6x78uf-1
      doc/en/user-guide/sending_changes.txt sending_changes.txt-20071123154453-dk2mjhrg1vpjm5w2-4
    ------------------------------------------------------------
    revno: 3373.5.2
    revision-id:john at arbash-meinel.com-20080421173254-8x9ynjqe0hk46xsz
    parent: john at arbash-meinel.com-20080418203059-iguj66uacil58ytv
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: dont_log_view_none_211661
    timestamp: Mon 2008-04-21 12:32:54 -0500
    message:
      Add repository_implementation tests for get_parent_map
      
      If None is passed, repositories should raise ValueError, since
      None is not a valid revision_id.
      
      Implement this ability for all repository implementations.
    added:
      bzrlib/tests/repository_implementations/test_get_parent_map.py test_get_parent_map.-20080421172708-x1z6ot341osr0jq1-1
    modified:
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
    ------------------------------------------------------------
    revno: 3373.5.1
    revision-id:john at arbash-meinel.com-20080418203059-iguj66uacil58ytv
    parent: pqm at pqm.ubuntu.com-20080417155359-m3nxwwr442bgmsne
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: dont_log_view_none_211661
    timestamp: Fri 2008-04-18 15:30:59 -0500
    message:
      bzr log bzr:// was failing at the first revision because it was trying to
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
=== added file 'bzrlib/tests/repository_implementations/test_get_parent_map.py'
--- a/bzrlib/tests/repository_implementations/test_get_parent_map.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/repository_implementations/test_get_parent_map.py	2008-05-19 16:29:30 +0000
@@ -0,0 +1,73 @@
+# Copyright (C) 2008 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""Tests for the get_parent_map API."""
+
+from bzrlib import revision
+from bzrlib.tests.repository_implementations import TestCaseWithRepository
+
+
+class TestGetParentMap(TestCaseWithRepository):
+
+    def test_missing_revision(self):
+        tree = self.make_branch_and_tree('.')
+        repo = tree.branch.repository
+        repo.lock_read()
+        self.addCleanup(repo.unlock)
+        self.assertEqual({}, repo.get_parent_map(['non-existant']))
+
+    def test_multiple_parents(self):
+        tree = self.make_branch_and_tree('.')
+        rev1 = tree.commit('first')
+        rev2 = tree.commit('second')
+        tree.set_parent_ids([rev1, rev2])
+        tree.branch.set_last_revision_info(1, rev1)
+        rev3 = tree.commit('third')
+        repo = tree.branch.repository
+        repo.lock_read()
+        self.addCleanup(repo.unlock)
+        self.assertEqual({rev3:(rev1, rev2)},
+                         repo.get_parent_map([rev3]))
+        self.assertEqual({rev1:(revision.NULL_REVISION,),
+                          rev2:(rev1,),
+                          rev3:(rev1, rev2),
+                         }, repo.get_parent_map([rev1, rev2, rev3]))
+
+    def test_no_parents(self):
+        tree = self.make_branch_and_tree('.')
+        rev1 = tree.commit('first')
+        repo = tree.branch.repository
+        repo.lock_read()
+        self.addCleanup(repo.unlock)
+        self.assertEqual({rev1:(revision.NULL_REVISION,)},
+                         repo.get_parent_map([rev1]))
+
+    def test_none(self):
+        tree = self.make_branch_and_tree('.')
+        rev1 = tree.commit('first')
+        repo = tree.branch.repository
+        repo.lock_read()
+        self.addCleanup(repo.unlock)
+        self.assertRaises(ValueError,
+                          repo.get_parent_map, [None])
+
+    def test_null_revision(self):
+        tree = self.make_branch_and_tree('.')
+        repo = tree.branch.repository
+        repo.lock_read()
+        self.addCleanup(repo.unlock)
+        self.assertEqual({revision.NULL_REVISION:()},
+                         repo.get_parent_map([revision.NULL_REVISION]))

=== modified file 'NEWS'
--- a/NEWS	2008-05-19 12:53:48 +0000
+++ b/NEWS	2008-05-19 18:56:45 +0000
@@ -128,6 +128,10 @@
       to fix when a Branch has a non-canonical mainline history. ``bzr check``
       also detects this condition. (John Arbash Meinel, #177855)
 
+    * ``bzr log -r ..X bzr://`` was failing, because it was getting a request
+      for ``revision_id=None`` which was not a string.
+      (John Arbash Meinel, #211661)
+
     * ``bzr commit`` now works with Microsoft's FTP service.
       (Andreas Deininger)
 

=== modified file 'bzrlib/log.py'
--- a/bzrlib/log.py	2008-05-08 04:33:38 +0000
+++ b/bzrlib/log.py	2008-05-19 18:56:45 +0000
@@ -522,8 +522,10 @@
     # This asks for all mainline revisions, which means we only have to spider
     # sideways, rather than depth history. That said, its still size-of-history
     # and should be addressed.
+    # mainline_revisions always includes an extra revision at the beginning, so
+    # don't request it.
     parent_map = dict(((key, value) for key, value in
-        graph.iter_ancestry(mainline_revs) if value is not None))
+        graph.iter_ancestry(mainline_revs[1:]) if value is not None))
     # filter out ghosts; merge_sort errors on ghosts.
     rev_graph = _strip_NULL_ghosts(parent_map)
     merge_sorted_revisions = merge_sort(

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2008-05-16 06:06:35 +0000
+++ b/bzrlib/remote.py	2008-05-19 18:56:45 +0000
@@ -860,6 +860,8 @@
             return rg
 
         keys = set(keys)
+        if None in keys:
+            raise ValueError('get_parent_map(None) is not valid')
         if NULL_REVISION in keys:
             keys.discard(NULL_REVISION)
             found_parents = {NULL_REVISION:()}

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2008-05-12 02:40:40 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2008-05-19 18:56:45 +0000
@@ -68,6 +68,8 @@
         """See graph._StackedParentsProvider.get_parent_map"""
         parent_map = {}
         for revision_id in keys:
+            if revision_id is None:
+                raise ValueError('get_parent_map(None) is not valid')
             if revision_id == _mod_revision.NULL_REVISION:
                 parent_map[revision_id] = ()
             else:

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2008-05-12 02:40:40 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-05-19 18:56:45 +0000
@@ -1912,6 +1912,8 @@
         self._pack_collection.ensure_loaded()
         index = self._pack_collection.revision_index.combined_index
         keys = set(keys)
+        if None in keys:
+            raise ValueError('get_parent_map(None) is not valid')
         if _mod_revision.NULL_REVISION in keys:
             keys.discard(_mod_revision.NULL_REVISION)
             found_parents = {_mod_revision.NULL_REVISION:()}

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-05-12 02:40:40 +0000
+++ b/bzrlib/repository.py	2008-05-19 18:56:45 +0000
@@ -1695,6 +1695,8 @@
         """See graph._StackedParentsProvider.get_parent_map"""
         parent_map = {}
         for revision_id in keys:
+            if revision_id is None:
+                raise ValueError('get_parent_map(None) is not valid')
             if revision_id == _mod_revision.NULL_REVISION:
                 parent_map[revision_id] = ()
             else:

=== modified file 'bzrlib/tests/repository_implementations/__init__.py'
--- a/bzrlib/tests/repository_implementations/__init__.py	2008-04-28 08:57:45 +0000
+++ b/bzrlib/tests/repository_implementations/__init__.py	2008-05-19 18:56:45 +0000
@@ -869,6 +869,7 @@
         'test_fileid_involved',
         'test_find_text_key_references',
         'test__generate_text_key_index',
+        'test_get_parent_map',
         'test_has_same_location',
         'test_has_revisions',
         'test_is_write_locked',




More information about the bazaar-commits mailing list