Rev 4420: (Gary van der Merwe) Add bzrlib.graph.StackedParentsProvider as a in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jun 9 08:46:05 BST 2009


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

------------------------------------------------------------
revno: 4420
revision-id: pqm at pqm.ubuntu.com-20090609074559-97mi1flqtxzh6aj3
parent: pqm at pqm.ubuntu.com-20090609062641-6hs0exctaa1sz12m
parent: andrew.bennetts at canonical.com-20090609064754-jgjnv0ljwamrvmbk
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2009-06-09 08:45:59 +0100
message:
  (Gary van der Merwe) Add bzrlib.graph.StackedParentsProvider as a
  	public API, deprecating the old name of '_StackedParentsProvider'.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
  bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-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/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
  bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
    ------------------------------------------------------------
    revno: 4379.3.10
    revision-id: andrew.bennetts at canonical.com-20090609064754-jgjnv0ljwamrvmbk
    parent: andrew.bennetts at canonical.com-20090609031405-wak9yogzzpx9o172
    parent: pqm at pqm.ubuntu.com-20090609062641-6hs0exctaa1sz12m
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: PublicStackedParentsProvider
    timestamp: Tue 2009-06-09 16:47:54 +1000
    message:
      Merge bzr.dev, resolving NEWS conflict.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
      bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
      bzrlib/tests/test_progress.py  test_progress.py-20060308160359-978c397bc79b7fda
      bzrlib/tests/test_ui.py        test_ui.py-20051130162854-458e667a7414af09
      bzrlib/weave.py                knit.py-20050627021749-759c29984154256b
    ------------------------------------------------------------
    revno: 4379.3.9
    revision-id: andrew.bennetts at canonical.com-20090609031405-wak9yogzzpx9o172
    parent: andrew.bennetts at canonical.com-20090609031258-5cm2fn22xkbqjr0w
    parent: pqm at pqm.ubuntu.com-20090606005240-2qms4n1eqdshzp0w
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: PublicStackedParentsProvider
    timestamp: Tue 2009-06-09 13:14:05 +1000
    message:
      Merge bzr.dev, resolving NEWS conflict.
    removed:
      bzrlib/util/tests/test_bencode.py test_bencode.py-20070713042202-qjw8rppxaz7ky6i6-1
    added:
      bzrlib/_bencode_pyx.h          _bencode_pyx.h-20090604155331-53bg7d0udmrvz44n-1
      bzrlib/_bencode_pyx.pyx        bencode.pyx-20070806220735-j75g4ebfnado2i60-3
      bzrlib/benchmarks/bench_tags.py bench_tags.py-20070812104202-0q5i0mqkt72hubof-1
      bzrlib/bencode.py              bencode.py-20070806220735-j75g4ebfnado2i60-2
      bzrlib/send.py                 send.py-20090521192735-j7cdb33ykmtmzx4w-1
      bzrlib/tests/per_repository_reference/test_fetch.py test_fetch.py-20090511214909-25pkgmoam913lrji-1
      bzrlib/tests/per_repository_reference/test_initialize.py test_initialize.py-20090527083941-4rz2urcthjet5e2i-1
      bzrlib/tests/per_repository_reference/test_unlock.py test_unlock.py-20090526160031-14lvypj5pbrndnyz-1
      bzrlib/tests/test_bencode.py   test_bencode.py-20070806225234-s51cnnkh6raytxti-1
      bzrlib/tests/test_chk_serializer.py test_chk_serializer.-20090515105921-urte9wnhknlj5dyp-1
    renamed:
      bzrlib/tests/workingtree_implementations/test_get_file_with_stat.py => bzrlib/tests/tree_implementations/test_get_file_with_stat.py test_get_file_with_s-20080922035909-lhdovrr36jpxmu0v-1
      bzrlib/util/bencode.py => bzrlib/util/_bencode_py.py bencode.py-20070220044742-sltr28q21w2wzlxi-1
    modified:
      .bzrignore                     bzrignore-20050311232317-81f7b71efa2db11a
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/_groupcompress_pyx.pyx  _groupcompress_c.pyx-20080724041824-yelg6ii7c7zxt4z0-1
      bzrlib/benchmarks/__init__.py  __init__.py-20060516064526-eb0d37c78e86065d
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/serializer/v4.py v10.py-20070611062757-5ggj7k18s9dej0fr-1
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/cache_utf8.py           cache_utf8.py-20060810004311-x4cph46la06h9azm-1
      bzrlib/chk_serializer.py       chk_serializer.py-20081002064345-2tofdfj2eqq01h4b-1
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/foreign.py              foreign.py-20081112170002-olsxmandkk8qyfuq-1
      bzrlib/groupcompress.py        groupcompress.py-20080705181503-ccbxd6xuy1bdnrpu-8
      bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
      bzrlib/multiparent.py          __init__.py-20070410133617-n1jdhcc1n1mibarp-1
      bzrlib/mutabletree.py          mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/plugins/launchpad/test_register.py test_register.py-20060315182712-40f5dda945c829a8
      bzrlib/python-compat.h         pythoncompat.h-20080924041409-9kvi0fgtuuqp743j-1
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/groupcompress_repo.py repofmt.py-20080715094215-wp1qfvoo7093c8qr-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/serializer.py           serializer.py-20090402143702-wmkh9cfjhwpju0qi-1
      bzrlib/shelf.py                prepare_shelf.py-20081005181341-n74qe6gu1e65ad4v-1
      bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
      bzrlib/tag.py                  tag.py-20070212110532-91cw79inah2cfozx-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_add.py test_add.py-20060518072250-857e4f86f54a30b2
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
      bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      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/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
      bzrlib/tests/inventory_implementations/basics.py basics.py-20070903044446-kdjwbiu1p1zi9phs-1
      bzrlib/tests/per_repository/test_fetch.py test_fetch.py-20070814052151-5cxha9slx4c93uog-1
      bzrlib/tests/per_repository/test_fileid_involved.py test_file_involved.py-20051215205901-728a172d1014daaa
      bzrlib/tests/per_repository/test_iter_reverse_revision_history.py test_iter_reverse_re-20070217015036-spu7j5ggch7pbpyd-1
      bzrlib/tests/per_repository/test_reconcile.py test_reconcile.py-20060223022332-572ef70a3288e369
      bzrlib/tests/per_repository/test_revision.py testrevprops.py-20051013073044-92bc3c68302ce1bf
      bzrlib/tests/per_repository/test_write_group.py test_write_group.py-20070716105516-89n34xtogq5frn0m-1
      bzrlib/tests/per_repository_reference/__init__.py __init__.py-20080220025549-nnm2s80it1lvcwnc-2
      bzrlib/tests/per_repository_reference/test_default_stacking.py test_default_stackin-20090311055345-9ajahgm58oq3wh6h-1
      bzrlib/tests/test__groupcompress.py test__groupcompress_-20080724145854-koifwb7749cfzrvj-1
      bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
      bzrlib/tests/test_foreign.py   test_foreign.py-20081125004048-ywb901edgp9lluxo-1
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_groupcompress.py test_groupcompress.p-20080705181503-ccbxd6xuy1bdnrpu-13
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
      bzrlib/tests/test_serializer.py test_serializer.py-20090403213933-q6x117y8t9fbeyoz-1
      bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
      bzrlib/tests/test_source.py    test_source.py-20051207061333-a58dea6abecc030d
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_ui.py        test_ui.py-20051130162854-458e667a7414af09
      bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
      bzrlib/tests/workingtree_implementations/__init__.py __init__.py-20060203003124-b2aa5aca21a8bfad
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/sftp.py       sftp.py-20051019050329-ab48ce71b7e32dfe
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
      bzrlib/tests/tree_implementations/test_get_file_with_stat.py test_get_file_with_s-20080922035909-lhdovrr36jpxmu0v-1
      bzrlib/util/_bencode_py.py     bencode.py-20070220044742-sltr28q21w2wzlxi-1
    ------------------------------------------------------------
    revno: 4379.3.8
    revision-id: andrew.bennetts at canonical.com-20090609031258-5cm2fn22xkbqjr0w
    parent: garyvdm at gmail.com-20090529100427-j0abqee6ase5rbe6
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: PublicStackedParentsProvider
    timestamp: Tue 2009-06-09 13:12:58 +1000
    message:
      Trivial NEWS formatting tweak (add a blank line).
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 4379.3.7
    revision-id: garyvdm at gmail.com-20090529100427-j0abqee6ase5rbe6
    parent: garyvdm at gmail.com-20090529100059-98xuy198lp39c5sz
    committer: Gary van der Merwe <garyvdm at gmail.com>
    branch nick: bzr.dev
    timestamp: Fri 2009-05-29 12:04:27 +0200
    message:
      Add NEWS item.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 4379.3.6
    revision-id: garyvdm at gmail.com-20090529100059-98xuy198lp39c5sz
    parent: garyvdm at gmail.com-20090528145326-21pogwz2cavtdsfm
    committer: Gary van der Merwe <garyvdm at gmail.com>
    branch nick: bzr.dev
    timestamp: Fri 2009-05-29 12:00:59 +0200
    message:
      Test that _StackedParentsProvider is deprecated and still works. The deprecated version was also incorrect.
    modified:
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
    ------------------------------------------------------------
    revno: 4379.3.5
    revision-id: garyvdm at gmail.com-20090528145326-21pogwz2cavtdsfm
    parent: garyvdm at gmail.com-20090528105510-op71rns3vr68y42c
    committer: Gary van der Merwe <garyvdm at gmail.com>
    branch nick: bzr.dev
    timestamp: Thu 2009-05-28 16:53:26 +0200
    message:
      Still have _StackedParentsProvider, but mark it as depreciated.
    modified:
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
    ------------------------------------------------------------
    revno: 4379.3.4
    revision-id: garyvdm at gmail.com-20090528105510-op71rns3vr68y42c
    parent: garyvdm at gmail.com-20090527141059-vgcetdtl1pebfdy4
    committer: Gary van der Merwe <garyvdm at gmail.com>
    branch nick: bzr.dev
    timestamp: Thu 2009-05-28 12:55:10 +0200
    message:
      Make StackedParentsProvider.__repr__ more dynamic.
    modified:
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
    ------------------------------------------------------------
    revno: 4379.3.3
    revision-id: garyvdm at gmail.com-20090527141059-vgcetdtl1pebfdy4
    parent: garyvdm at gmail.com-20090527114349-v5o2tnd789acjgbm
    committer: Gary van der Merwe <garyvdm at gmail.com>
    branch nick: bzr.dev
    timestamp: Wed 2009-05-27 16:10:59 +0200
    message:
      Rename and add doc string for StackedParentsProvider.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-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/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
    ------------------------------------------------------------
    revno: 4379.3.2
    revision-id: garyvdm at gmail.com-20090527114349-v5o2tnd789acjgbm
    parent: garyvdm at gmail.com-20090527110452-ommx6z8fw1xhp71e
    committer: Gary van der Merwe <garyvdm at gmail.com>
    branch nick: bzr.dev
    timestamp: Wed 2009-05-27 13:43:49 +0200
    message:
      Simplify the previous test.
    modified:
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
    ------------------------------------------------------------
    revno: 4379.3.1
    revision-id: garyvdm at gmail.com-20090527110452-ommx6z8fw1xhp71e
    parent: pqm at pqm.ubuntu.com-20090523064024-0o95iuqvh8wj2zuz
    committer: Gary van der Merwe <garyvdm at gmail.com>
    branch nick: bzr.dev
    timestamp: Wed 2009-05-27 13:04:52 +0200
    message:
      Add test for _StackedParentsProvider where there are overlapping revisions (revisions that are available in both providers.)
    modified:
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
=== modified file 'NEWS'
--- a/NEWS	2009-06-09 06:26:41 +0000
+++ b/NEWS	2009-06-09 06:47:54 +0000
@@ -113,6 +113,10 @@
   ``TTYProgressBar`` and ``child_progress`` are now deprecated; use
   ``ui_factory.nested_progress_bar`` instead.  (Martin Pool)
 
