Rev 3281: (jam) Update PackRepo.get_revision_graph() to efficiently handle in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Mar 15 21:00:48 GMT 2008


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

------------------------------------------------------------
revno: 3281
revision-id:pqm at pqm.ubuntu.com-20080315210035-5qwda8bre2nwsra3
parent: pqm at pqm.ubuntu.com-20080315174441-l8xpw6femn0syal1
parent: john at arbash-meinel.com-20080315142250-8wzoq4j2tjmkxdkt
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2008-03-15 21:00:35 +0000
message:
  (jam) Update PackRepo.get_revision_graph() to efficiently handle
  	ghosts.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
  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/revision.py             revision.py-20050309040759-e77802c08f3999d5
  bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
  bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
  bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
  bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
  bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
    ------------------------------------------------------------
    revno: 3228.3.15
    revision-id:john at arbash-meinel.com-20080315142250-8wzoq4j2tjmkxdkt
    parent: john at arbash-meinel.com-20080315135109-7v9gimdidd1s7llr
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Sat 2008-03-15 14:22:50 +0000
    message:
      Stop using common_ancestor
    modified:
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
    ------------------------------------------------------------
    revno: 3228.3.14
    revision-id:john at arbash-meinel.com-20080315135109-7v9gimdidd1s7llr
    parent: john at arbash-meinel.com-20080314105537-v9h2ue0uxvs1dyn6
    parent: pqm at pqm.ubuntu.com-20080315174441-l8xpw6femn0syal1
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Sat 2008-03-15 13:51:09 +0000
    message:
      [merge] bzr.dev 3280
    added:
      bzrlib/tests/blackbox/test_hooks.py test_hooks.py-20080308163236-xljgf9j41hik1x21-1
      bzrlib/tests/tree_implementations/test_annotate_iter.py test_annotate_iter.p-20080315092519-h4dc43rntmfmq16d-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/merge3.py               merge3.py-20050704130834-bf0597094828a2e1
      bzrlib/smart/client.py         client.py-20061116014825-2k6ada6xgulslami-1
      bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
      bzrlib/tests/test_annotate.py  test_annotate.py-20061213215015-sttc9agsxomls7q0-1
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
      bzrlib/tests/test_merge3.py    merge3.py-20050704130834-556689114c89e6f2
      bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
      bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      doc/en/mini-tutorial/index.txt index.txt-20070813141352-2u64ooqzo0or4hss-2
      doc/en/user-guide/hooks.txt    hooks.txt-20070829200551-7nr6e5a1io6x78uf-1
    ------------------------------------------------------------
    revno: 3228.3.13
    revision-id:john at arbash-meinel.com-20080314105537-v9h2ue0uxvs1dyn6
    parent: john at arbash-meinel.com-20080310154144-ycgrxnoj3cyuahfa
    parent: pqm at pqm.ubuntu.com-20080314011927-hi5bdap69742g7zn
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Fri 2008-03-14 10:55:37 +0000
    message:
      [merge] bzr.dev 3275
    removed:
      index.txt                      index.txt-20071121073725-0corxykv5irjal00-1
    added:
      bzrlib/directory_service.py    directory_service.py-20080305221044-vr2mkvlsk8jypa2y-1
      bzrlib/plugins/launchpad/test_lp_service.py test_lp_service.py-20080213034527-drf0ucr2x1js3onb-1
      bzrlib/tests/test_directory_service.py test_directory_servi-20080305221044-vr2mkvlsk8jypa2y-2
      doc/en/admin-guide/            docenadminguide-20080305135054-y7y2c986yf94zljn-1
      doc/en/admin-guide/index.txt   index.txt-20080305140741-ecw0lap8dxkxc05g-1
      tools/package_mf.py            package_mf.py-20080206141953-323gd0qb2z3tn5pc-1
    renamed:
      bzrlib/plugins/launchpad/lp_indirect.py => bzrlib/plugins/launchpad/lp_directory.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
      bzrlib/plugins/launchpad/test_lp_indirect.py => bzrlib/plugins/launchpad/test_lp_directory.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/cmd_version_info.py     __init__.py-20051228204928-697d01fdca29c99b
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/delta.py                delta.py-20050729221636-54cf14ef94783d0a
      bzrlib/deprecated_graph.py     graph.py-20050905070950-b47dce53236c5e48
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/merge_directive.py      merge_directive.py-20070228184838-ja62280spt1g7f4x-1
      bzrlib/missing.py              missing.py-20050812153334-097f7097e2a8bcd1
      bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
      bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
      bzrlib/registry.py             lazy_factory.py-20060809213415-2gfvqadtvdn0phtg-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
      bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
      bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
      bzrlib/tests/blackbox/test_mv.py test_mv.py-20060705114902-33tkxz0o9cdshemo-1
      bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
      bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/blackbox/test_version_info.py test_bb_version_info.py-20051228204928-91711c6559d952f7
      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_revision_history.py test_revision_histor-20070326062311-v7co92liyuchb80w-1
      bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
      bzrlib/tests/test_branch.py    test_branch.py-20060116013032-97819aa07b8ab3b5
      bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
      bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
      bzrlib/tests/test_registry.py  test_lazy_factory.py-20060809213415-2gfvqadtvdn0phtg-2
      bzrlib/tests/test_ssh_transport.py test_ssh_transport.p-20070105153201-f7iq2bosvgjbdgc3-1
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/tests/test_tsort.py     testtsort.py-20051025073946-27da871c394d5be4
      bzrlib/tests/test_upgrade.py   test_upgrade.py-20051004040251-555fe1d2bae1bc71
      bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
      bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
      bzrlib/tests/tree_implementations/test_tree.py test_tree.py-20061215160206-usu7lwcj8aq2n3br-1
      bzrlib/tests/workingtree_implementations/test_inv.py test_inv.py-20070311221604-ighlq8tbn5xq0kuo-1
      bzrlib/tests/workingtree_implementations/test_merge_from_branch.py test_merge_from_bran-20060904034200-12jxyk2zlhpufxe1-1
      bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
      bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
      bzrlib/transport/memory.py     memory.py-20051016101338-cd008dbdf69f04fc
      bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/tsort.py                tsort.py-20051025073946-7808f6aaf7d07208
      bzrlib/urlutils.py             urlutils.py-20060502195429-e8a161ecf8fac004
      bzrlib/util/configobj/configobj.py configobj.py-20051018184548-06992a2246425e3e
      bzrlib/util/configobj/docs/BSD-LICENSE.txt BSDLICENSE.txt-20051018184548-29b89ff3102657f5
      bzrlib/util/configobj/docs/configobj.txt configobj.txt-20051018184548-4949b5f17e6a19c7
      bzrlib/util/configobj/docs/validate.txt validate.txt-20051018184548-9e0e5ad913e258f5
      bzrlib/version_info_formats/__init__.py generate_version_info.py-20051228204928-8358edabcddcd97e
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      doc/developers/lca-merge.txt   lcamerge.txt-20080103061803-9isydn4ivgwrvorw-1
      doc/en/user-guide/bazaar_workflows.txt bazaar_workflows.txt-20071114035000-q36a9h57ps06uvnl-1
      doc/en/user-guide/branching_a_project.txt branching_a_project.-20071122141511-0knao2lklsdsvb1q-2
      doc/en/user-guide/resolving_conflicts.txt resolving_conflicts.-20071122141511-0knao2lklsdsvb1q-5
      doc/en/user-guide/version_info.txt version_info.txt-20060921215543-gju6o5xdic8w25np-1
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
      tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
      bzrlib/plugins/launchpad/lp_directory.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
      bzrlib/plugins/launchpad/test_lp_directory.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
    ------------------------------------------------------------
    revno: 3228.3.12
    revision-id:john at arbash-meinel.com-20080310154144-ycgrxnoj3cyuahfa
    parent: john at arbash-meinel.com-20080310153956-jevcqupenzkylnvh
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-03-10 10:41:44 -0500
    message:
      NEWS update for new deprecations.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3228.3.11
    revision-id:john at arbash-meinel.com-20080310153956-jevcqupenzkylnvh
    parent: john at arbash-meinel.com-20080310151047-4vm0q4357if5q856
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-03-10 10:39:56 -0500
    message:
      Deprecations abound.
    modified:
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
    ------------------------------------------------------------
    revno: 3228.3.10
    revision-id:john at arbash-meinel.com-20080310151047-4vm0q4357if5q856
    parent: john at arbash-meinel.com-20080226001244-t3kghacai8bri599
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-03-10 10:10:47 -0500
    message:
      Respond to abentley's review comments.
    modified:
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
    ------------------------------------------------------------
    revno: 3228.3.9
    revision-id:john at arbash-meinel.com-20080226001244-t3kghacai8bri599
    parent: john at arbash-meinel.com-20080226000315-le0y2kwkc39gylxr
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 18:12:44 -0600
    message:
      Correct NEWS for the get_revision_graph update
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3228.3.8
    revision-id:john at arbash-meinel.com-20080226000315-le0y2kwkc39gylxr
    parent: john at arbash-meinel.com-20080225235147-sdk2eoz7cg839eer
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 18:03:15 -0600
    message:
      We need to be returning tuples, not lists
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
    ------------------------------------------------------------
    revno: 3228.3.7
    revision-id:john at arbash-meinel.com-20080225235147-sdk2eoz7cg839eer
    parent: john at arbash-meinel.com-20080225233644-8cd4jvirkzcx0lna
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 17:51:47 -0600
    message:
      Get some edge conditions correct.
      We might get to a ghost (like NULL_REVISION) without seeing any children first.
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
    ------------------------------------------------------------
    revno: 3228.3.6
    revision-id:john at arbash-meinel.com-20080225233644-8cd4jvirkzcx0lna
    parent: john at arbash-meinel.com-20080225230012-kovc1a5n4v9m7bzf
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 17:36:44 -0600
    message:
      Implement the logic in get_revision_graph instead.
      This should allow all users of get_revision_graph() to benefit.
    modified:
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 3228.3.5
    revision-id:john at arbash-meinel.com-20080225230012-kovc1a5n4v9m7bzf
    parent: john at arbash-meinel.com-20080225224136-g5dpjx3nzxcwbvvm
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 17:00:12 -0600
    message:
      Update NEWS for deprecated functions.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3228.3.4
    revision-id:john at arbash-meinel.com-20080225224136-g5dpjx3nzxcwbvvm
    parent: john at arbash-meinel.com-20080225220304-5shor4tu2zlrvl0x
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 16:41:36 -0600
    message:
      Change iter_ancestry to take a group instead of a single node,
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
    ------------------------------------------------------------
    revno: 3228.3.3
    revision-id:john at arbash-meinel.com-20080225220304-5shor4tu2zlrvl0x
    parent: john at arbash-meinel.com-20080225214701-vx0jrznt0ocyufrd
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 16:03:04 -0600
    message:
      API Friction... get_parent_map() artificially adds pointers to NULL_REVISION
    modified:
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
    ------------------------------------------------------------
    revno: 3228.3.2
    revision-id:john at arbash-meinel.com-20080225214701-vx0jrznt0ocyufrd
    parent: john at arbash-meinel.com-20080225210716-zxfak1r82qitgvxq
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 15:47:01 -0600
    message:
      Add a Graph.iter_ancestry()
    modified:
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
    ------------------------------------------------------------
    revno: 3228.3.1
    revision-id:john at arbash-meinel.com-20080225210716-zxfak1r82qitgvxq
    parent: pqm at pqm.ubuntu.com-20080220014008-9appc9kw4rjg8v1k
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: revision_graph
    timestamp: Mon 2008-02-25 15:07:16 -0600
    message:
      deprecate get_revision_graph_with_ghosts and its only caller, common_ancestor.
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
      bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
