Rev 3074: Merge warns when criss-cross encountered + docs in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Dec 4 03:52:22 GMT 2007


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

------------------------------------------------------------
revno: 3074
revision-id:pqm at pqm.ubuntu.com-20071204035213-2kot5u403spjchen
parent: pqm at pqm.ubuntu.com-20071204004243-cgss0sl9yf0ayepc
parent: aaron.bentley at utoronto.ca-20071204031351-oqfar0izq3i4w0wo
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-12-04 03:52:13 +0000
message:
  Merge warns when criss-cross encountered + docs
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
  bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
  bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
  bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.15
    revision-id:aaron.bentley at utoronto.ca-20071204031351-oqfar0izq3i4w0wo
    parent: aaron.bentley at utoronto.ca-20071204003434-4cv0if9v5zwdehib
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-12-03 22:13:51 -0500
    message:
      Remove unused line from test case
    modified:
      bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.14
    revision-id:aaron.bentley at utoronto.ca-20071204003434-4cv0if9v5zwdehib
    parent: aaron.bentley at utoronto.ca-20071204001817-8subm5s03adnech2
    parent: pqm at pqm.ubuntu.com-20071203222135-gjk2xshgdfgxje6m
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-12-03 19:34:34 -0500
    message:
      Merge bzr.dev
    added:
      doc/en/tutorials/              docentutorials-20071127235845-bm2lu60bvau1ptmh-1
      doc/en/user-guide/annotating_changes.txt annotating_changes.t-20071122141511-0knao2lklsdsvb1q-1
      doc/en/user-guide/bazaar_workflows.txt bazaar_workflows.txt-20071114035000-q36a9h57ps06uvnl-1
      doc/en/user-guide/best_practice_intro.txt best_practice_intro.-20071123154453-dk2mjhrg1vpjm5w2-1
      doc/en/user-guide/branching_a_project.txt branching_a_project.-20071122141511-0knao2lklsdsvb1q-2
      doc/en/user-guide/browsing_history.txt browsing_history.txt-20071121073725-0corxykv5irjal00-2
      doc/en/user-guide/central_intro.txt central_intro.txt-20071123055134-k5x4ekduci2lbn36-1
      doc/en/user-guide/configuring_bazaar.txt configuring_bazaar.t-20071128000722-ncxiua259xwbdbg7-1
      doc/en/user-guide/controlling_registration.txt controlling_registra-20071121073725-0corxykv5irjal00-3
      doc/en/user-guide/core_concepts.txt core_concepts.txt-20071114035000-q36a9h57ps06uvnl-2
      doc/en/user-guide/distributed_intro.txt distributed_intro.tx-20071123154453-dk2mjhrg1vpjm5w2-2
      doc/en/user-guide/entering_commands.txt using_bazaar.txt-20071114035000-q36a9h57ps06uvnl-6
      doc/en/user-guide/getting_help.txt getting_help.txt-20071128000722-ncxiua259xwbdbg7-2
      doc/en/user-guide/images/      images-20071114035000-q36a9h57ps06uvnl-3
      doc/en/user-guide/images/workflows_centralized.png workflows_centralize-20071114035000-q36a9h57ps06uvnl-8
      doc/en/user-guide/images/workflows_centralized.svg workflows_centralize-20071130043324-bhms0cgyphhq1b2x-1
      doc/en/user-guide/images/workflows_gatekeeper.png workflows_gatekeeper-20071114035000-q36a9h57ps06uvnl-9
      doc/en/user-guide/images/workflows_gatekeeper.svg workflows_gatekeeper-20071130043324-bhms0cgyphhq1b2x-2
      doc/en/user-guide/images/workflows_localcommit.png workflows_localcommi-20071114035000-q36a9h57ps06uvnl-10
      doc/en/user-guide/images/workflows_localcommit.svg workflows_localcommi-20071130043324-bhms0cgyphhq1b2x-3
      doc/en/user-guide/images/workflows_peer.png workflows_peer.png-20071114035000-q36a9h57ps06uvnl-11
      doc/en/user-guide/images/workflows_peer.svg workflows_peer.svg-20071130043324-bhms0cgyphhq1b2x-4
      doc/en/user-guide/images/workflows_pqm.png workflows_pqm.png-20071114035000-q36a9h57ps06uvnl-12
      doc/en/user-guide/images/workflows_pqm.svg workflows_pqm.svg-20071130043324-bhms0cgyphhq1b2x-5
      doc/en/user-guide/images/workflows_shared.png workflows_shared.png-20071114035000-q36a9h57ps06uvnl-13
      doc/en/user-guide/images/workflows_shared.svg workflows_shared.svg-20071130043324-bhms0cgyphhq1b2x-6
      doc/en/user-guide/images/workflows_single.png workflows_single.png-20071114035000-q36a9h57ps06uvnl-14
      doc/en/user-guide/images/workflows_single.svg workflows_single.svg-20071130043324-bhms0cgyphhq1b2x-7
      doc/en/user-guide/installing_bazaar.txt installing_bazaar.tx-20071114035000-q36a9h57ps06uvnl-4
      doc/en/user-guide/introducing_bazaar.txt introducing_bazaar.t-20071114035000-q36a9h57ps06uvnl-5
      doc/en/user-guide/merging_changes.txt merging_changes.txt-20071122141511-0knao2lklsdsvb1q-3
      doc/en/user-guide/organizing_branches.txt organizing_branches.-20071123154453-dk2mjhrg1vpjm5w2-3
      doc/en/user-guide/partner_intro.txt partner_workflow.txt-20071122141511-0knao2lklsdsvb1q-4
      doc/en/user-guide/publishing_a_branch.txt publishing_a_branch.-20071123055134-k5x4ekduci2lbn36-2
      doc/en/user-guide/recording_changes.txt recording_changes.tx-20071121073725-0corxykv5irjal00-4
      doc/en/user-guide/releasing_a_project.txt releasing_a_project.-20071121073725-0corxykv5irjal00-5
      doc/en/user-guide/resolving_conflicts.txt resolving_conflicts.-20071122141511-0knao2lklsdsvb1q-5
      doc/en/user-guide/reusing_a_checkout.txt reusing_a_checkout.t-20071123055134-k5x4ekduci2lbn36-3
      doc/en/user-guide/reviewing_changes.txt reviewing_changes.tx-20071121073725-0corxykv5irjal00-6
      doc/en/user-guide/sending_changes.txt sending_changes.txt-20071123154453-dk2mjhrg1vpjm5w2-4
      doc/en/user-guide/solo_intro.txt solo_workflow.txt-20071121073725-0corxykv5irjal00-7
      doc/en/user-guide/starting_a_project.txt starting_a_project.t-20071121073725-0corxykv5irjal00-8
      doc/en/user-guide/undoing_mistakes.txt undoing_mistakes.txt-20071121092300-8fyacngt1w98e5mp-1
      doc/en/user-guide/using_checkouts.txt using_checkouts.txt-20071123055134-k5x4ekduci2lbn36-4
      doc/en/user-guide/using_gatekeepers.txt using_gatekeepers.tx-20071123154453-dk2mjhrg1vpjm5w2-5
      doc/en/user-guide/working_offline_central.txt working_offline_cent-20071123055134-k5x4ekduci2lbn36-5
      doc/en/user-guide/writing_a_plugin.txt writing_a_plugin.txt-20071114035000-q36a9h57ps06uvnl-7
    renamed:
      doc/en/user-guide/centralized_workflow.txt => doc/en/tutorials/centralized_workflow.txt centralized_workflow-20060830194948-kspf52565xvgrlil-1
      doc/en/user-guide/tutorial.txt => doc/en/tutorials/tutorial.txt tutorial.txt-20050804190939-9dcbba2ef053bc84
    modified:
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      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/check.py                check.py-20050309040759-f3a679400c06bcc1
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
      bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/lru_cache.py            lru_cache.py-20070119165515-tlw203kuwh0id5gv-1
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
      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/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/smart/branch.py         branch.py-20061124031907-mzh3pla28r83r97f-1
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/tests/HTTPTestUtil.py   HTTPTestUtil.py-20050914180604-247d3aafb7a43343
      bzrlib/tests/HttpServer.py     httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_reconfigure.py test_reconfigure.py-20070908173426-khfo5fi2rgzgtwj3-1
      bzrlib/tests/blackbox/test_remove.py test_remove.py-20060530011439-fika5rm84lon0goe-1
      bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/branch_implementations/test_break_lock.py test_break_lock.py-20060504111902-9aae411dbe9aadd2
      bzrlib/tests/branch_implementations/test_create_checkout.py test_create_checkout-20070322193723-n2wkp1g03r0404di-1
      bzrlib/tests/branch_implementations/test_locking.py test_locking.py-20060707151933-tav3o2hpibwi53u4-4
      bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
      bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
      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/__init__.py __init__.py-20060131092037-9564957a7d4a841b
      bzrlib/tests/repository_implementations/test_check.py test_check.py-20070824124512-38g4d135gcqxo4zb-1
      bzrlib/tests/repository_implementations/test_reconcile.py test_reconcile.py-20060223022332-572ef70a3288e369
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_ancestry.py  test_ancestry.py-20050913023709-69768e94848312c6
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
      bzrlib/tests/test_lru_cache.py test_lru_cache.py-20070119165535-hph6rk4h9rzy4180-1
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
      bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
      bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
      bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
      bzrlib/tests/test_switch.py    test_switch.py-20071116011000-v5lnw7d2wkng9eux-2
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_upgrade.py   test_upgrade.py-20051004040251-555fe1d2bae1bc71
      bzrlib/tests/tree_implementations/test_inv.py test_inv.py-20070312023226-0cdvk5uwhutis9vg-1
      bzrlib/tests/workingtree_implementations/test_break_lock.py test_break_lock.py-20060504115740-233e245df546fd42
      bzrlib/tests/workingtree_implementations/test_remove.py test_remove.py-20070413183901-rvnp85rtc0q0sclp-1
      bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
      bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
      bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
      bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
      bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
      bzrlib/win32utils.py           win32console.py-20051021033308-123c6c929d04973d
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      doc/developers/performance-contributing.txt performancecontribut-20070621063612-ac4zhhagjzkr21qp-1
      doc/en/mini-tutorial/index.txt index.txt-20070813141352-2u64ooqzo0or4hss-2
      doc/en/user-guide/authentication_conf.txt authentication_conf.-20071104135035-glfv0ri355tyg1nf-1
      doc/en/user-guide/bug_trackers.txt bug_trackers.txt-20070713223459-khxdlcudraii95uv-1
      doc/en/user-guide/configuration.txt configuration.txt-20060314161707-868350809502af01
      doc/en/user-guide/conflicts.txt conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
      doc/en/user-guide/hooks.txt    hooks.txt-20070829200551-7nr6e5a1io6x78uf-1
      doc/en/user-guide/http_smart_server.txt fastcgi.txt-20061005091552-rz8pva0olkxv0sd8-3
      doc/en/user-guide/index.txt    index.txt-20060622101119-tgwtdci8z769bjb9-2
      doc/en/user-guide/plugins.txt  plugins.txt-20060314145616-525099a747f3ffdd
      doc/en/user-guide/server.txt   server.txt-20060913044801-h939fvbwzz39gf7g-1
      doc/en/user-guide/setting_up_email.txt setting_up_email.txt-20060314161707-fd242c8944346173
      doc/en/user-guide/shared_repository_layouts.txt shared_repository_la-20070502152030-bagewuqs18ns24o7-1
      doc/en/user-guide/specifying_revisions.txt specifying_revisions.txt-20060314161707-19deb139101bea33
      doc/en/user-guide/using_aliases.txt using_aliases.txt-20060314161707-c21d27fa2939e039
      doc/en/user-guide/version_info.txt version_info.txt-20060921215543-gju6o5xdic8w25np-1
      doc/en/user-reference/hooks.txt hooks.txt-20070830033044-xxu2rced13f72dka-1
      doc/index.txt                  index.txt-20070813101924-07gd9i9d2jt124bf-1
      tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
      doc/en/tutorials/tutorial.txt  tutorial.txt-20050804190939-9dcbba2ef053bc84
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.13
    revision-id:aaron.bentley at utoronto.ca-20071204001817-8subm5s03adnech2
    parent: aaron.bentley at utoronto.ca-20071130235238-jupc9hpjt1c4txxe
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-12-03 19:18:17 -0500
    message:
      Update assuming --weave is cheap
    modified:
      bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.12
    revision-id:aaron.bentley at utoronto.ca-20071130235238-jupc9hpjt1c4txxe
    parent: abentley at panoramicfeedback.com-20071130185520-f8w49ex8qwi31w9o
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-11-30 18:52:38 -0500
    message:
      Add documentation for the count_steps parameter of Graph.find_unique_lca
    modified:
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.11
    revision-id:abentley at panoramicfeedback.com-20071130185520-f8w49ex8qwi31w9o
    parent: aaron.bentley at utoronto.ca-20071130054230-vz8v3k3zkplxhvg6
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-11-30 13:55:20 -0500
    message:
      Add criss-cross help topic
    modified:
      bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.20.1.10
    revision-id:aaron.bentley at utoronto.ca-20071130054230-vz8v3k3zkplxhvg6
    parent: abentley at panoramicfeedback.com-20071126200031-bf33kxb528sokzsl
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-11-30 00:42:30 -0500
    message:
      Merge now warns when it encounters a criss-cross
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
=== modified file 'NEWS'
--- a/NEWS	2007-12-04 00:42:43 +0000
+++ b/NEWS	2007-12-04 03:52:13 +0000
@@ -130,6 +130,9 @@
 
   IMPROVEMENTS:
 