+* ``graph.StackedParentsProvider`` is now a public API, replacing
+  ``graph._StackedParentsProvider``. The api is now considered stable and ready
+  for external users. (Gary van der Merwe)
+
 * TreeTransformBase no longer assumes that limbo is provided via disk.
   DiskTreeTransform now provides disk functionality.  (Aaron Bentley)
 

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-06-04 21:25:46 +0000
+++ b/bzrlib/bzrdir.py	2009-06-09 03:14:05 +0000
@@ -2768,7 +2768,7 @@
         del ie.text_id
 
     def get_parent_map(self, revision_ids):
-        """See graph._StackedParentsProvider.get_parent_map"""
+        """See graph.StackedParentsProvider.get_parent_map"""
         return dict((revision_id, self.revisions[revision_id])
                     for revision_id in revision_ids
                      if revision_id in self.revisions)

=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2009-05-27 09:40:33 +0000
+++ b/bzrlib/graph.py	2009-06-09 03:14:05 +0000
@@ -20,10 +20,10 @@
     debug,
     errors,
     revision,
-    symbol_versioning,
     trace,
     tsort,
     )
+from bzrlib.symbol_versioning import deprecated_function, deprecated_in
 
 STEP_UNIQUE_SEARCHER_EVERY = 5
 
@@ -60,18 +60,25 @@
         return 'DictParentsProvider(%r)' % self.ancestry
 
     def get_parent_map(self, keys):
