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
1=== modified file 'bzrlib/graph.py'
2--- bzrlib/graph.py 2011-02-07 05:37:16 +0000
3+++ bzrlib/graph.py 2011-02-13 23:26:07 +0000
4@@ -15,6 +15,7 @@
5 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
7 import time
8+import pprint
9
10 from bzrlib import (
11 debug,
12@@ -70,10 +71,10 @@
13
14 class StackedParentsProvider(object):
15 """A parents provider which stacks (or unions) multiple providers.
16-
17+
18 The providers are queries in the order of the provided parent_providers.
19 """
20-
21+
22 def __init__(self, parent_providers):
23 self._parent_providers = parent_providers
24
25@@ -938,8 +939,10 @@
26 while True:
27 steps += 1
28 lca = self.find_lca(*revisions)
29+ pprint.pprint(lca)
30 if len(lca) == 1:
31 result = lca.pop()
32+ pprint.pprint(result)
33 if count_steps:
34 return result, steps
35 else:
36
37=== modified file 'bzrlib/merge.py'
38--- bzrlib/merge.py 2011-02-07 04:14:29 +0000
39+++ bzrlib/merge.py 2011-02-13 23:26:07 +0000
40@@ -15,6 +15,7 @@
41 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
42
43 import warnings
44+import pprint
45
46 from bzrlib.lazy_import import lazy_import
47 lazy_import(globals(), """
48@@ -80,7 +81,7 @@
49 """PerFileMerger objects are used by plugins extending merge for bzrlib.
50
51 See ``bzrlib.plugins.news_merge.news_merge`` for an example concrete class.
52-
53+
54 :ivar merger: The Merge3Merger performing the merge.
55 """
56
57@@ -90,7 +91,7 @@
58
59 def merge_contents(self, merge_params):
60 """Attempt to merge the contents of a single file.
61-
62+
63 :param merge_params: A bzrlib.merge.MergeHookParams
64 :return : A tuple of (status, chunks), where status is one of
65 'not_applicable', 'success', 'conflicted', or 'delete'. If status
66@@ -160,13 +161,13 @@
67 classes should implement ``merge_text``.
68
69 See ``bzrlib.plugins.news_merge.news_merge`` for an example concrete class.
70-
71+
72 :ivar affected_files: The configured file paths to merge.
73
74 :cvar name_prefix: The prefix to use when looking up configuration
75 details. <name_prefix>_merge_files describes the files targeted by the
76 hook for example.
77-
78+
79 :cvar default_files: The default file paths to merge when no configuration
80 is present.
81 """
82@@ -583,7 +584,13 @@
83 self._is_criss_cross = False
84 else:
85 lcas = self.revision_graph.find_lca(revisions[0], revisions[1])
86+ print('Original LCAS:')
87+ pprint.pprint(lcas)
88+ lcas = set([list(lcas)[0]])
89 self._is_criss_cross = False
90+ print('Using LCAS:')
91+ pprint.pprint(lcas)
92+ print('LCAS count: %d' % len(lcas))
93 if len(lcas) == 0:
94 self.base_rev_id = _mod_revision.NULL_REVISION
95 elif len(lcas) == 1:
96@@ -597,6 +604,7 @@
97 # find_unique_lca.
98 self.base_rev_id = self.revision_graph.find_unique_lca(
99 revisions[0], revisions[1])
100+ pprint.pprint(self.base_rev_id)
101 else:
102 self.base_rev_id = self.revision_graph.find_unique_lca(
103 *lcas)
104@@ -1451,7 +1459,7 @@
105 def merge_contents(self, merge_hook_params):
106 """Fallback merge logic after user installed hooks."""
107 # This function is used in merge hooks as the fallback instance.
108- # Perhaps making this function and the functions it calls be a
109+ # Perhaps making this function and the functions it calls be a
110 # a separate class would be better.
111 if merge_hook_params.winner == 'other':
112 # OTHER is a straight winner, so replace this contents with other
113@@ -1833,7 +1841,7 @@
114
115 class _MergeTypeParameterizer(object):
116 """Wrap a merge-type class to provide extra parameters.
117-
118+
119 This is hack used by MergeIntoMerger to pass some extra parameters to its
120 merge_type. Merger.do_merge() sets up its own set of parameters to pass to
121 the 'merge_type' member. It is difficult override do_merge without