+   * ``bzr merge`` now warns when it encounters a criss-cross merge.
+     (Aaron Bentley)
+
    * ``bzr send`` now doesn't require the target e-mail address to be
      specified on the command line if an interactive e-mail client is used.
      (Lukáš Lalinský)

=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2007-12-01 01:12:28 +0000
+++ b/bzrlib/graph.py	2007-12-04 00:34:34 +0000
@@ -315,7 +315,8 @@
             common_walker.start_searching(new_common)
         return candidate_heads
 
-    def find_unique_lca(self, left_revision, right_revision):
+    def find_unique_lca(self, left_revision, right_revision,
+                        count_steps=False):
         """Find a unique LCA.
 
         Find lowest common ancestors.  If there is no unique  common
@@ -326,12 +327,22 @@
 
         Note that None is not an acceptable substitute for NULL_REVISION.
         in the input for this method.
+
+        :param count_steps: If True, the return value will be a tuple of
+            (unique_lca, steps) where steps is the number of times that
+            find_lca was run.  If False, only unique_lca is returned.
         """
         revisions = [left_revision, right_revision]
+        steps = 0
         while True:
+            steps += 1
             lca = self.find_lca(*revisions)
             if len(lca) == 1:
-                return lca.pop()
+                result = lca.pop()
+                if count_steps:
+                    return result, steps
+                else:
+                    return result
             if len(lca) == 0:
                 raise errors.NoCommonAncestor(left_revision, right_revision)
             revisions = lca