-        """See _StackedParentsProvider.get_parent_map"""
+        """See StackedParentsProvider.get_parent_map"""
         ancestry = self.ancestry
         return dict((k, ancestry[k]) for k in keys if k in ancestry)
 
-
-class _StackedParentsProvider(object):
-
+ at deprecated_function(deprecated_in((1, 16, 0)))
+def _StackedParentsProvider(*args, **kwargs):
+    return StackedParentsProvider(*args, **kwargs)
+
+class StackedParentsProvider(object):
+    """A parents provider which stacks (or unions) multiple providers.
+    
+    The providers are queries in the order of the provided parent_providers.
+    """
+    
     def __init__(self, parent_providers):
         self._parent_providers = parent_providers
 
     def __repr__(self):
-        return "_StackedParentsProvider(%r)" % self._parent_providers
+        return "%s(%r)" % (self.__class__.__name__, self._parent_providers)
 
     def get_parent_map(self, keys):
         """Get a mapping of keys => parents
@@ -148,7 +155,7 @@
         return dict(self._cache)
 
     def get_parent_map(self, keys):
-        """See _StackedParentsProvider.get_parent_map."""
+        """See StackedParentsProvider.get_parent_map."""
         cache = self._cache
         if cache is None:
             cache = self._get_parent_map(keys)

=== modified file 'bzrlib/index.py'
--- a/bzrlib/index.py	2009-03-24 01:53:42 +0000
+++ b/bzrlib/index.py	2009-05-27 14:10:59 +0000
@@ -1192,7 +1192,7 @@
                 ', '.join(map(repr, self._indices)))
 
     def get_parent_map(self, keys):
-        """See graph._StackedParentsProvider.get_parent_map"""
+        """See graph.StackedParentsProvider.get_parent_map"""
         search_keys = set(keys)
         if NULL_REVISION in search_keys:
             search_keys.discard(NULL_REVISION)

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2009-06-03 01:37:27 +0000
+++ b/bzrlib/remote.py	2009-06-09 03:14:05 +0000
@@ -1576,7 +1576,7 @@
             providers.insert(0, other)
         providers.extend(r._make_parents_provider() for r in
                          self._fallback_repositories)
-        return graph._StackedParentsProvider(providers)
+        return graph.StackedParentsProvider(providers)
 
     def _serialise_search_recipe(self, recipe):
         """Serialise a graph search recipe.

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2009-04-09 20:23:07 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2009-05-27 14:10:59 +0000
@@ -54,7 +54,7 @@
         return 'KnitParentsProvider(%r)' % self._knit
 
     def get_parent_map(self, keys):