=== modified file 'NEWS'
--- a/NEWS	2008-03-15 17:44:41 +0000
+++ b/NEWS	2008-03-15 13:51:09 +0000
@@ -60,6 +60,11 @@
       case of running ``bzr missing`` command for two identical branches.
       (Alexander Belchenko)
 
+    * Speed up operations that look at the revision graph (such as 'bzr log').
+      ``KnitPackRepositor.get_revision_graph`` uses ``Graph.iter_ancestry`` to
+      extract the revision history. This allows filtering ghosts while
+      stepping instead of needing to peek ahead. (John Arbash Meinel)
+
     * The ``hooks`` command lists installed hooks, to assist in debugging.
       (Daniel Watkins)
 
@@ -133,6 +138,10 @@
       hundreds of MB of ram consumption.
       (Ian Clatworthy, John Arbash Meinel)
 
+    * ``Graph.iter_ancestry`` returns the ancestry of revision ids. Similar to
+      ``Repository.get_revision_graph()`` except it includes ghosts and you can
+      stop part-way through. (John Arbash Meinel)
+
     * New module ``tools/package_mf.py`` provide custom module finder for
       python packages (improves standard python library's modulefinder.py)
       used by ``setup.py`` script while building standalone bzr.exe.
@@ -148,6 +157,10 @@
       falling back to other repositories when they have partial data.
       (Robert Collins)
 
+    * ``Repository.get_revision_graph_with_ghosts`` and
+      ``bzrlib.revision.(common_ancestor,MultipleRevisionSources,common_graph)``
+      have been deprecated.  (John Arbash Meinel)
+
     * ``Tree.iter_changes`` is now a public API, replacing the work-in-progress
       ``Tree._iter_changes``. The api is now considered stable and ready for
       external users.  (Aaron Bentley)

=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2008-03-14 11:55:52 +0000
+++ b/bzrlib/graph.py	2008-03-15 13:51:09 +0000
@@ -424,6 +424,31 @@
                 raise errors.NoCommonAncestor(left_revision, right_revision)
             revisions = lca
 
+    def iter_ancestry(self, revision_ids):
+        """Iterate the ancestry of this revision.
+
+        :param revision_ids: Nodes to start the search
+        :return: Yield tuples mapping a revision_id to its parents for the
+            ancestry of revision_id.
+            Ghosts will be returned with None as their parents, and nodes
+            with no parents will have NULL_REVISION as their only parent. (As
+            defined by get_parent_map.)
+            There will also be a node for (NULL_REVISION, ())
+        """
+        pending = set(revision_ids)
+        processed = set()
+        while pending:
+            processed.update(pending)
+            next_map = self.get_parent_map(pending)
+            next_pending = set()
+            for item in next_map.iteritems():
+                yield item
+                next_pending.update(p for p in item[1] if p not in processed)
+            ghosts = pending.difference(next_map)
+            for ghost in ghosts:
+                yield (ghost, None)
+            pending = next_pending
+
     def iter_topo_order(self, revisions):
         """Iterate through the input revisions in topological order.
 

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2008-02-22 04:46:46 +0000
+++ b/bzrlib/remote.py	2008-03-14 10:55:37 +0000
@@ -28,6 +28,7 @@
     lockdir,
     repository,
     revision,
+    symbol_versioning,
 )
 from bzrlib.branch import BranchReferenceFormat
 from bzrlib.bzrdir import BzrDir, RemoteBzrDirFormat
@@ -914,6 +915,7 @@
         return self._real_repository.get_signature_text(revision_id)
 
     @needs_read_lock
+    @symbol_versioning.deprecated_method(symbol_versioning.one_three)
     def get_revision_graph_with_ghosts(self, revision_ids=None):
         self._ensure_real()
         return self._real_repository.get_revision_graph_with_ghosts(

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2008-02-12 02:38:27 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2008-03-10 15:39:56 +0000
@@ -220,6 +220,7 @@
             return a_weave.get_graph([revision_id])
 
     @needs_read_lock
+    @symbol_versioning.deprecated_method(symbol_versioning.one_three)
     def get_revision_graph_with_ghosts(self, revision_ids=None):
         """Return a graph of the revisions with ghosts marked as applicable.
 

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2008-03-08 09:34:41 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-03-14 10:55:37 +0000
@@ -1928,6 +1928,60 @@
             found_parents[key[0]] = parents
         return found_parents
 
+    @needs_read_lock
+    def get_revision_graph(self, revision_id=None):
+        """Return a dictionary containing the revision graph.
+
+        :param revision_id: The revision_id to get a graph from. If None, then
+        the entire revision graph is returned. This is a deprecated mode of
+        operation and will be removed in the future.
+        :return: a dictionary of revision_id->revision_parents_list.
+        """
+        if 'evil' in debug.debug_flags:
+            mutter_callsite(3,
+                "get_revision_graph scales with size of history.")
+        # special case NULL_REVISION
+        if revision_id == _mod_revision.NULL_REVISION:
+            return {}
+        if revision_id is None:
+            revision_vf = self._get_revision_vf()
+            return revision_vf.get_graph()
+        g = self.get_graph()
+        first = g.get_parent_map([revision_id])
+        if revision_id not in first:
+            raise errors.NoSuchRevision(self, revision_id)
+        else:
+            ancestry = {}
+            children = {}
+            NULL_REVISION = _mod_revision.NULL_REVISION
+            ghosts = set([NULL_REVISION])
+            for rev_id, parent_ids in g.iter_ancestry([revision_id]):
+                if parent_ids is None: # This is a ghost
+                    ghosts.add(rev_id)
+                    continue
+                ancestry[rev_id] = parent_ids
+                for p in parent_ids:
+                    if p in children:
+                        children[p].append(rev_id)
+                    else:
+                        children[p] = [rev_id]
+
+            if NULL_REVISION in ancestry:
+                del ancestry[NULL_REVISION]
+
+            # Find all nodes that reference a ghost, and filter the ghosts out
+            # of their parent lists. To preserve the order of parents, and
+            # avoid double filtering nodes, we just find all children first,
+            # and then filter.
+            children_of_ghosts = set()
+            for ghost in ghosts:
+                children_of_ghosts.update(children[ghost])
+
+            for child in children_of_ghosts:
+                ancestry[child] = tuple(p for p in ancestry[child]
+                                           if p not in ghosts)
+            return ancestry
+
     def has_revisions(self, revision_ids):
         """See Repository.has_revisions()."""
         revision_ids = set(revision_ids)

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-03-03 17:48:36 +0000
+++ b/bzrlib/repository.py	2008-03-14 10:55:37 +0000
@@ -1338,8 +1338,9 @@
         """
         # All revisions, to find inventory parents.
         if ancestors is None:
-            revision_graph = self.get_revision_graph_with_ghosts()
-            ancestors = revision_graph.get_ancestors()
+            # self.get_revision_graph_with_ghosts().get_ancestors() wasn't
+            # returning any ghosts anyway.
+            ancestors = self.get_revision_graph()
         if text_key_references is None:
             text_key_references = self.find_text_key_references()
         pb = ui.ui_factory.nested_progress_bar()
@@ -1565,6 +1566,7 @@
         raise NotImplementedError(self.get_revision_graph)
 
     @needs_read_lock
+    @deprecated_method(symbol_versioning.one_three)
     def get_revision_graph_with_ghosts(self, revision_ids=None):
         """Return a graph of the revisions with ghosts marked as applicable.
 

=== modified file 'bzrlib/revision.py'
--- a/bzrlib/revision.py	2007-12-18 17:52:11 +0000
+++ b/bzrlib/revision.py	2008-03-10 15:39:56 +0000
@@ -20,7 +20,7 @@
 
 from bzrlib import (
     errors,
-    symbol_versioning
+    symbol_versioning,
     )
 from bzrlib.deprecated_graph import (
     all_descendants,
@@ -233,6 +233,7 @@
     return root, ancestors, descendants
 
 
+ at deprecated_function(symbol_versioning.one_three)
 def combined_graph(revision_a, revision_b, revision_source):
     """Produce a combined ancestry graph.
     Return graph root, ancestors map, descendants map, set of common nodes"""
@@ -256,6 +257,7 @@
     return root, ancestors, descendants, common
 
 
+ at deprecated_function(symbol_versioning.one_three)
 def common_ancestor(revision_a, revision_b, revision_source, 
                     pb=DummyProgress()):
     if None in (revision_a, revision_b):
@@ -320,6 +322,8 @@
 
 class MultipleRevisionSources(object):
     """Proxy that looks in multiple branches for revisions."""
+
+    @symbol_versioning.deprecated_method(symbol_versioning.one_three)
     def __init__(self, *args):
         object.__init__(self)
         assert len(args) != 0

=== modified file 'bzrlib/revisionspec.py'
--- a/bzrlib/revisionspec.py	2007-11-22 00:33:15 +0000
+++ b/bzrlib/revisionspec.py	2008-03-10 15:39:56 +0000
@@ -642,8 +642,6 @@
         branch.lock_read()
         other_branch.lock_read()
         try:
-            revision_source = revision.MultipleRevisionSources(
-                    branch.repository, other_branch.repository)
             graph = branch.repository.get_graph(other_branch.repository)
             revision_a = revision.ensure_null(revision_a)
             revision_b = revision.ensure_null(revision_b)

=== modified file 'bzrlib/tests/repository_implementations/test_repository.py'
--- a/bzrlib/tests/repository_implementations/test_repository.py	2008-02-12 02:38:27 +0000
+++ b/bzrlib/tests/repository_implementations/test_repository.py	2008-03-10 15:39:56 +0000
@@ -36,7 +36,7 @@
     )
 from bzrlib.revision import NULL_REVISION, Revision
 from bzrlib.smart import server
-from bzrlib.symbol_versioning import one_two
+from bzrlib.symbol_versioning import one_two, one_three
 from bzrlib.tests import (
     KnownFailure,
     TestCaseWithTransport,
@@ -938,7 +938,8 @@
         # we can get a graph object with roots, ghosts, ancestors and
         # descendants.
         repo = self.bzrdir.open_repository()
-        graph = repo.get_revision_graph_with_ghosts([])
+        graph = self.applyDeprecated(one_three,
+                                     repo.get_revision_graph_with_ghosts, [])
         self.assertEqual(set(['rev1']), graph.roots)
         self.assertEqual(set(['ghost1', 'ghost2']), graph.ghosts)
         self.assertEqual({'rev1':[],
@@ -956,7 +957,8 @@
                           },
                           graph.get_descendants())
         # and we can ask for the NULLREVISION graph
-        graph = repo.get_revision_graph_with_ghosts([NULL_REVISION])
+        graph = self.applyDeprecated(one_three, 
+                    repo.get_revision_graph_with_ghosts, [NULL_REVISION])
         self.assertEqual({}, graph.get_ancestors())
         self.assertEqual({}, graph.get_descendants())
 

=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py	2008-01-17 22:41:32 +0000
+++ b/bzrlib/tests/test_graph.py	2008-03-10 15:10:47 +0000
@@ -238,6 +238,22 @@
             'f':[NULL_REVISION]}
 
 
+# A graph that contains a ghost
+#  NULL_REVISION
+#       |
+#       f
+#       |
+#       e   g
+#      / \ /
+#     b   d
+#     | \ |
+#     a   c
+
+with_ghost = {'a': ['b'], 'c': ['b', 'd'], 'b':['e'], 'd':['e', 'g'],
+              'e': ['f'], 'f':[NULL_REVISION], NULL_REVISION:()}
+
+
+
 class InstrumentedParentsProvider(object):
 
     def __init__(self, parents_provider):
@@ -489,6 +505,25 @@
         self.assertFalse(graph.is_ancestor('a', 'c'))
         self.assertTrue('null:' not in instrumented_provider.calls)
 
+    def test_iter_ancestry(self):
+        nodes = boundary.copy()
+        nodes[NULL_REVISION] = ()
+        graph = self.make_graph(nodes)
+        expected = nodes.copy()
+        expected.pop('a') # 'a' is not in the ancestry of 'c', all the
+                          # other nodes are
+        self.assertEqual(expected, dict(graph.iter_ancestry(['c'])))
+        self.assertEqual(nodes, dict(graph.iter_ancestry(['a', 'c'])))
+
+    def test_iter_ancestry_with_ghost(self):
+        graph = self.make_graph(with_ghost)
+        expected = with_ghost.copy()
+        # 'a' is not in the ancestry of 'c', and 'g' is a ghost
+        expected['g'] = None
+        self.assertEqual(expected, dict(graph.iter_ancestry(['a', 'c'])))
+        expected.pop('a') 
+        self.assertEqual(expected, dict(graph.iter_ancestry(['c'])))
+
     def test_filter_candidate_lca(self):
         """Test filter_candidate_lca for a corner case
 

=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py	2008-03-14 16:23:28 +0000
+++ b/bzrlib/tests/test_merge.py	2008-03-15 14:22:50 +0000
@@ -32,7 +32,6 @@
 from bzrlib.errors import UnrelatedBranches, NoCommits, BzrCommandError
 from bzrlib.merge import transform_tree, merge_inner, _PlanMerge
 from bzrlib.osutils import pathjoin, file_kind
-from bzrlib.revision import common_ancestor
 from bzrlib.tests import TestCaseWithTransport, TestCaseWithMemoryTransport
 from bzrlib.trace import (enable_test_log, disable_test_log)
 from bzrlib.workingtree import WorkingTree
@@ -106,8 +105,14 @@
         """Merge base is sane when two unrelated branches are merged"""
         wt1, br2 = self.test_pending_with_null()
         wt1.commit("blah")
-        last = wt1.branch.last_revision()
-        self.assertEqual(common_ancestor(last, last, wt1.branch.repository), last)
+        wt1.lock_read()
+        try:
+            last = wt1.branch.last_revision()
+            last2 = br2.last_revision()
+            graph = wt1.branch.repository.get_graph()
+            self.assertEqual(last2, graph.find_unique_lca(last, last2))
+        finally:
+            wt1.unlock()
 
     def test_create_rename(self):
         """Rename an inventory entry while creating the file"""

=== modified file 'bzrlib/tests/test_revision.py'
--- a/bzrlib/tests/test_revision.py	2007-12-18 15:22:47 +0000
+++ b/bzrlib/tests/test_revision.py	2008-03-10 15:39:56 +0000
@@ -20,6 +20,7 @@
 
 from bzrlib import (
     revision,
+    symbol_versioning,
     )
 from bzrlib.branch import Branch
 from bzrlib.errors import NoSuchRevision
@@ -28,7 +29,7 @@
                              common_ancestor,
                              is_ancestor, MultipleRevisionSources,
                              NULL_REVISION)
-from bzrlib.symbol_versioning import one_zero
+from bzrlib.symbol_versioning import one_zero, one_three
 from bzrlib.tests import TestCase, TestCaseWithTransport
 from bzrlib.trace import mutter
 from bzrlib.workingtree import WorkingTree
@@ -177,8 +178,9 @@
         wt2.commit("Commit fifteen", rev_id="b at u-0-10")
 
         from bzrlib.revision import MultipleRevisionSources
-        self.sources = MultipleRevisionSources(self.br1.repository,
-                                               self.br2.repository)
+        self.sources = self.applyDeprecated(one_three,
+                        MultipleRevisionSources, self.br1.repository,
+                                                 self.br2.repository)
 
 
 
@@ -200,12 +202,24 @@
 class TestCommonAncestor(TestCaseWithTransport):
     """Test checking whether a revision is an ancestor of another revision"""
 
+    def assertCommonAncestorEqual(self, expected, sources, rev_a, rev_b):
+        self.assertEqual(expected,
+                         self.applyDeprecated(one_three, 
+                         common_ancestor, rev_a, rev_b, sources))
+
+    def assertCommonAncestorIn(self, possible, sources, rev_a, rev_b):
+        """assert that we pick one among multiple possible common ancestors"""
+        self.assertTrue(self.applyDeprecated(one_three, 
+                            common_ancestor, rev_a, rev_b, sources)
+                        in possible)
+
     def test_common_ancestor(self):
         """Pick a reasonable merge base"""
         br1, br2 = make_branches(self)
         revisions = br1.revision_history()
         revisions_2 = br2.revision_history()
-        sources = MultipleRevisionSources(br1.repository, br2.repository)
+        sources = self.applyDeprecated(one_three, 
+                    MultipleRevisionSources, br1.repository, br2.repository)
         expected_ancestors_list = {revisions[3]:(0, 0), 
                                    revisions[2]:(1, 1),
                                    revisions_2[4]:(2, 1), 
@@ -218,40 +232,44 @@
             self.assertEqual(ancestors_list[key], value, 
                               "key %r, %r != %r" % (key, ancestors_list[key],
                                                     value))
-        self.assertEqual(common_ancestor(revisions[0], revisions[0], sources),
-                          revisions[0])
-        self.assertEqual(common_ancestor(revisions[1], revisions[2], sources),
-                          revisions[1])
-        self.assertEqual(common_ancestor(revisions[1], revisions[1], sources),
-                          revisions[1])
-        self.assertEqual(common_ancestor(revisions[2], revisions_2[4], sources),
-                          revisions[2])
-        self.assertEqual(common_ancestor(revisions[3], revisions_2[4], sources),
-                          revisions_2[4])
-        self.assertEqual(common_ancestor(revisions[4], revisions_2[5], sources),
-                          revisions_2[4])
-        self.assertTrue(common_ancestor(revisions[5], revisions_2[6], sources) in
-                        (revisions[4], revisions_2[5]))
-        self.assertTrue(common_ancestor(revisions_2[6], revisions[5], sources),
-                        (revisions[4], revisions_2[5]))
-        self.assertEqual(None, common_ancestor(None, revisions[5], sources))
-        self.assertEqual(NULL_REVISION,
-            common_ancestor(NULL_REVISION, NULL_REVISION, sources))
-        self.assertEqual(NULL_REVISION,
-            common_ancestor(revisions[0], NULL_REVISION, sources))
-        self.assertEqual(NULL_REVISION,
-            common_ancestor(NULL_REVISION, revisions[0], sources))
+        self.assertCommonAncestorEqual(revisions[0], sources,
+                                       revisions[0], revisions[0])
+        self.assertCommonAncestorEqual(revisions[1], sources,
+                                       revisions[1], revisions[2])
+        self.assertCommonAncestorEqual(revisions[1], sources,
+                                       revisions[1], revisions[1])
+        self.assertCommonAncestorEqual(revisions[2], sources,
+                                       revisions[2], revisions_2[4])
+        self.assertCommonAncestorEqual(revisions_2[4], sources,
+                                       revisions[3], revisions_2[4])
+        self.assertCommonAncestorEqual(revisions_2[4], sources,
+                                       revisions[4], revisions_2[5])
+        self.assertCommonAncestorIn((revisions[4], revisions_2[5]), sources,
+                                     revisions[5], revisions_2[6])
+        self.assertCommonAncestorIn((revisions[4], revisions_2[5]), sources,
+                                     revisions_2[6], revisions[5])
+        self.assertCommonAncestorEqual(None, sources,
+                                       None, revisions[5])
+        self.assertCommonAncestorEqual(NULL_REVISION, sources,
+                                       NULL_REVISION, NULL_REVISION)
+        self.assertCommonAncestorEqual(NULL_REVISION, sources,
+                                       revisions[0], NULL_REVISION)
+        self.assertCommonAncestorEqual(NULL_REVISION, sources,
+                                       NULL_REVISION, revisions[0])
 
     def test_combined(self):
         """combined_graph
         Ensure it's not order-sensitive
         """
         br1, br2 = make_branches(self)
-        source = MultipleRevisionSources(br1.repository, br2.repository)
-        combined_1 = combined_graph(br1.last_revision(),
-                                    br2.last_revision(), source)
-        combined_2 = combined_graph(br2.last_revision(),
-                                    br1.last_revision(), source)
+        source = self.applyDeprecated(one_three,
+                    MultipleRevisionSources, br1.repository, br2.repository)
+        combined_1 = self.applyDeprecated(one_three,
+                        combined_graph, br1.last_revision(),
+                                        br2.last_revision(), source)
+        combined_2 = self.applyDeprecated(one_three,
+                        combined_graph, br2.last_revision(),
+                                        br1.last_revision(), source)
         self.assertEquals(combined_1[1], combined_2[1])
         self.assertEquals(combined_1[2], combined_2[2])
         self.assertEquals(combined_1[3], combined_2[3])
@@ -289,7 +307,7 @@
         # add a right-branch revision
         graph.add_node('right', ['rev1'])
         source = MockRevisionSource(graph)
-        self.assertEqual('rev1', common_ancestor('left', 'right', source))
+        self.assertCommonAncestorEqual('rev1', source, 'left', 'right')
 
 
 class TestMultipleRevisionSources(TestCaseWithTransport):
@@ -305,11 +323,18 @@
         tree_1.commit('foo', rev_id='B', allow_pointless=True)
         tree_2 = self.make_branch_and_tree('2')
         tree_2.commit('bar', rev_id='A', allow_pointless=True)
-        source = MultipleRevisionSources(tree_1.branch.repository,
-                                         tree_2.branch.repository)
+        source = self.applyDeprecated(one_three,
+                    MultipleRevisionSources, tree_1.branch.repository,
+                                             tree_2.branch.repository)
+        # get_revision_graph calls the deprecated
+        # get_revision_graph_with_ghosts once for each repository.
+        expected_warning = symbol_versioning.deprecation_string(
+            tree_1.branch.repository.get_revision_graph_with_ghosts,
+            one_three)
+        rev_graph = self.callDeprecated([expected_warning, expected_warning],
+                        source.get_revision_graph, 'B')
         self.assertEqual({'B':['A'],
-                          'A':[]},
-                         source.get_revision_graph('B'))
+                          'A':[]}, rev_graph)
 
 
 class TestReservedId(TestCase):




More information about the bazaar-commits mailing list