=== modified file 'bzrlib/help_topics.py'
--- a/bzrlib/help_topics.py	2007-11-30 09:51:22 +0000
+++ b/bzrlib/help_topics.py	2007-12-04 00:34:34 +0000
@@ -550,6 +550,34 @@
   log10 = log --short -r -10..-1
 """
 
+_criss_cross = \
+"""
+A criss-cross in the branch history can cause the default merge technique
+to emit more conflicts than would normally be expected.
+
+If you encounter criss-crosses, you can use merge --weave instead, which
+should provide a much better result.
+
+Criss-crosses occur in a branch's history if two branches merge the same thing
+and then merge one another, or if two branches merge one another at the same
+time.  They can be avoided by having each branch only merge from or into a
+designated central branch (a "star topology").
+
+Criss-crosses cause problems because of the way merge works.  Bazaar's default
+merge is a three-way merger; in order to merge OTHER into THIS, it must
+find a basis for comparison, BASE.  Using BASE, it can determine whether
+differences between THIS and OTHER are due to one side adding lines, or
+from another side removing lines.
+
+Criss-crosses mean there is no good choice for a base.  Selecting the recent
+merge points could cause one side's changes to be silently discarded.
+Selecting older merge points (which Bazaar does) mean that extra conflicts
+are emitted.
+
+The ``weave`` merge type is not affected by this problem because it uses
+line-origin detection instead of a basis revision to determine the cause of
+differences."""
+
 
 # Register help topics
 topic_registry.register("revisionspec", _help_on_revisionspec,
@@ -594,6 +622,8 @@
                         SECT_CONCEPT)
 topic_registry.register('working-trees', _working_trees,
                         'Information on working trees', SECT_CONCEPT)
+topic_registry.register('criss-cross', _criss_cross,
+                        'Information on criss-cross merging', SECT_CONCEPT)
 
 
 class HelpTopicIndex(object):

=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py	2007-12-03 21:38:07 +0000
+++ b/bzrlib/merge.py	2007-12-04 03:52:13 +0000
@@ -314,9 +314,13 @@
         if NULL_REVISION in revisions:
             self.base_rev_id = NULL_REVISION
         else:
-            self.base_rev_id = graph.find_unique_lca(*revisions)
+            self.base_rev_id, steps = graph.find_unique_lca(revisions[0],
+                revisions[1], count_steps=True)
             if self.base_rev_id == NULL_REVISION:
                 raise UnrelatedBranches()
+            if steps > 1:
+                warning('Warning: criss-cross merge encountered.  See bzr'
+                        ' help criss-cross.')
         self.base_tree = self.revision_tree(self.base_rev_id)
         self.base_is_ancestor = True
         self.base_is_other_ancestor = True

=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py	2007-11-23 17:40:15 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py	2007-12-04 03:13:51 +0000
@@ -392,3 +392,17 @@
         # pick 1 revision with option --changes
         self.run_bzr('merge -d target -c revid:rev_d source')
         self.assertDirectoryContent('target', ['.bzr', 'a', 'd'])
+
+    def test_merge_criss_cross(self):
+        tree_a = self.make_branch_and_tree('a')
+        tree_a.commit('', rev_id='rev1')
+        tree_b = tree_a.bzrdir.sprout('b').open_workingtree()
+        tree_a.commit('', rev_id='rev2a')
+        tree_b.commit('', rev_id='rev2b')
+        tree_a.merge_from_branch(tree_b.branch)
+        tree_b.merge_from_branch(tree_a.branch)
+        tree_a.commit('', rev_id='rev3a')
+        tree_b.commit('', rev_id='rev3b')
+        graph = tree_a.branch.repository.get_graph(tree_b.branch.repository)
+        out, err = self.run_bzr(['merge', '-d', 'a', 'b'])
+        self.assertContainsRe(err, 'Warning: criss-cross merge encountered.')

=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py	2007-12-01 01:12:28 +0000
+++ b/bzrlib/tests/test_graph.py	2007-12-04 00:34:34 +0000
@@ -236,11 +236,17 @@
                          graph.find_unique_lca(NULL_REVISION, 'rev1'))
         self.assertEqual('rev1', graph.find_unique_lca('rev1', 'rev1'))
         self.assertEqual('rev1', graph.find_unique_lca('rev2a', 'rev2b'))
+        self.assertEqual(('rev1', 1,),
+                         graph.find_unique_lca('rev2a', 'rev2b',
+                         count_steps=True))
 
     def test_unique_lca_criss_cross(self):
         """Ensure we don't pick non-unique lcas in a criss-cross"""
         graph = self.make_graph(criss_cross)
         self.assertEqual('rev1', graph.find_unique_lca('rev3a', 'rev3b'))
+        lca, steps = graph.find_unique_lca('rev3a', 'rev3b', count_steps=True)
+        self.assertEqual('rev1', lca)
+        self.assertEqual(2, steps)
 
     def test_unique_lca_null_revision(self):
         """Ensure we pick NULL_REVISION when necessary"""




More information about the bazaar-commits mailing list