-        """See graph._StackedParentsProvider.get_parent_map"""
+        """See graph.StackedParentsProvider.get_parent_map"""
         parent_map = {}
         for revision_id in keys:
             if revision_id is None:
@@ -85,7 +85,7 @@
         return 'KnitsParentsProvider(%r)' % self._knit
 
     def get_parent_map(self, keys):
-        """See graph._StackedParentsProvider.get_parent_map"""
+        """See graph.StackedParentsProvider.get_parent_map"""
         parent_map = self._knit.get_parent_map(
             [self._prefix + (key,) for key in keys])
         result = {}

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-06-04 21:25:46 +0000
+++ b/bzrlib/repository.py	2009-06-09 03:14:05 +0000
@@ -2384,7 +2384,7 @@
         return self.control_files.get_transaction()
 
     def get_parent_map(self, revision_ids):
-        """See graph._StackedParentsProvider.get_parent_map"""
+        """See graph.StackedParentsProvider.get_parent_map"""
         # revisions index works in keys; this just works in revisions
         # therefore wrap and unwrap
         query_keys = []
@@ -2413,7 +2413,7 @@
         parents_provider = self._make_parents_provider()
         if (other_repository is not None and
             not self.has_same_location(other_repository)):
-            parents_provider = graph._StackedParentsProvider(
+            parents_provider = graph.StackedParentsProvider(
                 [parents_provider, other_repository._make_parents_provider()])
         return graph.Graph(parents_provider)
 

=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py	2009-05-12 02:24:54 +0000
+++ b/bzrlib/tests/test_graph.py	2009-06-09 03:14:05 +0000
@@ -22,6 +22,7 @@
     )
 from bzrlib.revision import NULL_REVISION
 from bzrlib.tests import TestCaseWithMemoryTransport
