Merge lp:~spiv/bzr-loom/bzr-2.4-compat into lp:bzr-loom

Proposed by Andrew Bennetts
Status: Merged
Approved by: John A Meinel
Approved revision: 130
Merged at revision: 131
Proposed branch: lp:~spiv/bzr-loom/bzr-2.4-compat
Merge into: lp:bzr-loom
Diff against target: 153 lines (+44/-17)
1 file modified
branch.py (+44/-17)
To merge this branch: bzr merge lp:~spiv/bzr-loom/bzr-2.4-compat
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+51714@code.launchpad.net

Description of the change

This branch depends on <https://code.launchpad.net/~spiv/bzr/branch-revs-to-fetch/+merge/51710>.

This fixes all the test failures in bzr-loom when run with lp:bzr.

Some points of interest, and maybe concern:

 * it now does a single fetch, rather than one fetch per thread. Yay!
 * for simplicity I haven't tried to maintain backwards compatibility with bzr 2.3. Should I?
 * I also implemented pushing/pulling etc of tags for looms. The model is simple: there's a global tags dict for the whole loom, independent of threads. That is, tag semantics are basically unaffected by 'bzr loomify'. This is part of this patch because it was the easiest path to getting tests passing; previously looms sort-of had tags, and the new tests in lp:bzr were partly failing because of that.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

+1

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 3/1/2011 9:39 AM, Andrew Bennetts wrote:
> Andrew Bennetts has proposed merging lp:~spiv/bzr-loom/bzr-2.4-compat into lp:bzr-loom.
>
> Requested reviews:
> Loom Developers (bzr-loom-devs)
> Related bugs:
> #721328 revno 5648 on bzr.dev broke loom tests
> https://bugs.launchpad.net/bugs/721328
>
> For more details, see:
> https://code.launchpad.net/~spiv/bzr-loom/bzr-2.4-compat/+merge/51714
>
> This branch depends on <https://code.launchpad.net/~spiv/bzr/branch-revs-to-fetch/+merge/51710>.
>
> This fixes all the test failures in bzr-loom when run with lp:bzr.
>
> Some points of interest, and maybe concern:
>
> * it now does a single fetch, rather than one fetch per thread. Yay!
> * for simplicity I haven't tried to maintain backwards compatibility with bzr 2.3. Should I?
> * I also implemented pushing/pulling etc of tags for looms. The model is simple: there's a global tags dict for the whole loom, independent of threads. That is, tag semantics are basically unaffected by 'bzr loomify'. This is part of this patch because it was the easiest path to getting tests passing; previously looms sort-of had tags, and the new tests in lp:bzr were partly failing because of that.

