Merge lp:~davidstrauss/bzr/lcas-subtree-workaround into lp:bzr

Proposed by David Strauss
Status: Work in progress
Proposed branch: lp:~davidstrauss/bzr/lcas-subtree-workaround
Merge into: lp:bzr
Diff against target: 121 lines (+19/-8)
2 files modified
bzrlib/graph.py (+5/-2)
bzrlib/merge.py (+14/-6)
To merge this branch: bzr merge lp:~davidstrauss/bzr/lcas-subtree-workaround
Reviewer Review Type Date Requested Status
bzr-core Pending
Review via email: mp+49578@code.launchpad.net

Commit message

This should not be committed to core.

Description of the change

This is not so much a merge proposal as much as a "view the diff on Launchpad" abuse of the merge proposal system.

To post a comment you must log in.

Unmerged revisions

5477. By David Strauss

Merge from trunk

5476. By David Strauss

Workaround for LCAS with subtrees.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/graph.py'
--- bzrlib/graph.py 2011-02-07 05:37:16 +0000
+++ bzrlib/graph.py 2011-02-13 23:26:07 +0000
@@ -15,6 +15,7 @@
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
17import time17import time
18import pprint
1819
19from bzrlib import (20from bzrlib import (
20 debug,21 debug,
@@ -70,10 +71,10 @@
7071
71class StackedParentsProvider(object):72class StackedParentsProvider(object):
72 """A parents provider which stacks (or unions) multiple providers.73 """A parents provider which stacks (or unions) multiple providers.
73 74
74 The providers are queries in the order of the provided parent_providers.75 The providers are queries in the order of the provided parent_providers.
75 """76 """
76 77
77 def __init__(self, parent_providers):78 def __init__(self, parent_providers):
78 self._parent_providers = parent_providers79 self._parent_providers = parent_providers
7980
@@ -938,8 +939,10 @@
938 while True:939 while True:
939 steps += 1940 steps += 1
940 lca = self.find_lca(*revisions)941 lca = self.find_lca(*revisions)
942 pprint.pprint(lca)
941 if len(lca) == 1:943 if len(lca) == 1:
942 result = lca.pop()944 result = lca.pop()
945 pprint.pprint(result)
943 if count_steps:946 if count_steps:
944 return result, steps947 return result, steps
945 else:948 else:
946949
=== modified file 'bzrlib/merge.py'
--- bzrlib/merge.py 2011-02-07 04:14:29 +0000
+++ bzrlib/merge.py 2011-02-13 23:26:07 +0000
@@ -15,6 +15,7 @@
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
17import warnings17import warnings
18import pprint
1819
19from bzrlib.lazy_import import lazy_import20from bzrlib.lazy_import import lazy_import
20lazy_import(globals(), """21lazy_import(globals(), """
@@ -80,7 +81,7 @@
80 """PerFileMerger objects are used by plugins extending merge for bzrlib.81 """PerFileMerger objects are used by plugins extending merge for bzrlib.
8182
82 See ``bzrlib.plugins.news_merge.news_merge`` for an example concrete class.83 See ``bzrlib.plugins.news_merge.news_merge`` for an example concrete class.
83 84
84 :ivar merger: The Merge3Merger performing the merge.85 :ivar merger: The Merge3Merger performing the merge.
85 """86 """
8687
@@ -90,7 +91,7 @@
9091
91 def merge_contents(self, merge_params):92 def merge_contents(self, merge_params):
92 """Attempt to merge the contents of a single file.93 """Attempt to merge the contents of a single file.
93 94
94 :param merge_params: A bzrlib.merge.MergeHookParams95 :param merge_params: A bzrlib.merge.MergeHookParams
95 :return : A tuple of (status, chunks), where status is one of96 :return : A tuple of (status, chunks), where status is one of
96 'not_applicable', 'success', 'conflicted', or 'delete'. If status97 'not_applicable', 'success', 'conflicted', or 'delete'. If status
@@ -160,13 +161,13 @@
160 classes should implement ``merge_text``.161 classes should implement ``merge_text``.
161162
162 See ``bzrlib.plugins.news_merge.news_merge`` for an example concrete class.163 See ``bzrlib.plugins.news_merge.news_merge`` for an example concrete class.
163 164
164 :ivar affected_files: The configured file paths to merge.165 :ivar affected_files: The configured file paths to merge.
165166
166 :cvar name_prefix: The prefix to use when looking up configuration167 :cvar name_prefix: The prefix to use when looking up configuration
167 details. <name_prefix>_merge_files describes the files targeted by the168 details. <name_prefix>_merge_files describes the files targeted by the
168 hook for example.169 hook for example.
169 170
170 :cvar default_files: The default file paths to merge when no configuration171 :cvar default_files: The default file paths to merge when no configuration
171 is present.172 is present.
172 """173 """
@@ -583,7 +584,13 @@
583 self._is_criss_cross = False584 self._is_criss_cross = False
584 else:585 else:
585 lcas = self.revision_graph.find_lca(revisions[0], revisions[1])586 lcas = self.revision_graph.find_lca(revisions[0], revisions[1])
587 print('Original LCAS:')
588 pprint.pprint(lcas)
589 lcas = set([list(lcas)[0]])
586 self._is_criss_cross = False590 self._is_criss_cross = False
591 print('Using LCAS:')
592 pprint.pprint(lcas)
593 print('LCAS count: %d' % len(lcas))
587 if len(lcas) == 0:594 if len(lcas) == 0:
588 self.base_rev_id = _mod_revision.NULL_REVISION595 self.base_rev_id = _mod_revision.NULL_REVISION
589 elif len(lcas) == 1:596 elif len(lcas) == 1:
@@ -597,6 +604,7 @@
597 # find_unique_lca.604 # find_unique_lca.
598 self.base_rev_id = self.revision_graph.find_unique_lca(605 self.base_rev_id = self.revision_graph.find_unique_lca(
599 revisions[0], revisions[1])606 revisions[0], revisions[1])
607 pprint.pprint(self.base_rev_id)
600 else:608 else:
601 self.base_rev_id = self.revision_graph.find_unique_lca(609 self.base_rev_id = self.revision_graph.find_unique_lca(
602 *lcas)610 *lcas)
@@ -1451,7 +1459,7 @@
1451 def merge_contents(self, merge_hook_params):1459 def merge_contents(self, merge_hook_params):
1452 """Fallback merge logic after user installed hooks."""1460 """Fallback merge logic after user installed hooks."""
1453 # This function is used in merge hooks as the fallback instance.1461 # This function is used in merge hooks as the fallback instance.
1454 # Perhaps making this function and the functions it calls be a 1462 # Perhaps making this function and the functions it calls be a
1455 # a separate class would be better.1463 # a separate class would be better.
1456 if merge_hook_params.winner == 'other':1464 if merge_hook_params.winner == 'other':
1457 # OTHER is a straight winner, so replace this contents with other1465 # OTHER is a straight winner, so replace this contents with other
@@ -1833,7 +1841,7 @@
18331841
1834class _MergeTypeParameterizer(object):1842class _MergeTypeParameterizer(object):
1835 """Wrap a merge-type class to provide extra parameters.1843 """Wrap a merge-type class to provide extra parameters.
1836 1844
1837 This is hack used by MergeIntoMerger to pass some extra parameters to its1845 This is hack used by MergeIntoMerger to pass some extra parameters to its
1838 merge_type. Merger.do_merge() sets up its own set of parameters to pass to1846 merge_type. Merger.do_merge() sets up its own set of parameters to pass to
1839 the 'merge_type' member. It is difficult override do_merge without1847 the 'merge_type' member. It is difficult override do_merge without