+from bzrlib.symbol_versioning import deprecated_in 
 
 
 # Ancestry 1:
@@ -661,10 +662,36 @@
         self.assertEqual((set(['e']), set(['f', 'g'])),
                          graph.find_difference('e', 'f'))
 
+
     def test_stacked_parents_provider(self):
         parents1 = _mod_graph.DictParentsProvider({'rev2': ['rev3']})
         parents2 = _mod_graph.DictParentsProvider({'rev1': ['rev4']})
-        stacked = _mod_graph._StackedParentsProvider([parents1, parents2])
+        stacked = _mod_graph.StackedParentsProvider([parents1, parents2])
+        self.assertEqual({'rev1':['rev4'], 'rev2':['rev3']},
+                         stacked.get_parent_map(['rev1', 'rev2']))
+        self.assertEqual({'rev2':['rev3'], 'rev1':['rev4']},
+                         stacked.get_parent_map(['rev2', 'rev1']))
+        self.assertEqual({'rev2':['rev3']},
+                         stacked.get_parent_map(['rev2', 'rev2']))
+        self.assertEqual({'rev1':['rev4']},
+                         stacked.get_parent_map(['rev1', 'rev1']))
+    
+    def test_stacked_parents_provider_overlapping(self):
+        # rev2 is availible in both providers.
+        # 1
+        # |
+        # 2
+        parents1 = _mod_graph.DictParentsProvider({'rev2': ['rev1']})
+        parents2 = _mod_graph.DictParentsProvider({'rev2': ['rev1']})
+        stacked = _mod_graph.StackedParentsProvider([parents1, parents2])
+        self.assertEqual({'rev2': ['rev1']},
+                         stacked.get_parent_map(['rev2']))
+
+    def test__stacked_parents_provider_deprecated(self):
+        parents1 = _mod_graph.DictParentsProvider({'rev2': ['rev3']})
+        parents2 = _mod_graph.DictParentsProvider({'rev1': ['rev4']})
+        stacked = self.applyDeprecated(deprecated_in((1, 16, 0)),
+                    _mod_graph._StackedParentsProvider, [parents1, parents2])
         self.assertEqual({'rev1':['rev4'], 'rev2':['rev3']},
                          stacked.get_parent_map(['rev1', 'rev2']))
         self.assertEqual({'rev2':['rev3'], 'rev1':['rev4']},

=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py	2009-05-26 09:20:17 +0000
+++ b/bzrlib/versionedfile.py	2009-06-09 03:14:05 +0000
@@ -40,7 +40,7 @@
     revision,
     ui,
     )
-from bzrlib.graph import DictParentsProvider, Graph, _StackedParentsProvider
+from bzrlib.graph import DictParentsProvider, Graph, StackedParentsProvider
 from bzrlib.transport.memory import MemoryTransport
 """)
 from bzrlib.inter import InterObject
@@ -1333,7 +1333,7 @@
             result[revision.NULL_REVISION] = ()
         self._providers = self._providers[:1] + self.fallback_versionedfiles
         result.update(
-            _StackedParentsProvider(self._providers).get_parent_map(keys))
+            StackedParentsProvider(self._providers).get_parent_map(keys))
         for key, parents in result.iteritems():
             if parents == ():
                 result[key] = (revision.NULL_REVISION,)




More information about the bazaar-commits mailing list