Just repeating Robert:
 merge: approve

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1tREUACgkQJdeBCYSNAANbygCgvlH1+VXgJRgLBUaFeq2aPe0M
zKIAnimF3IEjCPUjJ94TlRZ3O7H2vGzf
=s1qA
-----END PGP SIGNATURE-----

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'branch.py'
2--- branch.py 2011-02-23 13:27:27 +0000
3+++ branch.py 2011-03-01 08:38:29 +0000
4@@ -30,6 +30,8 @@
5 from bzrlib import bzrdir
6 from bzrlib.decorators import needs_read_lock, needs_write_lock
7 import bzrlib.errors
8+import bzrlib.fetch
9+import bzrlib.graph
10 import bzrlib.osutils
11 from bzrlib import remote, symbol_versioning
12 import bzrlib.trace
13@@ -409,6 +411,18 @@
14
15 nick = property(_loom_get_nick, _rename_thread)
16
17+ def heads_to_fetch(self):
18+ """See Branch.heads_to_fetch."""
19+ # The base implementation returns ([tip], tags)
20+ must_fetch, should_fetch = super(LoomSupport, self).heads_to_fetch()
21+ # Add each thread's content to must_fetch
22+ must_fetch.update(
23+ thread_rev for thread_name, thread_rev, thread_parents in
24+ self.get_loom_state().get_threads())
25+ must_fetch.discard(EMPTY_REVISION)
26+ must_fetch.discard(bzrlib.revision.NULL_REVISION)
27+ return must_fetch, should_fetch
28+
29 @needs_read_lock
30 def push(self, target, overwrite=False, stop_revision=None,
31 _override_hook_source_branch=None):
32@@ -591,7 +605,6 @@
33 return result
34
35 def finish_result(self, result):
36- result.tag_conflicts = None
37 result.new_revno, result.new_revid = self.target.last_revision_info()
38
39 def do_hooks(self, result, run_hooks):
40@@ -618,8 +631,9 @@
41 new_rev = self.source.last_revision()
42 if new_rev == EMPTY_REVISION:
43 new_rev = bzrlib.revision.NULL_REVISION
44+ fetch_spec = self.build_fetch_spec(stop_revision)
45 self.target.repository.fetch(self.source.repository,
46- revision_id=new_rev)
47+ fetch_spec=fetch_spec)
48 if not overwrite:
49 new_rev_ancestry = self.source.repository.get_ancestry(
50 new_rev)
51@@ -631,10 +645,20 @@
52 raise bzrlib.errors.DivergedBranches(
53 self.target, self.source)
54 self.target.generate_revision_history(new_rev)
55+ result.tag_conflicts = self.source.tags.merge_to(self.target.tags)
56 # get the final result object details
57 self.do_hooks(result, run_hooks)
58 return result
59
60+ def build_fetch_spec(self, stop_revision):
61+ factory = bzrlib.fetch.FetchSpecFactory()
62+ factory.source_branch = self.source
63+ factory.source_repo = self.source.repository
64+ factory.source_branch_stop_revision_id = stop_revision
65+ factory.target_repo = self.target.repository
66+ factory.target_repo_kind = bzrlib.fetch.TargetRepoKinds.PREEXISTING
67+ return factory.make_fetch_spec()
68+
69 def transfer(self, overwrite, stop_revision, run_hooks=True,
70 possible_transports=None, _override_hook_target=None, local=False):
71 """Implementation of push and pull"""
72@@ -672,17 +696,10 @@
73 source_state.get_basis_revision_id())
74 # stopping at from our repository.
75 revisions = [rev for name,rev in threads]
76- # for each thread from top to bottom, retrieve its referenced
77- # content. XXX FIXME: a revision_ids parameter to fetch would be
78- # nice here.
79- # the order is reversed because the common case is for the top
80- # thread to include all content.
81- for rev_id in reversed(revisions):
82- if rev_id not in (EMPTY_REVISION,
83- bzrlib.revision.NULL_REVISION):
84- # fetch the loom content for this revision
85- self.target.repository.fetch(self.source.repository,
86- revision_id=rev_id)
87+ # fetch content for all threads and tags.
88+ fetch_spec = self.build_fetch_spec(stop_revision)
89+ self.target.repository.fetch(self.source.repository,
90+ fetch_spec=fetch_spec)
91 # set our work threads to match (this is where we lose data if
92 # there are local mods)
93 my_state.set_threads(
94@@ -699,6 +716,8 @@
95 if new_rev == EMPTY_REVISION:
96 new_rev = bzrlib.revision.NULL_REVISION
97 self.target.generate_revision_history(new_rev)
98+ # merge tags
99+ result.tag_conflicts = self.source.tags.merge_to(self.target.tags)
100 self.do_hooks(result, run_hooks)
101 return result
102 finally:
103@@ -799,7 +818,7 @@
104 transport, 'lock', bzrlib.lockdir.LockDir)
105 if found_repository is None:
106 found_repository = a_bzrdir.find_repository()
107- return self._branch_class(_format=self,
108+ return self._branch_class()(_format=self,
109 _control_files=control_files,
110 a_bzrdir=a_bzrdir,
111 _repository=found_repository,
112@@ -836,7 +855,9 @@
113 This format is new in the loom plugin.
114 """
115
116- _branch_class = LoomBranch
117+ def _branch_class(self):
118+ return LoomBranch
119+
120 _parent_classs = bzrlib.branch.BzrBranchFormat5
121
122 def get_format_string(self):
123@@ -863,7 +884,9 @@
124 This format is new in the loom plugin.
125 """
126
127- _branch_class = LoomBranch6
128+ def _branch_class(self):
129+ return LoomBranch6
130+
131 _parent_classs = bzrlib.branch.BzrBranchFormat6
132
133 def get_format_string(self):
134@@ -890,7 +913,9 @@
135 This format is new in the loom plugin.
136 """
137
138- _branch_class = LoomBranch7
139+ def _branch_class(self):
140+ return LoomBranch7
141+
142 _parent_classs = bzrlib.branch.BzrBranchFormat7
143
144 def get_format_string(self):
145@@ -1018,6 +1043,8 @@
146 self.target.set_parent(parent)
147 if threads:
148 self.target._set_nick(threads[-1][0])
149+ if self.source._push_should_merge_tags():
150+ self.source.tags.merge_to(self.target.tags)
151
152 @needs_write_lock
153 def pull(self, overwrite=False, stop_revision=None,

Subscribers

People subscribed via source and target branches